diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context')
120 files changed, 0 insertions, 14503 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingImpl.java deleted file mode 100644 index 3859a0abd4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaBasicMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaBasicMappingImpl extends GenericJavaBasicMapping implements EclipseLinkBasicMapping -{ - - protected final EclipseLinkJavaMutable mutable; - - public EclipseLinkJavaBasicMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkJavaMutable(this); - } - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkJavaConvert(this, this.resourcePersistentAttribute); - } - return null; - } - - @Override - protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) { - //check @Convert first, this is the order that EclipseLink searches - if (jrpa.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME) != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(jrpa); - } - - //************ EclipselinkJavaBasicMapping implementation **************** - - public Mutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.mutable.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.mutable.update(jrpa); - } - - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.mutable.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCaching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCaching.java deleted file mode 100644 index f16ace15c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCaching.java +++ /dev/null @@ -1,557 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.CacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.context.CacheType; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExistenceType; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaCaching extends AbstractJavaJpaContextNode implements JavaCaching -{ - - protected CacheType specifiedType; - protected Integer specifiedSize; - protected Boolean specifiedShared; - protected Boolean specifiedAlwaysRefresh; - protected Boolean specifiedRefreshOnlyIfNewer; - protected Boolean specifiedDisableHits; - - protected boolean existenceChecking; - protected ExistenceType specifiedExistenceType; - protected ExistenceType defaultExistenceType; - - protected CacheCoordinationType specifiedCoordinationType; - - protected Integer expiry; - protected EclipseLinkJavaExpiryTimeOfDay expiryTimeOfDay; - - - protected JavaResourcePersistentType resourcePersistentType; - - public EclipseLinkJavaCaching(JavaTypeMapping parent) { - super(parent); - } - - @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 CacheAnnotation getCacheAnnotation() { - return (CacheAnnotation) this.resourcePersistentType.getNonNullSupportingAnnotation(getCacheAnnotationName()); - } - - protected ExistenceCheckingAnnotation getExistenceCheckingAnnotation() { - return (ExistenceCheckingAnnotation) this.resourcePersistentType.getSupportingAnnotation(getExistenceCheckingAnnotationName()); - } - - protected String getCacheAnnotationName() { - return CacheAnnotation.ANNOTATION_NAME; - } - - protected String getExistenceCheckingAnnotationName() { - return ExistenceCheckingAnnotation.ANNOTATION_NAME; - } - - public CacheType getType() { - return (this.getSpecifiedType() == null) ? this.getDefaultType() : this.getSpecifiedType(); - } - - public CacheType getDefaultType() { - return DEFAULT_TYPE; - } - - public CacheType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(CacheType newSpecifiedType) { - CacheType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - this.getCacheAnnotation().setType(CacheType.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_(CacheType newSpecifiedType) { - CacheType 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 Caching.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 Caching.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(Caching.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(Caching.SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - } - - public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh == null) ? this.isDefaultAlwaysRefresh() : this.specifiedAlwaysRefresh.booleanValue(); - } - - public boolean isDefaultAlwaysRefresh() { - return Caching.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(Caching.SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - protected void setSpecifiedAlwaysRefresh_(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - firePropertyChanged(Caching.SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - public boolean isRefreshOnlyIfNewer() { - return (this.specifiedRefreshOnlyIfNewer == null) ? this.isDefaultRefreshOnlyIfNewer() : this.specifiedRefreshOnlyIfNewer.booleanValue(); - } - - public boolean isDefaultRefreshOnlyIfNewer() { - return Caching.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(Caching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - protected void setSpecifiedRefreshOnlyIfNewer_(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - firePropertyChanged(Caching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - public boolean isDisableHits() { - return (this.specifiedDisableHits == null) ? this.isDefaultDisableHits() : this.specifiedDisableHits.booleanValue(); - } - - public boolean isDefaultDisableHits() { - return Caching.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(Caching.SPECIFIED_DISABLE_HITS_PROPERTY, oldDisableHits, newSpecifiedDisableHits); - } - - protected void setSpecifiedDisableHits_(Boolean newSpecifiedDisableHits) { - Boolean oldDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - firePropertyChanged(Caching.SPECIFIED_DISABLE_HITS_PROPERTY, oldDisableHits, newSpecifiedDisableHits); - } - - public CacheCoordinationType getCoordinationType() { - return (this.getSpecifiedCoordinationType() == null) ? this.getDefaultCoordinationType() : this.getSpecifiedCoordinationType(); - } - - public CacheCoordinationType getDefaultCoordinationType() { - return DEFAULT_COORDINATION_TYPE; - } - - public CacheCoordinationType getSpecifiedCoordinationType() { - return this.specifiedCoordinationType; - } - - public void setSpecifiedCoordinationType(CacheCoordinationType newSpecifiedCoordinationType) { - CacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - this.getCacheAnnotation().setCoordinationType(CacheCoordinationType.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_(CacheCoordinationType newSpecifiedCoordinationType) { - CacheCoordinationType 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.addSupportingAnnotation(getExistenceCheckingAnnotationName()); - } - else { - this.resourcePersistentType.removeSupportingAnnotation(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 ExistenceType caclulateDefaultExistenceType() { - if (hasExistenceChecking()) { - return ExistenceType.CHECK_CACHE; - } - return DEFAULT_EXISTENCE_TYPE; - } - - public ExistenceType getExistenceType() { - return (this.getSpecifiedExistenceType() == null) ? this.getDefaultExistenceType() : this.getSpecifiedExistenceType(); - } - - public ExistenceType getDefaultExistenceType() { - return this.defaultExistenceType; - } - - protected void setDefaultExistenceType(ExistenceType newDefaultExistenceType) { - ExistenceType oldDefaultExistenceType = this.defaultExistenceType; - this.defaultExistenceType = newDefaultExistenceType; - firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, oldDefaultExistenceType, newDefaultExistenceType); - } - - public ExistenceType getSpecifiedExistenceType() { - return this.specifiedExistenceType; - } - - public void setSpecifiedExistenceType(ExistenceType newSpecifiedExistenceType) { - if (!hasExistenceChecking()) { - if (newSpecifiedExistenceType != null) { - setExistenceChecking(true); - } - else { - return; - } - } - ExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - this.getExistenceCheckingAnnotation().setValue(ExistenceType.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_(ExistenceType newSpecifiedExistenceType) { - ExistenceType 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 ExpiryTimeOfDay getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public ExpiryTimeOfDay addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("expiryTimeOfDay already exists, use getExpiryTimeOfDay()"); //$NON-NLS-1$ - } - if (this.resourcePersistentType.getSupportingAnnotation(getCacheAnnotationName()) == null) { - this.resourcePersistentType.addSupportingAnnotation(getCacheAnnotationName()); - } - EclipseLinkJavaExpiryTimeOfDay newExpiryTimeOfDay = new EclipseLinkJavaExpiryTimeOfDay(this); - this.expiryTimeOfDay = newExpiryTimeOfDay; - TimeOfDayAnnotation 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$ - } - ExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = null; - getCacheAnnotation().removeExpiryTimeOfDay(); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, null); - } - - protected void setExpiryTimeOfDay(EclipseLinkJavaExpiryTimeOfDay newExpiryTimeOfDay) { - EclipseLinkJavaExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = newExpiryTimeOfDay; - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, newExpiryTimeOfDay); - } - - public void initialize(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - initialize(getCacheAnnotation()); - initialize(getExistenceCheckingAnnotation()); - } - - protected void initialize(CacheAnnotation 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(ExistenceCheckingAnnotation existenceChecking) { - this.existenceChecking = existenceChecking != null; - this.specifiedExistenceType = specifiedExistenceType(existenceChecking); - this.defaultExistenceType = this.caclulateDefaultExistenceType(); - } - - protected void initializeExpiry(CacheAnnotation 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 EclipseLinkJavaExpiryTimeOfDay(this); - this.expiryTimeOfDay.initialize(cache.getExpiryTimeOfDay()); - } - } - } - - public void update(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - update(getCacheAnnotation()); - update(getExistenceCheckingAnnotation()); - updateExpiry(getCacheAnnotation()); - } - - protected void update(CacheAnnotation 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(ExistenceCheckingAnnotation existenceChecking) { - setExistenceChecking_(existenceChecking != null); - setSpecifiedExistenceType_(specifiedExistenceType(existenceChecking)); - setDefaultExistenceType(caclulateDefaultExistenceType()); - } - - protected void updateExpiry(CacheAnnotation 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 EclipseLinkJavaExpiryTimeOfDay(this)); - this.expiryTimeOfDay.initialize(cache.getExpiryTimeOfDay()); - } - else { //handle with validation if both expiry and expiryTimeOfDay are set - setExpiryTimeOfDay(null); - } - } - } - - protected CacheType specifiedType(CacheAnnotation cache) { - return CacheType.fromJavaResourceModel(cache.getType()); - } - - protected Integer specifiedSize(CacheAnnotation cache) { - return cache.getSize(); - } - - protected Boolean specifiedShared(CacheAnnotation cache) { - return cache.getShared(); - } - - protected Boolean specifiedAlwaysRefresh(CacheAnnotation cache) { - return cache.getAlwaysRefresh(); - } - - protected Boolean specifiedRefreshOnlyIfNewer(CacheAnnotation cache) { - return cache.getRefreshOnlyIfNewer(); - } - - protected Boolean specifiedDisableHits(CacheAnnotation cache) { - return cache.getDisableHits(); - } - - protected CacheCoordinationType specifiedCoordinationType(CacheAnnotation cache) { - return CacheCoordinationType.fromJavaResourceModel(cache.getCoordinationType()); - } - - protected Integer expiry(CacheAnnotation cache) { - return cache.getExpiry(); - } - - protected ExistenceType specifiedExistenceType(ExistenceCheckingAnnotation existenceChecking) { - if (existenceChecking == null) { - return null; - } - return ExistenceType.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, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.validateExpiry(messages, astRoot); - } - - protected void validateExpiry(List<IMessage> messages, CompilationUnit astRoot) { - CacheAnnotation 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/EclipseLinkJavaChangeTracking.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaChangeTracking.java deleted file mode 100644 index 429c3281fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaChangeTracking.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation; - -public class EclipseLinkJavaChangeTracking extends AbstractJavaJpaContextNode implements ChangeTracking -{ - protected JavaResourcePersistentType resourcePersistentType; - - protected ChangeTrackingType specifiedType; - - - public EclipseLinkJavaChangeTracking(JavaTypeMapping parent) { - super(parent); - } - - @Override - public JavaTypeMapping getParent() { - return (JavaTypeMapping) super.getParent(); - } - - @Override - protected EclipseLinkJpaFactory getJpaFactory() { - return (EclipseLinkJpaFactory) super.getJpaFactory(); - } - - protected String getChangeTrackingAnnotationName() { - return ChangeTrackingAnnotation.ANNOTATION_NAME; - } - - protected ChangeTrackingAnnotation getChangeTrackingAnnotation() { - return (ChangeTrackingAnnotation) this.resourcePersistentType.getSupportingAnnotation(getChangeTrackingAnnotationName()); - } - - protected void addChangeTrackingAnnotation() { - this.resourcePersistentType.addSupportingAnnotation(getChangeTrackingAnnotationName()); - } - - protected void removeChangeTrackingAnnotation() { - this.resourcePersistentType.removeSupportingAnnotation(getChangeTrackingAnnotationName()); - } - - public ChangeTrackingType getType() { - return (this.getSpecifiedType() != null) ? this.getSpecifiedType() : this.getDefaultType(); - } - - public ChangeTrackingType getDefaultType() { - return DEFAULT_TYPE; - } - - public ChangeTrackingType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(ChangeTrackingType newSpecifiedType) { - if (this.specifiedType == newSpecifiedType) { - return; - } - - ChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - - if (newSpecifiedType != null) { - if (getChangeTrackingAnnotation() == null) { - addChangeTrackingAnnotation(); - } - getChangeTrackingAnnotation().setValue(ChangeTrackingType.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_(ChangeTrackingType newSpecifiedType) { - ChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - public void initialize(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - ChangeTrackingAnnotation changeTrackingAnnotation = this.getChangeTrackingAnnotation(); - this.specifiedType = changeTrackingType(changeTrackingAnnotation); - } - - public void update(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - ChangeTrackingAnnotation changeTrackingAnnotation = this.getChangeTrackingAnnotation(); - this.setSpecifiedType_(changeTrackingType(changeTrackingAnnotation)); - } - - protected ChangeTrackingType changeTrackingType(ChangeTrackingAnnotation changeTracking) { - if (changeTracking == null) { - return null; - } - else if (changeTracking.getValue() == null) { - return ChangeTracking.DEFAULT_TYPE; - } - else { - return ChangeTrackingType.fromJavaResourceModel(changeTracking.getValue()); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - ChangeTrackingAnnotation 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/EclipseLinkJavaConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConversionValue.java deleted file mode 100644 index c1c579d3b9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConversionValue.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.ConversionValue; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaConversionValue extends AbstractJavaJpaContextNode implements ConversionValue -{ - private ConversionValueAnnotation resourceConversionValue; - - private String dataValue; - - private String objectValue; - - public EclipseLinkJavaConversionValue(EclipseLinkJavaObjectTypeConverter parent) { - super(parent); - } - - @Override - public EclipseLinkJavaObjectTypeConverter getParent() { - return (EclipseLinkJavaObjectTypeConverter) super.getParent(); - } - - protected String getAnnotationName() { - return ConversionValueAnnotation.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(ConversionValueAnnotation resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.dataValue = this.dataValue(); - this.objectValue = this.objectValue(); - } - - public void update(ConversionValueAnnotation 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, CompilationUnit astRoot) { - super.validate(messages, 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/EclipseLinkJavaConvert.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConvert.java deleted file mode 100644 index dd06dc52d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConvert.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.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.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaConvert extends AbstractJavaJpaContextNode implements Convert, JavaConverter -{ - private String specifiedConverterName; - - private JavaResourcePersistentAttribute resourcePersistentAttribute; - - private EclipseLinkJavaConverter converter; - - public EclipseLinkJavaConvert(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) { - super(parent); - this.initialize(jrpa); - } - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - public String getType() { - return Convert.ECLIPSE_LINK_CONVERTER; - } - - protected String getAnnotationName() { - return ConvertAnnotation.ANNOTATION_NAME; - } - - public void addToResourceModel() { - this.resourcePersistentAttribute.addSupportingAnnotation(getAnnotationName()); - } - - public void removeFromResourceModel() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getAnnotationName()); - if (getConverter() != null) { - this.resourcePersistentAttribute.removeSupportingAnnotation(getConverter().getAnnotationName()); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getResourceConvert().getTextRange(astRoot); - } - - protected ConvertAnnotation getResourceConvert() { - return (ConvertAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(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 EclipseLinkJavaConverter 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; - } - EclipseLinkJavaConverter oldConverter = this.converter; - EclipseLinkJavaConverter newConverter = buildConverter(converterType); - this.converter = null; - if (oldConverter != null) { - this.resourcePersistentAttribute.removeSupportingAnnotation(oldConverter.getAnnotationName()); - } - this.converter = newConverter; - if (newConverter != null) { - this.resourcePersistentAttribute.addSupportingAnnotation(newConverter.getAnnotationName()); - } - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void setConverter(EclipseLinkJavaConverter newConverter) { - EclipseLinkJavaConverter oldConverter = this.converter; - this.converter = newConverter; - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.specifiedConverterName = this.specifiedConverterName(getResourceConvert()); - this.converter = this.buildConverter(this.converterType(jrpa)); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.setSpecifiedConverterName_(this.specifiedConverterName(getResourceConvert())); - if (converterType(jrpa) == getConverterType()) { - getConverter().update(jrpa); - } - else { - EclipseLinkJavaConverter javaConverter = buildConverter(converterType(jrpa)); - setConverter(javaConverter); - } - } - - protected String specifiedConverterName(ConvertAnnotation resourceConvert) { - return resourceConvert == null ? null : resourceConvert.getValue(); - } - - - protected EclipseLinkJavaConverter buildConverter(String converterType) { - if (converterType == EclipseLinkConverter.NO_CONVERTER) { - return null; - } - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkJavaCustomConverter(this, this.resourcePersistentAttribute); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkJavaTypeConverter(this, this.resourcePersistentAttribute); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkJavaObjectTypeConverter(this, this.resourcePersistentAttribute); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkJavaStructConverter(this, this.resourcePersistentAttribute); - } - return null; - } - - protected String converterType(JavaResourcePersistentAttribute jrpa) { - if (jrpa.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - else if (jrpa.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.TYPE_CONVERTER; - } - else if (jrpa.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - else if (jrpa.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - return null; - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - if (getConverter() != null) { - getConverter().validate(messages, astRoot); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverter.java deleted file mode 100644 index ec670aba04..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverter.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.NamedConverterAnnotation; -import org.eclipse.jpt.utility.internal.StringTools; - -public abstract class EclipseLinkJavaConverter extends AbstractJavaJpaContextNode - implements EclipseLinkConverter -{ - private JavaResourcePersistentMember resourcePersistentMember; - - private String name; - - - protected EclipseLinkJavaConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent); - this.initialize(jrpm); - } - - - protected NamedConverterAnnotation getAnnotation() { - return (NamedConverterAnnotation) this.resourcePersistentMember.getSupportingAnnotation(getAnnotationName()); - } - - protected abstract String getAnnotationName(); - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - // **************** 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()); - getPersistenceUnit().addConverter(this); - } - - protected void update(JavaResourcePersistentMember jrpm) { - this.resourcePersistentMember = jrpm; - this.setName_(this.name(getAnnotation())); - getPersistenceUnit().addConverter(this); - } - - protected String name(NamedConverterAnnotation 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/EclipseLinkJavaConverterHolder.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverterHolder.java deleted file mode 100644 index 56ec6898f6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverterHolder.java +++ /dev/null @@ -1,345 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder; -import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaConverterHolder extends AbstractJavaJpaContextNode implements JavaConverterHolder -{ - protected JavaResourcePersistentType resourcePersistentType; - - protected EclipseLinkJavaCustomConverter converter; - protected EclipseLinkJavaObjectTypeConverter objectTypeConverter; - protected EclipseLinkJavaStructConverter structConverter; - protected EclipseLinkJavaTypeConverter typeConverter; - - public EclipseLinkJavaConverterHolder(JavaTypeMapping parent) { - super(parent); - } - - //************** converter ************* - public CustomConverter getConverter() { - return this.converter; - } - - public CustomConverter addConverter() { - if (this.converter != null) { - throw new IllegalStateException("converter already exists"); //$NON-NLS-1$ - } - this.converter = new EclipseLinkJavaCustomConverter(this, this.resourcePersistentType); - this.resourcePersistentType.addSupportingAnnotation(this.converter.getAnnotationName()); - firePropertyChanged(CONVERTER_PROPERTY, null, this.converter); - return this.converter; - } - - protected void addConverter_() { - this.converter = new EclipseLinkJavaCustomConverter(this, this.resourcePersistentType); - firePropertyChanged(CONVERTER_PROPERTY, null, this.converter); - } - - public void removeConverter() { - if (this.converter == null) { - throw new IllegalStateException("converter is null"); //$NON-NLS-1$ - } - EclipseLinkJavaCustomConverter oldConverter = this.converter; - this.converter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeConverter_() { - this.converter = null; - firePropertyChanged(CONVERTER_PROPERTY, this.converter, null); - } - - protected String getConverterAnnotationName() { - return ConverterAnnotation.ANNOTATION_NAME; - } - - protected ConverterAnnotation getResourceConverter() { - return (ConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getConverterAnnotationName()); - } - - - //************** object type converter ************* - public ObjectTypeConverter getObjectTypeConverter() { - return this.objectTypeConverter; - } - - public ObjectTypeConverter addObjectTypeConverter() { - if (this.objectTypeConverter != null) { - throw new IllegalStateException("object type converter already exists"); //$NON-NLS-1$ - } - this.objectTypeConverter = new EclipseLinkJavaObjectTypeConverter(this, this.resourcePersistentType); - this.resourcePersistentType.addSupportingAnnotation(this.objectTypeConverter.getAnnotationName()); - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, null, this.objectTypeConverter); - return this.objectTypeConverter; - } - - protected void addObjectTypeConverter_() { - this.objectTypeConverter = new EclipseLinkJavaObjectTypeConverter(this, this.resourcePersistentType); - 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$ - } - EclipseLinkJavaObjectTypeConverter oldConverter = this.objectTypeConverter; - this.objectTypeConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeObjectTypeConverter_() { - ObjectTypeConverter oldConverter = this.objectTypeConverter; - this.objectTypeConverter = null; - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getObjectTypeConverterAnnotationName() { - return ObjectTypeConverterAnnotation.ANNOTATION_NAME; - } - - protected ObjectTypeConverterAnnotation getResourceObjectTypeConverter() { - return (ObjectTypeConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getObjectTypeConverterAnnotationName()); - } - - - //************** type converter ************* - public TypeConverter getTypeConverter() { - return this.typeConverter; - } - - public TypeConverter addTypeConverter() { - if (this.typeConverter != null) { - throw new IllegalStateException("type converter already exists"); //$NON-NLS-1$ - } - this.typeConverter = new EclipseLinkJavaTypeConverter(this, this.resourcePersistentType); - this.resourcePersistentType.addSupportingAnnotation(this.typeConverter.getAnnotationName()); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, null, this.typeConverter); - return this.typeConverter; - } - - protected void addTypeConverter_() { - this.typeConverter = new EclipseLinkJavaTypeConverter(this, this.resourcePersistentType); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, null, this.typeConverter); - } - - public void removeTypeConverter() { - if (this.typeConverter == null) { - throw new IllegalStateException("type converter is null"); //$NON-NLS-1$ - } - EclipseLinkJavaTypeConverter oldConverter = this.typeConverter; - this.typeConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeTypeConverter_() { - TypeConverter oldConverter = this.typeConverter; - this.typeConverter = null; - firePropertyChanged(TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getTypeConverterAnnotationName() { - return TypeConverterAnnotation.ANNOTATION_NAME; - } - - protected TypeConverterAnnotation getResourceTypeConverter() { - return (TypeConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getTypeConverterAnnotationName()); - } - - - //************** struct converter ************* - public StructConverter getStructConverter() { - return this.structConverter; - } - - public StructConverter addStructConverter() { - if (this.structConverter != null) { - throw new IllegalStateException("struct converter already exists"); //$NON-NLS-1$ - } - this.structConverter = new EclipseLinkJavaStructConverter(this, this.resourcePersistentType); - this.resourcePersistentType.addSupportingAnnotation(this.structConverter.getAnnotationName()); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, null, this.structConverter); - return this.structConverter; - } - - protected void addStructConverter_() { - this.structConverter = new EclipseLinkJavaStructConverter(this, this.resourcePersistentType); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, null, this.structConverter); - } - - public void removeStructConverter() { - if (this.structConverter == null) { - throw new IllegalStateException("struct converter is null"); //$NON-NLS-1$ - } - EclipseLinkJavaStructConverter oldConverter = this.structConverter; - this.structConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeStructConverter_() { - StructConverter oldConverter = this.structConverter; - this.structConverter = null; - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getStructConverterAnnotationName() { - return StructConverterAnnotation.ANNOTATION_NAME; - } - - protected StructConverterAnnotation getResourceStructConverter() { - return (StructConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getStructConverterAnnotationName()); - } - - public void update(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.updateConverter(); - this.updateObjectTypeConverter(); - this.updateTypeConverter(); - this.updateStructConverter(); - } - - protected void updateConverter() { - if (getResourceConverter() != null) { - if (this.converter != null) { - this.converter.update(this.resourcePersistentType); - } - else { - addConverter_(); - } - } - else { - if (this.converter != null) { - removeConverter_(); - } - } - } - - 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.initializeConverter(); - this.initializeObjectTypeConverter(); - this.initializeTypeConverter(); - this.initializeStructConverter(); - } - - protected void initializeConverter() { - if (getResourceConverter() != null) { - this.converter = new EclipseLinkJavaCustomConverter(this, this.resourcePersistentType); - } - } - - protected void initializeObjectTypeConverter() { - if (getResourceObjectTypeConverter() != null) { - this.objectTypeConverter = new EclipseLinkJavaObjectTypeConverter(this, this.resourcePersistentType); - } - } - - protected void initializeTypeConverter() { - if (getResourceTypeConverter() != null) { - this.typeConverter = new EclipseLinkJavaTypeConverter(this, this.resourcePersistentType); - } - } - - protected void initializeStructConverter() { - if (getResourceStructConverter() != null) { - this.structConverter = new EclipseLinkJavaStructConverter(this, this.resourcePersistentType); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourcePersistentType.getTextRange(astRoot); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - if (this.converter != null) { - this.converter.validate(messages, astRoot); - } - if (this.objectTypeConverter != null) { - this.objectTypeConverter.validate(messages, astRoot); - } - if (this.typeConverter != null) { - this.typeConverter.validate(messages, astRoot); - } - if (this.structConverter != null) { - this.structConverter.validate(messages, astRoot); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomConverter.java deleted file mode 100644 index 8f0cc2736c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomConverter.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.CustomConverter; -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.ConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaCustomConverter extends EclipseLinkJavaConverter - implements CustomConverter -{ - private String converterClass; - - public EclipseLinkJavaCustomConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent, jrpm); - } - - - public String getType() { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - - public String getAnnotationName() { - return ConverterAnnotation.ANNOTATION_NAME; - } - - @Override - protected ConverterAnnotation getAnnotation() { - return (ConverterAnnotation) 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 *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - this.converterClass = this.converterClass(getAnnotation()); - } - - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - this.setConverterClass_(this.converterClass(getAnnotation())); - } - - protected String converterClass(ConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getConverterClass(); - } - - public TextRange getConverterClassTextRange(CompilationUnit astRoot) { - return getAnnotation().getConverterClassTextRange(astRoot); - } - - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - validateConverterClass(messages, astRoot); - } - - protected void validateConverterClass(List<IMessage> messages, CompilationUnit astRoot) { - if (! getAnnotation().implementsConverter()) { - 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/EclipseLinkJavaCustomizer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomizer.java deleted file mode 100644 index 527aaf1d8c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomizer.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.Customizer; -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.CustomizerAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaCustomizer extends AbstractJavaJpaContextNode implements Customizer -{ - private JavaResourcePersistentType resourcePersistentType; - - private String customizerClass; - - public EclipseLinkJavaCustomizer(JavaJpaContextNode parent) { - super(parent); - } - - @Override - protected EclipseLinkJpaFactory getJpaFactory() { - return (EclipseLinkJpaFactory) super.getJpaFactory(); - } - - protected String getAnnotationName() { - return CustomizerAnnotation.ANNOTATION_NAME; - } - - protected void addResourceCustomizer() { - this.resourcePersistentType.addSupportingAnnotation(getAnnotationName()); - } - - protected void removeResourceCustomizer() { - this.resourcePersistentType.removeSupportingAnnotation(getAnnotationName()); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getResourceCustomizer().getTextRange(astRoot); - } - - protected CustomizerAnnotation getResourceCustomizer() { - return (CustomizerAnnotation) this.resourcePersistentType.getSupportingAnnotation(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; - CustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - this.customizerClass = this.customizerClass(resourceCustomizer); - } - - public void update(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - CustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - this.setCustomizerClass_(this.customizerClass(resourceCustomizer)); - } - - protected String customizerClass(CustomizerAnnotation resourceCustomizer) { - return resourceCustomizer == null ? null : resourceCustomizer.getValue(); - } - - public TextRange getCustomizerClassTextRange(CompilationUnit astRoot) { - return getResourceCustomizer().getValueTextRange(astRoot); - } - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - validateConverterClass(messages, astRoot); - } - - protected void validateConverterClass(List<IMessage> messages, CompilationUnit astRoot) { - CustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - if (resourceCustomizer != null && !resourceCustomizer.implementsDescriptorCustomizer()) { - 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/EclipseLinkJavaEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableImpl.java deleted file mode 100644 index d3e1c24a66..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.GenericJavaEmbeddable; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEmbeddable; -import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaEmbeddableImpl extends GenericJavaEmbeddable implements EclipseLinkJavaEmbeddable -{ - - protected final JavaConverterHolder converterHolder; - - protected final EclipseLinkJavaCustomizer customizer; - - protected final EclipseLinkJavaChangeTracking changeTracking; - - public EclipseLinkJavaEmbeddableImpl(JavaPersistentType parent) { - super(parent); - this.converterHolder = new EclipseLinkJavaConverterHolder(this); - this.customizer = new EclipseLinkJavaCustomizer(this); - this.changeTracking = new EclipseLinkJavaChangeTracking(this); - } - - public JavaConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking 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, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.converterHolder.validate(messages, astRoot); - this.customizer.validate(messages, astRoot); - this.changeTracking.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEntityImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEntityImpl.java deleted file mode 100644 index e8f0dfc4d0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEntityImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.GenericJavaEntity; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaEntityImpl extends GenericJavaEntity implements EclipseLinkJavaEntity -{ - protected final JavaCaching eclipseLinkCaching; - - protected final JavaConverterHolder converterHolder; - - protected final EclipseLinkJavaReadOnly readOnly; - - protected final EclipseLinkJavaCustomizer customizer; - - protected final EclipseLinkJavaChangeTracking changeTracking; - - public EclipseLinkJavaEntityImpl(JavaPersistentType parent) { - super(parent); - this.eclipseLinkCaching = new EclipseLinkJavaCaching(this); - this.converterHolder = new EclipseLinkJavaConverterHolder(this); - this.readOnly = new EclipseLinkJavaReadOnly(this); - this.changeTracking = new EclipseLinkJavaChangeTracking(this); - this.customizer = new EclipseLinkJavaCustomizer(this); - } - - public JavaCaching getCaching() { - return this.eclipseLinkCaching; - } - - public JavaConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public ReadOnly getReadOnly() { - return this.readOnly; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - @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, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.eclipseLinkCaching.validate(messages, astRoot); - this.converterHolder.validate(messages, astRoot); - this.readOnly.validate(messages, astRoot); - this.customizer.validate(messages, astRoot); - this.changeTracking.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaExpiryTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaExpiryTimeOfDay.java deleted file mode 100644 index b893c2c6cd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaExpiryTimeOfDay.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation; - -public class EclipseLinkJavaExpiryTimeOfDay extends AbstractJavaJpaContextNode - implements ExpiryTimeOfDay -{ - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - protected TimeOfDayAnnotation timeOfDay; - - public EclipseLinkJavaExpiryTimeOfDay(Caching 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(TimeOfDayAnnotation timeOfDay) { - this.timeOfDay = timeOfDay; - this.hour = getHour(timeOfDay); - this.minute = getMinute(timeOfDay); - this.second = getSecond(timeOfDay); - this.millisecond = getMillisecond(timeOfDay); - } - - public void update(TimeOfDayAnnotation timeOfDay) { - this.timeOfDay = timeOfDay; - this.setHour_(getHour(timeOfDay)); - this.setMinute_(getMinute(timeOfDay)); - this.setSecond_(getSecond(timeOfDay)); - this.setMillisecond_(getMillisecond(timeOfDay)); - } - - protected Integer getHour(TimeOfDayAnnotation timeOfDay) { - return timeOfDay.getHour(); - } - - protected Integer getMinute(TimeOfDayAnnotation timeOfDay) { - return timeOfDay.getMinute(); - } - - protected Integer getSecond(TimeOfDayAnnotation timeOfDay) { - return timeOfDay.getSecond(); - } - - protected Integer getMillisecond(TimeOfDayAnnotation timeOfDay) { - return timeOfDay.getMillisecond(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingImpl.java deleted file mode 100644 index 5ec2f068ab..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaIdMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaIdMappingImpl extends GenericJavaIdMapping implements EclipseLinkIdMapping -{ - protected final EclipseLinkJavaMutable mutable; - - public EclipseLinkJavaIdMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkJavaMutable(this); - } - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkJavaConvert(this, this.resourcePersistentAttribute); - } - return null; - } - - @Override - protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) { - //check @Convert first, this is the order that EclipseLink searches - if (jrpa.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME) != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(jrpa); - } - - - //************ EclipselinkJavaIdMapping implementation **************** - - public Mutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.mutable.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.mutable.update(jrpa); - } - - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.mutable.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaJoinFetch.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaJoinFetch.java deleted file mode 100644 index 73d73b83c7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaJoinFetch.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation; - -public class EclipseLinkJavaJoinFetch extends AbstractJavaJpaContextNode implements JoinFetch -{ - protected JoinFetchType joinFetchValue; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - - public EclipseLinkJavaJoinFetch(JavaAttributeMapping parent) { - super(parent); - } - - - protected String getJoinFetchAnnotationName() { - return JoinFetchAnnotation.ANNOTATION_NAME; - } - - protected JoinFetchAnnotation getResourceJoinFetch() { - return (JoinFetchAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getJoinFetchAnnotationName()); - } - - protected void addResourceJoinFetch() { - this.resourcePersistentAttribute.addSupportingAnnotation(getJoinFetchAnnotationName()); - } - - protected void removeResourceJoinFetch() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getJoinFetchAnnotationName()); - } - - public JoinFetchType getValue() { - return this.joinFetchValue; - } - - protected JoinFetchType getDefaultValue() { - return JoinFetch.DEFAULT_VALUE; - } - - public void setValue(JoinFetchType newJoinFetchValue) { - if (this.joinFetchValue == newJoinFetchValue) { - return; - } - - JoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - - if (newJoinFetchValue != null) { - if (getResourceJoinFetch() == null) { - addResourceJoinFetch(); - } - getResourceJoinFetch().setValue(JoinFetchType.toJavaResourceModel(newJoinFetchValue)); - } - else { - if (getResourceJoinFetch() != null) { - removeResourceJoinFetch(); - } - } - firePropertyChanged(JoinFetch.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_(JoinFetchType newJoinFetchValue) { - JoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - firePropertyChanged(JoinFetch.VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - public void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - JoinFetchAnnotation resourceJoinFetch = this.getResourceJoinFetch(); - this.joinFetchValue = this.joinFetch(resourceJoinFetch); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - JoinFetchAnnotation resourceJoinFetch = this.getResourceJoinFetch(); - setValue_(joinFetch(resourceJoinFetch)); - } - - private JoinFetchType joinFetch(JoinFetchAnnotation resourceJoinFetch) { - if (resourceJoinFetch == null) { - return null; - } - if (resourceJoinFetch.getValue() == null) { - // @JoinFetch is equivalent to @JoinFetch(JoinFetch.INNER) - return getDefaultValue(); - } - return JoinFetchType.fromJavaResourceModel(resourceJoinFetch.getValue()); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - JoinFetchAnnotation 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/EclipseLinkJavaManyToManyMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingImpl.java deleted file mode 100644 index 16581ea2bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaManyToManyMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaManyToManyMappingImpl extends GenericJavaManyToManyMapping implements EclipseLinkRelationshipMapping -{ - protected final EclipseLinkJavaJoinFetch joinFetch; - - - public EclipseLinkJavaManyToManyMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkJavaJoinFetch(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.joinFetch.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.joinFetch.update(jrpa); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.joinFetch.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingImpl.java deleted file mode 100644 index 3eff7dc4ca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaManyToOneMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaManyToOneMappingImpl extends GenericJavaManyToOneMapping implements EclipseLinkRelationshipMapping -{ - protected final EclipseLinkJavaJoinFetch joinFetch; - - - public EclipseLinkJavaManyToOneMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkJavaJoinFetch(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.joinFetch.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.joinFetch.update(jrpa); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.joinFetch.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassImpl.java deleted file mode 100644 index de0fa20727..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.GenericJavaMappedSuperclass; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaMappedSuperclassImpl extends GenericJavaMappedSuperclass implements EclipseLinkJavaMappedSuperclass -{ - protected JavaCaching eclipseLinkCaching; - - protected final JavaConverterHolder converterHolder; - - protected final EclipseLinkJavaReadOnly readOnly; - - protected final EclipseLinkJavaCustomizer customizer; - - protected final EclipseLinkJavaChangeTracking changeTracking; - - public EclipseLinkJavaMappedSuperclassImpl(JavaPersistentType parent) { - super(parent); - this.eclipseLinkCaching = new EclipseLinkJavaCaching(this); - this.converterHolder = new EclipseLinkJavaConverterHolder(this); - this.readOnly = new EclipseLinkJavaReadOnly(this); - this.customizer = new EclipseLinkJavaCustomizer(this); - this.changeTracking = new EclipseLinkJavaChangeTracking(this); - } - - public JavaCaching getCaching() { - return this.eclipseLinkCaching; - } - - public JavaConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public ReadOnly getReadOnly() { - return this.readOnly; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - @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, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.eclipseLinkCaching.validate(messages, astRoot); - this.converterHolder.validate(messages, astRoot); - this.readOnly.validate(messages, astRoot); - this.customizer.validate(messages, astRoot); - this.changeTracking.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMutable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMutable.java deleted file mode 100644 index 154baa39be..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMutable.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.Mutable; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation; - -public class EclipseLinkJavaMutable extends AbstractJavaJpaContextNode implements Mutable -{ - protected boolean defaultMutable; - protected Boolean specifiedMutable; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - public EclipseLinkJavaMutable(JavaAttributeMapping parent) { - super(parent); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - protected String getMutableAnnotationName() { - return MutableAnnotation.ANNOTATION_NAME; - } - - protected MutableAnnotation getResourceMutable() { - return (MutableAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getMutableAnnotationName()); - } - - protected void addResourceMutable() { - this.resourcePersistentAttribute.addSupportingAnnotation(getMutableAnnotationName()); - } - - protected void removeResourceMutable() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getMutableAnnotationName()); - } - - protected boolean calculateDefaultMutable() { - if (this.resourcePersistentAttribute.typeIsDateOrCalendar()) { - Boolean persistenceUnitDefaultMutable = getPersistenceUnit().getOptions().getTemporalMutable(); - return persistenceUnitDefaultMutable == null ? false : persistenceUnitDefaultMutable.booleanValue(); - } - return this.resourcePersistentAttribute.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(Mutable.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; - MutableAnnotation resourceMutable = this.getResourceMutable(); - this.specifiedMutable = this.specifiedMutable(resourceMutable); - this.defaultMutable = this.calculateDefaultMutable(); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - MutableAnnotation resourceMutable = this.getResourceMutable(); - this.setSpecifiedMutable_(this.specifiedMutable(resourceMutable)); - this.setDefaultMutable(this.calculateDefaultMutable()); - } - - private Boolean specifiedMutable(MutableAnnotation 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) { - MutableAnnotation 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/EclipseLinkJavaObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaObjectTypeConverter.java deleted file mode 100644 index d85b55954f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaObjectTypeConverter.java +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.ConversionValue; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; -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; - -public class EclipseLinkJavaObjectTypeConverter extends EclipseLinkJavaConverter - implements ObjectTypeConverter -{ - private String dataType; - - private String objectType; - - private String defaultObjectValue; - - private final List<EclipseLinkJavaConversionValue> conversionValues; - - - public EclipseLinkJavaObjectTypeConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent, jrpm); - this.conversionValues = new ArrayList<EclipseLinkJavaConversionValue>(); - } - - - public String getType() { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - - public String getAnnotationName() { - return ObjectTypeConverterAnnotation.ANNOTATION_NAME; - } - - protected ObjectTypeConverterAnnotation getAnnotation() { - return (ObjectTypeConverterAnnotation) 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<EclipseLinkJavaConversionValue> conversionValues() { - return new CloneListIterator<EclipseLinkJavaConversionValue>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public EclipseLinkJavaConversionValue addConversionValue(int index) { - EclipseLinkJavaConversionValue conversionValue = new EclipseLinkJavaConversionValue(this); - this.conversionValues.add(index, conversionValue); - ConversionValueAnnotation resourceConversionValue = getAnnotation().addConversionValue(index); - conversionValue.initialize(resourceConversionValue); - fireItemAdded(CONVERSION_VALUES_LIST, index, conversionValue); - return conversionValue; - } - - public EclipseLinkJavaConversionValue addConversionValue() { - return this.addConversionValue(this.conversionValues.size()); - } - - protected void addConversionValue(int index, EclipseLinkJavaConversionValue conversionValue) { - addItemToList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected void addConversionValue(EclipseLinkJavaConversionValue conversionValue) { - this.addConversionValue(this.conversionValues.size(), conversionValue); - } - - public void removeConversionValue(ConversionValue conversionValue) { - this.removeConversionValue(this.conversionValues.indexOf(conversionValue)); - } - - public void removeConversionValue(int index) { - EclipseLinkJavaConversionValue removedConversionValue = this.conversionValues.remove(index); - getAnnotation().removeConversionValue(index); - fireItemRemoved(CONVERSION_VALUES_LIST, index, removedConversionValue); - } - - protected void removeConversionValue_(EclipseLinkJavaConversionValue 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<EclipseLinkJavaConversionValue, String>(conversionValues()) { - @Override - protected String transform(EclipseLinkJavaConversionValue 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 *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - ObjectTypeConverterAnnotation resourceConverter = getAnnotation(); - this.dataType = this.dataType(resourceConverter); - this.objectType = this.objectType(resourceConverter); - this.defaultObjectValue = this.defaultObjectValue(resourceConverter); - this.initializeConversionValues(resourceConverter); - } - - protected void initializeConversionValues(ObjectTypeConverterAnnotation resourceConverter) { - if (resourceConverter == null) { - return; - } - ListIterator<ConversionValueAnnotation> resourceConversionValues = resourceConverter.conversionValues(); - - while(resourceConversionValues.hasNext()) { - this.conversionValues.add(buildConversionValue(resourceConversionValues.next())); - } - } - - protected EclipseLinkJavaConversionValue buildConversionValue(ConversionValueAnnotation resourceConversionValue) { - EclipseLinkJavaConversionValue conversionValue = new EclipseLinkJavaConversionValue(this); - conversionValue.initialize(resourceConversionValue); - return conversionValue; - } - - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - ObjectTypeConverterAnnotation resourceConverter = getAnnotation(); - this.setDataType_(this.dataType(resourceConverter)); - this.setObjectType_(this.objectType(resourceConverter)); - this.setDefaultObjectValue_(this.defaultObjectValue(resourceConverter)); - this.updateConversionValues(resourceConverter); - } - - protected void updateConversionValues(ObjectTypeConverterAnnotation resourceConverter) { - ListIterator<EclipseLinkJavaConversionValue> contextConversionValues = conversionValues(); - ListIterator<ConversionValueAnnotation> resourceConversionValues = resourceConverter.conversionValues(); - while (contextConversionValues.hasNext()) { - EclipseLinkJavaConversionValue conversionValues = contextConversionValues.next(); - if (resourceConversionValues.hasNext()) { - conversionValues.update(resourceConversionValues.next()); - } - else { - removeConversionValue_(conversionValues); - } - } - - while (resourceConversionValues.hasNext()) { - addConversionValue(buildConversionValue(resourceConversionValues.next())); - } - } - - protected String dataType(ObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDataType(); - } - - protected String objectType(ObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getObjectType(); - } - - protected String defaultObjectValue(ObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDefaultObjectValue(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - for (Iterator<EclipseLinkJavaConversionValue> stream = conversionValues(); stream.hasNext();) { - stream.next().validate(messages, astRoot); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingImpl.java deleted file mode 100644 index 7f368c17a7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.MappingKeys; -import org.eclipse.jpt.core.context.AttributeMapping; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaOneToManyMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaOneToManyMappingImpl extends GenericJavaOneToManyMapping implements EclipseLinkOneToManyMapping -{ - protected final EclipseLinkJavaJoinFetch joinFetch; - - protected final EclipseLinkJavaPrivateOwned privateOwned; - - - public EclipseLinkJavaOneToManyMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkJavaJoinFetch(this); - this.privateOwned = new EclipseLinkJavaPrivateOwned(this); - } - - // ********** NonOwningMapping implementation ********** - @Override - public boolean mappedByIsValid(AttributeMapping mappedByMapping) { - return super.mappedByIsValid(mappedByMapping) || (mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - } - - protected String getPrivateOwnedAnnotationName() { - return PrivateOwnedAnnotation.ANNOTATION_NAME; - } - - protected PrivateOwnedAnnotation getResourcePrivateOwned() { - return (PrivateOwnedAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void addResourcePrivateOwned() { - this.resourcePersistentAttribute.addSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void removeResourcePrivateOwned() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - public PrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.joinFetch.initialize(jrpa); - this.privateOwned.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.joinFetch.update(jrpa); - this.privateOwned.update(jrpa); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.joinFetch.validate(messages, astRoot); - this.privateOwned.validate(messages, 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/EclipseLinkJavaOneToManyMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingProvider.java deleted file mode 100644 index 9f03ae01bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.DefaultJavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.JavaOneToManyMappingProvider; - -public class EclipseLinkJavaOneToManyMappingProvider - implements DefaultJavaAttributeMappingProvider -{ - - // singleton - private static final EclipseLinkJavaOneToManyMappingProvider INSTANCE = new EclipseLinkJavaOneToManyMappingProvider(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkJavaOneToManyMappingProvider() { - super(); - } - - public String getKey() { - return JavaOneToManyMappingProvider.instance().getKey(); - } - - public String getAnnotationName() { - return JavaOneToManyMappingProvider.instance().getAnnotationName(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return JavaOneToManyMappingProvider.instance().buildMapping(parent, factory); - } - - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { - if (!persistentAttribute.getResourcePersistentAttribute().typeIsContainer()) { - return false; - } - String targetEntity = persistentAttribute.getResourcePersistentAttribute().getQualifiedReferenceEntityElementTypeName(); - if (targetEntity == null) { - return false; - } - return persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingImpl.java deleted file mode 100644 index 214d9229fd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaOneToOneMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaOneToOneMappingImpl extends GenericJavaOneToOneMapping implements EclipseLinkOneToOneMapping -{ - protected final EclipseLinkJavaJoinFetch joinFetch; - - protected final EclipseLinkJavaPrivateOwned privateOwned; - - - public EclipseLinkJavaOneToOneMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkJavaJoinFetch(this); - this.privateOwned = new EclipseLinkJavaPrivateOwned(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - public PrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.joinFetch.initialize(jrpa); - this.privateOwned.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.joinFetch.update(jrpa); - this.privateOwned.update(jrpa); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.joinFetch.validate(messages, astRoot); - this.privateOwned.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingProvider.java deleted file mode 100644 index 47c6915148..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.DefaultJavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.JavaOneToOneMappingProvider; - -public class EclipseLinkJavaOneToOneMappingProvider - implements DefaultJavaAttributeMappingProvider -{ - - // singleton - private static final EclipseLinkJavaOneToOneMappingProvider INSTANCE = new EclipseLinkJavaOneToOneMappingProvider(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkJavaOneToOneMappingProvider() { - super(); - } - - public String getKey() { - return JavaOneToOneMappingProvider.instance().getKey(); - } - - public String getAnnotationName() { - return JavaOneToOneMappingProvider.instance().getAnnotationName(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return JavaOneToOneMappingProvider.instance().buildMapping(parent, factory); - } - - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { - if (persistentAttribute.getResourcePersistentAttribute().typeIsContainer()) { - return false; - } - String targetEntity = persistentAttribute.getResourcePersistentAttribute().getQualifiedReferenceEntityTypeName(); - if (targetEntity == null) { - return false; - } - return persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaPrivateOwned.java deleted file mode 100644 index 98cf3ec2bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaPrivateOwned.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation; - -public class EclipseLinkJavaPrivateOwned extends AbstractJavaJpaContextNode implements PrivateOwned -{ - protected boolean privateOwned; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - public EclipseLinkJavaPrivateOwned(JavaAttributeMapping parent) { - super(parent); - } - - protected String getPrivateOwnedAnnotationName() { - return PrivateOwnedAnnotation.ANNOTATION_NAME; - } - - protected PrivateOwnedAnnotation getResourcePrivateOwned() { - return (PrivateOwnedAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void addResourcePrivateOwned() { - this.resourcePersistentAttribute.addSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void removeResourcePrivateOwned() { - this.resourcePersistentAttribute.removeSupportingAnnotation(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) { - PrivateOwnedAnnotation 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/EclipseLinkJavaReadOnly.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaReadOnly.java deleted file mode 100644 index f7caeddb82..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaReadOnly.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.ReadOnly; -import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation; - -public class EclipseLinkJavaReadOnly extends AbstractJavaJpaContextNode implements ReadOnly -{ - protected Boolean specifiedReadOnly; - - protected JavaResourcePersistentType resourcePersistentType; - - - public EclipseLinkJavaReadOnly(JavaTypeMapping parent) { - super(parent); - } - - - protected String getReadOnlyAnnotationName() { - return ReadOnlyAnnotation.ANNOTATION_NAME; - } - - protected ReadOnlyAnnotation getResourceReadOnly() { - return (ReadOnlyAnnotation) this.resourcePersistentType.getSupportingAnnotation(getReadOnlyAnnotationName()); - } - - protected void addResourceReadOnly() { - this.resourcePersistentType.addSupportingAnnotation(getReadOnlyAnnotationName()); - } - - protected void removeResourceReadOnly() { - this.resourcePersistentType.removeSupportingAnnotation(getReadOnlyAnnotationName()); - } - - public boolean isReadOnly() { - return (this.getSpecifiedReadOnly() != null) ? this.getSpecifiedReadOnly().booleanValue() : this.isDefaultReadOnly(); - } - - public boolean isDefaultReadOnly() { - return ReadOnly.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) { - ReadOnlyAnnotation 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/EclipseLinkJavaStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaStructConverter.java deleted file mode 100644 index ee59f71802..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaStructConverter.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.StructConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation; - -public class EclipseLinkJavaStructConverter extends EclipseLinkJavaConverter - implements StructConverter -{ - private String converterClass; - - - public EclipseLinkJavaStructConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent, jrpm); - } - - - public String getType() { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - public String getAnnotationName() { - return StructConverterAnnotation.ANNOTATION_NAME; - } - - protected StructConverterAnnotation getAnnotation() { - return (StructConverterAnnotation) 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 *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - this.converterClass = this.converterClass(getAnnotation()); - } - - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - this.setConverterClass_(this.converterClass(getAnnotation())); - } - - protected String converterClass(StructConverterAnnotation 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/EclipseLinkJavaTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaTypeConverter.java deleted file mode 100644 index 7c5f222705..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaTypeConverter.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation; - -public class EclipseLinkJavaTypeConverter extends EclipseLinkJavaConverter - implements TypeConverter -{ - private String dataType; - - private String objectType; - - - public EclipseLinkJavaTypeConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent, jrpm); - } - - public String getType() { - return EclipseLinkConverter.TYPE_CONVERTER; - } - - public String getAnnotationName() { - return TypeConverterAnnotation.ANNOTATION_NAME; - } - - protected TypeConverterAnnotation getAnnotation() { - return (TypeConverterAnnotation) 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 *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - TypeConverterAnnotation resourceConverter = getAnnotation(); - this.dataType = this.dataType(resourceConverter); - this.objectType = this.objectType(resourceConverter); - } - - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - TypeConverterAnnotation resourceConverter = getAnnotation(); - this.setDataType_(this.dataType(resourceConverter)); - this.setObjectType_(this.objectType(resourceConverter)); - } - - protected String dataType(TypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDataType(); - } - - protected String objectType(TypeConverterAnnotation 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/EclipseLinkJavaVersionMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingImpl.java deleted file mode 100644 index 0f5490e4f8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaVersionMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaVersionMappingImpl extends GenericJavaVersionMapping implements EclipseLinkVersionMapping -{ - protected final EclipseLinkJavaMutable mutable; - - public EclipseLinkJavaVersionMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkJavaMutable(this); - } - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkJavaConvert(this, this.resourcePersistentAttribute); - } - return null; - } - - @Override - protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) { - //check @Convert first, this is the order that EclipseLink searches - if (jrpa.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME) != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(jrpa); - } - - - - //************ EclipselinkVersionMapping implementation **************** - - public Mutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.mutable.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.mutable.update(jrpa); - } - - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.mutable.validate(messages, astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMapping.java deleted file mode 100644 index 6f193da06b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMapping.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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 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.BasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation; -import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; - -public class JavaBasicCollectionMapping extends AbstractJavaAttributeMapping<BasicCollectionAnnotation> implements BasicCollectionMapping -{ - - public JavaBasicCollectionMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicCollectionAnnotation.ANNOTATION_NAME; - } - - public Iterator<String> correspondingAnnotationNames() { - return EmptyIterator.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMappingProvider.java deleted file mode 100644 index b2c084cc27..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMappingProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation; - -public class JavaBasicCollectionMappingProvider - implements JavaAttributeMappingProvider -{ - - // singleton - private static final JavaBasicCollectionMappingProvider INSTANCE = new JavaBasicCollectionMappingProvider(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaBasicCollectionMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicCollectionAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaBasicCollectionMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMapping.java deleted file mode 100644 index 0fda365086..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMapping.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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 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.BasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation; -import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; - -public class JavaBasicMapMapping extends AbstractJavaAttributeMapping<BasicMapAnnotation> implements BasicMapMapping -{ - - public JavaBasicMapMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicMapAnnotation.ANNOTATION_NAME; - } - - public Iterator<String> correspondingAnnotationNames() { - return EmptyIterator.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMappingProvider.java deleted file mode 100644 index 7c1eadad99..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMappingProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation; - -public class JavaBasicMapMappingProvider - implements JavaAttributeMappingProvider -{ - - // singleton - private static final JavaBasicMapMappingProvider INSTANCE = new JavaBasicMapMappingProvider(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaBasicMapMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicMapAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaBasicMapMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMapping.java deleted file mode 100644 index 8e5d78fcd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMapping.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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 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.TransformationMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation; -import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; - -public class JavaTransformationMapping extends AbstractJavaAttributeMapping<TransformationAnnotation> implements TransformationMapping -{ - - public JavaTransformationMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return TransformationAnnotation.ANNOTATION_NAME; - } - - public Iterator<String> correspondingAnnotationNames() { - return EmptyIterator.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMappingProvider.java deleted file mode 100644 index ea3f9ee390..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMappingProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation; - -public class JavaTransformationMappingProvider - implements JavaAttributeMappingProvider -{ - - // singleton - private static final JavaTransformationMappingProvider INSTANCE = new JavaTransformationMappingProvider(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaTransformationMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return TransformationAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaTransformationMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/ConverterHolder.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/ConverterHolder.java deleted file mode 100644 index b814c8e125..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/ConverterHolder.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.ListIterator; -import org.eclipse.jpt.core.context.JpaContextNode; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; - -public interface ConverterHolder extends JpaContextNode -{ - //************ customConverters ********************* - - /** - * Return a list iterator of the custom converters. - * This will not be null. - */ - <T extends CustomConverter> ListIterator<T> customConverters(); - - /** - * Return the number of custom converters. - */ - int customConvertersSize(); - - /** - * Add a custom converter to the converter holder, return the object representing it. - */ - CustomConverter addCustomConverter(int index); - - /** - * Remove the custom converter at the index from the converter holder. - */ - void removeCustomConverter(int index); - - /** - * Remove the custom converter at from the converter holder. - */ - void removeCustomConverter(CustomConverter converter); - - /** - * Move the custom converter from the source index to the target index. - */ - void moveCustomConverter(int targetIndex, int sourceIndex); - - String CUSTOM_CONVERTERS_LIST = "customConvertersList"; //$NON-NLS-1$ - - - //************ object type converters ********************* - - /** - * Return a list iterator of the object type converters. - * This will not be null. - */ - <T extends ObjectTypeConverter> ListIterator<T> objectTypeConverters(); - - /** - * Return the number of object type converters. - */ - int objectTypeConvertersSize(); - - /** - * Add a object type converter to the converter holder, return the object representing it. - */ - ObjectTypeConverter addObjectTypeConverter(int index); - - /** - * Remove the object type converter at the index from the converter holder. - */ - void removeObjectTypeConverter(int index); - - /** - * Remove the object type converter at from the converter holder. - */ - void removeObjectTypeConverter(ObjectTypeConverter converter); - - /** - * Move the object type converter from the source index to the target index. - */ - void moveObjectTypeConverter(int targetIndex, int sourceIndex); - - String OBJECT_TYPE_CONVERTERS_LIST = "objectTypeConvertersList"; //$NON-NLS-1$ - - - //************ struct converters ********************* - - /** - * Return a list iterator of the struct converters. - * This will not be null. - */ - <T extends StructConverter> ListIterator<T> structConverters(); - - /** - * Return the number of struct converters. - */ - int structConvertersSize(); - - /** - * Add a struct converter to the converter holder, return the object representing it. - */ - StructConverter addStructConverter(int index); - - /** - * Remove the struct converter at the index from the converter holder. - */ - void removeStructConverter(int index); - - /** - * Remove the struct converter at from the converter holder. - */ - void removeStructConverter(StructConverter converter); - - /** - * Move the struct converter from the source index to the target index. - */ - void moveStructConverter(int targetIndex, int sourceIndex); - - String STRUCT_CONVERTERS_LIST = "structConvertersList"; //$NON-NLS-1$ - - - //************ type converters ********************* - - /** - * Return a list iterator of the type converters. - * This will not be null. - */ - <T extends TypeConverter> ListIterator<T> typeConverters(); - - /** - * Return the number of type converters. - */ - int typeConvertersSize(); - - /** - * Add a type converter to the converter holder, return the object representing it. - */ - TypeConverter addTypeConverter(int index); - - /** - * Remove the type converter at the index from the converter holder. - */ - void removeTypeConverter(int index); - - /** - * Remove the type converter at from the converter holder. - */ - void removeTypeConverter(TypeConverter converter); - - /** - * Move the type converter from the source index to the target index. - */ - void moveTypeConverter(int targetIndex, int sourceIndex); - - String TYPE_CONVERTERS_LIST = "typeConvertersList"; //$NON-NLS-1$ - -}
\ 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/EclipseLinkEntityMappings.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappings.java deleted file mode 100644 index bbec02a44a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappings.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.EntityMappings; - -public interface EclipseLinkEntityMappings - extends EntityMappings -{ - - ConverterHolder getConverterHolder(); - -} 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 90cb72e86f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.OrmStructureNodes; -import org.eclipse.jpt.core.internal.context.orm.GenericEntityMappings; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkEntityMappingsImpl - extends GenericEntityMappings - implements EclipseLinkEntityMappings -{ - - protected final EclipseLinkOrmConverterHolder converterHolder; - - public EclipseLinkEntityMappingsImpl(EclipseLinkOrmXml parent, XmlEntityMappings xmlEntityMappings) { - super(parent, xmlEntityMappings); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); - this.converterHolder.initialize(xmlEntityMappings); - } - - - // **************** JpaNode impl ******************************************* - - @Override - public EclipseLinkOrmXml getParent() { - return (EclipseLinkOrmXml) super.getParent(); - } - - // **************** JpaStructureNode impl ********************************** - - @Override - public String getId() { - return OrmStructureNodes.ENTITY_MAPPINGS_ID; - } - - - // **************** EclipseLinkEntityMappings impl ********************************** - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - @Override - public void update() { - super.update(); - this.converterHolder.update((XmlEntityMappings) this.xmlEntityMappings); - } - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - this.converterHolder.validate(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMapping.java deleted file mode 100644 index 82bf185cbe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMapping.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.GenericOrmBasicMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmBasicMapping extends GenericOrmBasicMapping - implements EclipseLinkBasicMapping -{ - protected EclipseLinkOrmMutable mutable; - - - public EclipseLinkOrmBasicMapping(OrmPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkOrmMutable(this); - } - - - public Mutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkOrmConvert(this, (XmlBasic) this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String specifiedConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlBasic) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(); - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlBasic addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlBasic basic = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicImpl(); - getPersistentAttribute().initialize(basic); - typeMapping.getAttributes().getBasics().add(basic); - return basic; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.mutable.initialize((XmlMutable) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCaching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCaching.java deleted file mode 100644 index 2ddb5884c6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCaching.java +++ /dev/null @@ -1,652 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.context.CacheType; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExistenceType; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -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 EclipseLinkOrmCaching extends AbstractXmlContextNode - implements Caching -{ - protected XmlCacheHolder resource; - - protected int defaultSize; - protected Integer specifiedSize; - - protected boolean defaultShared; - protected Boolean specifiedShared; - - protected CacheType defaultType; - protected CacheType specifiedType; - - protected boolean defaultAlwaysRefresh; - protected Boolean specifiedAlwaysRefresh; - - protected boolean defaultRefreshOnlyIfNewer; - protected Boolean specifiedRefreshOnlyIfNewer; - - protected boolean defaultDisableHits; - protected Boolean specifiedDisableHits; - - protected CacheCoordinationType defaultCoordinationType; - protected CacheCoordinationType specifiedCoordinationType; - - protected ExistenceType specifiedExistenceType; - protected ExistenceType defaultExistenceType; - - protected Integer expiry; - protected EclipseLinkOrmExpiryTimeOfDay expiryTimeOfDay; - - public EclipseLinkOrmCaching(OrmTypeMapping parent) { - super(parent); - } - - 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().isAllFeaturesUnset()) { - 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().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedShared != null) { - addResourceCache(); - getResourceCache().setShared(newSpecifiedShared); - } - } - firePropertyChanged(SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - } - - 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().isAllFeaturesUnset()) { - 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().isAllFeaturesUnset()) { - 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().isAllFeaturesUnset()) { - 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 CacheType getType() { - return (this.specifiedType == null) ? this.defaultType : this.specifiedType; - } - - public CacheType getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType(CacheType newDefaultType) { - CacheType oldDefaultType= this.defaultType; - this.defaultType = newDefaultType; - firePropertyChanged(DEFAULT_TYPE_PROPERTY, oldDefaultType, newDefaultType); - } - - public CacheType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(CacheType newSpecifiedType) { - CacheType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - if (oldSpecifiedType != newSpecifiedType) { - if (this.getResourceCache() != null) { - this.getResourceCache().setType(CacheType.toOrmResourceModel(newSpecifiedType)); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedType != null) { - addResourceCache(); - getResourceCache().setType(CacheType.toOrmResourceModel(newSpecifiedType)); - } - } - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - protected void setSpecifiedType_(CacheType newSpecifiedType) { - CacheType oldSpecifiedType= this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - - public CacheCoordinationType getCoordinationType() { - return (this.specifiedCoordinationType == null) ? this.defaultCoordinationType : this.specifiedCoordinationType; - } - - public CacheCoordinationType getDefaultCoordinationType() { - return this.defaultCoordinationType; - } - - protected void setDefaultCoordinationType(CacheCoordinationType newDefaultcCoordinationType) { - CacheCoordinationType oldDefaultcCoordinationType= this.defaultCoordinationType; - this.defaultCoordinationType = newDefaultcCoordinationType; - firePropertyChanged(DEFAULT_COORDINATION_TYPE_PROPERTY, oldDefaultcCoordinationType, newDefaultcCoordinationType); - } - - public CacheCoordinationType getSpecifiedCoordinationType() { - return this.specifiedCoordinationType; - } - - public void setSpecifiedCoordinationType(CacheCoordinationType newSpecifiedCoordinationType) { - CacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - if (oldSpecifiedCoordinationType != newSpecifiedCoordinationType) { - if (this.getResourceCache() != null) { - this.getResourceCache().setCoordinationType(CacheCoordinationType.toOrmResourceModel(newSpecifiedCoordinationType)); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedCoordinationType != null) { - addResourceCache(); - getResourceCache().setCoordinationType(CacheCoordinationType.toOrmResourceModel(newSpecifiedCoordinationType)); - } - } - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - protected void setSpecifiedCoordinationType_(CacheCoordinationType newSpecifiedCoordinationType) { - CacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - public ExistenceType getExistenceType() { - return (this.specifiedExistenceType == null) ? this.defaultExistenceType : this.specifiedExistenceType; - } - - public ExistenceType getDefaultExistenceType() { - return this.defaultExistenceType; - } - - protected void setDefaultExistenceType(ExistenceType newDefaultExistenceType) { - ExistenceType oldDefaultExistenceType = this.defaultExistenceType; - this.defaultExistenceType = newDefaultExistenceType; - firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, oldDefaultExistenceType, newDefaultExistenceType); - } - - public ExistenceType getSpecifiedExistenceType() { - return this.specifiedExistenceType; - } - - public void setSpecifiedExistenceType(ExistenceType newSpecifiedExistenceType) { - ExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - this.resource.setExistenceChecking(ExistenceType.toOrmResourceModel(newSpecifiedExistenceType)); - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - protected void setSpecifiedExistenceType_(ExistenceType newSpecifiedExistenceType) { - ExistenceType 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().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newExpiry != null) { - addResourceCache(); - this.getResourceCache().setExpiry(newExpiry); - } - } - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - } - - protected void setExpiry_(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - } - - public ExpiryTimeOfDay getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public ExpiryTimeOfDay addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("expiryTimeOfDay already exists, use getExpiryTimeOfDay()"); //$NON-NLS-1$ - } - if (getResourceCache() == null) { - addResourceCache(); - } - EclipseLinkOrmExpiryTimeOfDay newExpiryTimeOfDay = new EclipseLinkOrmExpiryTimeOfDay(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$ - } - ExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = null; - getResourceCache().setExpiryTimeOfDay(null); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, null); - } - - protected void setExpiryTimeOfDay(EclipseLinkOrmExpiryTimeOfDay newExpiryTimeOfDay) { - EclipseLinkOrmExpiryTimeOfDay 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); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlCacheHolder resource, JavaCaching javaCaching) { - this.resource = resource; - XmlCache resourceCache = getResourceCache(); - this.defaultSize = this.defaultSize(javaCaching); - this.specifiedSize = specifiedSize(resourceCache); - this.defaultShared = this.defaultShared(javaCaching); - this.specifiedShared = this.specifiedShared(resourceCache); - this.defaultAlwaysRefresh = this.defaultAlwaysRefresh(javaCaching); - this.specifiedAlwaysRefresh = this.specifiedAlwaysRefresh(resourceCache); - this.defaultRefreshOnlyIfNewer = this.defaultRefreshOnlyIfNewer(javaCaching); - this.specifiedRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer(resourceCache); - this.defaultDisableHits = this.defaultDisableHits(javaCaching); - this.specifiedDisableHits = this.specifiedDisableHits(resourceCache); - this.defaultType = this.defaultType(javaCaching); - this.specifiedType = this.specifiedType(resourceCache); - this.defaultCoordinationType = this.defaultCoordinationType(javaCaching); - this.specifiedCoordinationType = this.specifiedCoordinationType(resourceCache); - this.defaultExistenceType = this.defaultExistenceType(javaCaching); - this.specifiedExistenceType = this.specifiedExistenceType(resource); - this.initializeExpiry(resourceCache); - } - - 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 EclipseLinkOrmExpiryTimeOfDay(this); - this.expiryTimeOfDay.initialize(resourceCache.getExpiryTimeOfDay()); - } - } - } - - protected void update(XmlCacheHolder resource, JavaCaching javaCaching) { - this.resource = resource; - XmlCache resourceCache = getResourceCache(); - setDefaultSize(this.defaultSize(javaCaching)); - setSpecifiedSize_(this.specifiedSize(resourceCache)); - setDefaultShared(this.defaultShared(javaCaching)); - setSpecifiedShared_(this.specifiedShared(resourceCache)); - setDefaultAlwaysRefresh(this.defaultAlwaysRefresh(javaCaching)); - setSpecifiedAlwaysRefresh_(this.specifiedAlwaysRefresh(resourceCache)); - setDefaultRefreshOnlyIfNewer(this.defaultRefreshOnlyIfNewer(javaCaching)); - setSpecifiedRefreshOnlyIfNewer_(this.specifiedRefreshOnlyIfNewer(resourceCache)); - setDefaultDisableHits(this.defaultDisableHits(javaCaching)); - setSpecifiedDisableHits_(this.specifiedDisableHits(resourceCache)); - setDefaultType(this.defaultType(javaCaching)); - setSpecifiedType_(this.specifiedType(resourceCache)); - setDefaultCoordinationType(this.defaultCoordinationType(javaCaching)); - setSpecifiedCoordinationType_(this.specifiedCoordinationType(resourceCache)); - setDefaultExistenceType(this.defaultExistenceType(javaCaching)); - setSpecifiedExistenceType_(this.specifiedExistenceType(resource)); - this.updateExpiry(resourceCache); - } - - 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 EclipseLinkOrmExpiryTimeOfDay(this)); - this.expiryTimeOfDay.initialize(resourceCache.getExpiryTimeOfDay()); - } - else { //handle with validation if both expiry and expiryTimeOfDay are set - setExpiryTimeOfDay(null); - } - } - } - - protected int defaultSize(JavaCaching javaCaching) { - return (javaCaching == null) ? DEFAULT_SIZE : javaCaching.getSize(); - } - - protected Integer specifiedSize(XmlCache resource) { - return (resource == null) ? null : resource.getSize(); - } - - protected boolean defaultShared(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_SHARED; - } - return getResourceCache() == null ? javaCaching.isShared() : DEFAULT_SHARED; - } - - protected Boolean specifiedShared(XmlCache resource) { - return (resource == null) ? null : resource.getShared(); - } - - protected boolean defaultAlwaysRefresh(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_ALWAYS_REFRESH; - } - return getResourceCache() == null ? javaCaching.isAlwaysRefresh() : DEFAULT_ALWAYS_REFRESH; - } - - protected Boolean specifiedAlwaysRefresh(XmlCache resource) { - return (resource == null) ? null : resource.getAlwaysRefresh(); - } - - protected boolean defaultRefreshOnlyIfNewer(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_REFRESH_ONLY_IF_NEWER; - } - return getResourceCache() == null ? javaCaching.isRefreshOnlyIfNewer() : DEFAULT_REFRESH_ONLY_IF_NEWER; - } - - protected Boolean specifiedRefreshOnlyIfNewer(XmlCache resource) { - return (resource == null) ? null : resource.getRefreshOnlyIfNewer(); - } - - protected boolean defaultDisableHits(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_DISABLE_HITS; - } - return getResourceCache() == null ? javaCaching.isDisableHits() : DEFAULT_DISABLE_HITS; - } - - protected Boolean specifiedDisableHits(XmlCache resource) { - return (resource == null) ? null : resource.getDisableHits(); - } - - protected CacheType defaultType(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_TYPE; - } - return getResourceCache() == null ? javaCaching.getType() : DEFAULT_TYPE; - } - - protected CacheType specifiedType(XmlCache resource) { - return (resource == null) ? null : CacheType.fromOrmResourceModel(resource.getType()); - } - - protected CacheCoordinationType defaultCoordinationType(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_COORDINATION_TYPE; - } - return getResourceCache() == null ? javaCaching.getCoordinationType() : DEFAULT_COORDINATION_TYPE; - } - - protected CacheCoordinationType specifiedCoordinationType(XmlCache resource) { - return (resource == null) ? null : CacheCoordinationType.fromOrmResourceModel(resource.getCoordinationType()); - } - - protected ExistenceType defaultExistenceType(JavaCaching javaCaching) { - return (javaCaching == null) ? DEFAULT_EXISTENCE_TYPE : javaCaching.getExistenceType(); - } - - protected ExistenceType specifiedExistenceType(XmlCacheHolder resource) { - return (resource == null) ? null : ExistenceType.fromOrmResourceModel(resource.getExistenceChecking()); - } - - protected Integer expiry(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/EclipseLinkOrmChangeTracking.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmChangeTracking.java deleted file mode 100644 index fe7d564d88..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmChangeTracking.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType; -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 EclipseLinkOrmChangeTracking extends AbstractXmlContextNode - implements ChangeTracking -{ - protected XmlChangeTrackingHolder resource; - - protected ChangeTrackingType defaultType; - - protected ChangeTrackingType specifiedType; - - - public EclipseLinkOrmChangeTracking(OrmTypeMapping parent) { - super(parent); - } - - - public ChangeTrackingType getType() { - return (getSpecifiedType() != null) ? getSpecifiedType() : getDefaultType(); - } - - public ChangeTrackingType getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType_(ChangeTrackingType newDefaultType) { - ChangeTrackingType oldDefaultType = this.defaultType; - this.defaultType = newDefaultType; - firePropertyChanged(DEFAULT_TYPE_PROPERTY, oldDefaultType, newDefaultType); - } - - public ChangeTrackingType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(ChangeTrackingType newSpecifiedType) { - ChangeTrackingType 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(ChangeTrackingType.toOrmResourceModel(newSpecifiedType)); - } - - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - protected void setSpecifiedType_(ChangeTrackingType newSpecifiedType) { - ChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlChangeTrackingHolder xmlChangeTrackingHolder, ChangeTracking javaChangeTracking) { - this.resource = xmlChangeTrackingHolder; - this.defaultType = calculateDefaultType(javaChangeTracking); - this.specifiedType = calculateSpecifiedType(xmlChangeTrackingHolder); - } - - protected void update(XmlChangeTrackingHolder xmlChangeTrackingHolder, ChangeTracking javaChangeTracking) { - setDefaultType_(calculateDefaultType(javaChangeTracking)); - setSpecifiedType_(calculateSpecifiedType(xmlChangeTrackingHolder)); - } - - protected ChangeTrackingType calculateDefaultType(ChangeTracking javaChangeTracking) { - return (javaChangeTracking != null) ? javaChangeTracking.getType() : ChangeTracking.DEFAULT_TYPE; - } - - protected ChangeTrackingType calculateSpecifiedType(XmlChangeTrackingHolder xmlChangeTrackingHolder) { - XmlChangeTracking xmlChangeTracking = xmlChangeTrackingHolder.getChangeTracking(); - return (xmlChangeTracking != null) ? ChangeTrackingType.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/EclipseLinkOrmConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java deleted file mode 100644 index d12cc740d9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -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; - -public class EclipseLinkOrmConversionValue extends AbstractXmlContextNode implements ConversionValue -{ - private XmlConversionValue resourceConversionValue; - - private String dataValue; - - private String objectValue; - - public EclipseLinkOrmConversionValue(EclipseLinkOrmObjectTypeConverter parent) { - super(parent); - } - - @Override - public EclipseLinkOrmObjectTypeConverter getParent() { - return (EclipseLinkOrmObjectTypeConverter) 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.dataValue(); - this.objectValue = this.objectValue(); - } - - public void update(XmlConversionValue 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() { - return this.resourceConversionValue.getDataValueTextRange(); - } - - public TextRange getObjectValueTextRange() { - return this.resourceConversionValue.getObjectValueTextRange(); - } - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - 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/EclipseLinkOrmConvert.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java deleted file mode 100644 index adce47c718..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.resource.common.JpaEObject; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -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; - -public class EclipseLinkOrmConvert extends AbstractXmlContextNode implements Convert, OrmConverter -{ - protected String specifiedConverterName; - - protected XmlConvertibleMapping resourceMapping; - - protected EclipseLinkOrmConverter converter; - - public EclipseLinkOrmConvert(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) { - super(parent); - this.initialize(resourceMapping); - } - - @Override - public OrmAttributeMapping getParent() { - return (OrmAttributeMapping) super.getParent(); - } - - public String getType() { - return Convert.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 EclipseLinkOrmConverter 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; - } - EclipseLinkOrmConverter 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); - EclipseLinkOrmConverter 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.createXmlConverterImpl(); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverterImpl(); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverterImpl(); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverterImpl(); - } - 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 EclipseLinkOrmConverter buildConverter(String converterType, JpaEObject resourceConverter) { - if (converterType == EclipseLinkConverter.NO_CONVERTER) { - return null; - } - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkOrmCustomConverter(this, (XmlConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkOrmTypeConverter(this, (XmlTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkOrmObjectTypeConverter(this, (XmlObjectTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkOrmStructConverter(this, (XmlStructConverter) resourceConverter); - } - return null; - } - - protected void setConverter(EclipseLinkOrmConverter newConverter) { - EclipseLinkOrmConverter oldConverter = this.converter; - this.converter = newConverter; - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void initialize(XmlConvertibleMapping resourceMapping) { - this.resourceMapping = resourceMapping; - this.specifiedConverterName = this.specifiedConverterName(); - this.converter = this.buildConverter(); - } - - public void update() { - this.setSpecifiedConverterName_(this.specifiedConverterName()); - if (converterType() == getConverterType()) { - this.converter.update(); - } - else { - setConverter(buildConverter()); - } - } - - protected String specifiedConverterName() { - return this.resourceMapping == null ? null : this.resourceMapping.getConvert(); - } - - protected String converterType() { - 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 EclipseLinkOrmConverter buildConverter() { - if (this.resourceMapping.getConverter() != null) { - return new EclipseLinkOrmCustomConverter(this, this.resourceMapping.getConverter()); - } - else if (this.resourceMapping.getTypeConverter() != null) { - return new EclipseLinkOrmTypeConverter(this, this.resourceMapping.getTypeConverter()); - } - else if (this.resourceMapping.getObjectTypeConverter() != null) { - return new EclipseLinkOrmObjectTypeConverter(this, this.resourceMapping.getObjectTypeConverter()); - } - else if (this.resourceMapping.getStructConverter() != null) { - return new EclipseLinkOrmStructConverter(this, this.resourceMapping.getStructConverter()); - } - - return null; - } - - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - if (getConverter() != null) { - getConverter().validate(messages); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java deleted file mode 100644 index 1405c7fe75..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaConverter; -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 EclipseLinkOrmConverter - extends AbstractXmlContextNode implements EclipseLinkConverter -{ - private XmlNamedConverter xmlResource; - - private String name; - - - public EclipseLinkOrmConverter(XmlContextNode parent, XmlNamedConverter xmlResource) { - super(parent); - initialize(xmlResource); - } - - - protected XmlNamedConverter getXmlResource() { - return this.xmlResource; - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - // **************** name *************************************************** - - public String getName() { - return this.name; - } - - public void setName(String newName) { - String oldName = this.name; - this.name = newName; - getXmlResource().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(XmlNamedConverter resource) { - this.xmlResource = resource; - this.name = calculateName(); - getPersistenceUnit().addConverter(this); - } - - public void update() { - this.setName_(calculateName()); - getPersistenceUnit().addConverter(this); - } - - protected String calculateName() { - return getXmlResource().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 EclipseLinkJavaConverter; - } - - 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 getXmlResource().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/EclipseLinkOrmConverterHolder.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterHolder.java deleted file mode 100644 index 4fd428e2b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterHolder.java +++ /dev/null @@ -1,430 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -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.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmConverterHolder extends AbstractXmlContextNode implements ConverterHolder -{ - private XmlConvertersHolder resourceConvertersHolder; - - protected final List<EclipseLinkOrmCustomConverter> customConverters; - protected final List<EclipseLinkOrmObjectTypeConverter> objectTypeConverters; - protected final List<EclipseLinkOrmStructConverter> structConverters; - protected final List<EclipseLinkOrmTypeConverter> typeConverters; - - public EclipseLinkOrmConverterHolder(XmlContextNode parent) { - super(parent); - this.customConverters = new ArrayList<EclipseLinkOrmCustomConverter>(); - this.objectTypeConverters = new ArrayList<EclipseLinkOrmObjectTypeConverter>(); - this.structConverters = new ArrayList<EclipseLinkOrmStructConverter>(); - this.typeConverters = new ArrayList<EclipseLinkOrmTypeConverter>(); - } - - public ListIterator<EclipseLinkOrmCustomConverter> customConverters() { - return this.customConverters.listIterator(); - } - - public int customConvertersSize() { - return this.customConverters.size(); - } - - public CustomConverter addCustomConverter(int index) { - XmlConverter resourceConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlConverterImpl(); - EclipseLinkOrmCustomConverter contextConverter = new EclipseLinkOrmCustomConverter(this, 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, EclipseLinkOrmCustomConverter converter) { - addItemToList(index, converter, this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - protected void addCustomConverter(EclipseLinkOrmCustomConverter converter) { - this.addCustomConverter(this.customConverters.size(), converter); - } - - public void removeCustomConverter(int index) { - EclipseLinkOrmCustomConverter removedConverter = this.customConverters.remove(index); - this.resourceConvertersHolder.getConverters().remove(index); - fireItemRemoved(CUSTOM_CONVERTERS_LIST, index, removedConverter); - } - - public void removeCustomConverter(CustomConverter converter) { - this.removeCustomConverter(this.customConverters.indexOf(converter)); - } - - protected void removeConverter_(CustomConverter 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, EclipseLinkOrmCustomConverter converter) { - moveItemInList(index, this.customConverters.indexOf(converter), this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - public ListIterator<EclipseLinkOrmObjectTypeConverter> objectTypeConverters() { - return this.objectTypeConverters.listIterator(); - } - - public int objectTypeConvertersSize() { - return this.objectTypeConverters.size(); - } - - public ObjectTypeConverter addObjectTypeConverter(int index) { - XmlObjectTypeConverter resourceObjectTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverterImpl(); - EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter = new EclipseLinkOrmObjectTypeConverter(this, 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, EclipseLinkOrmObjectTypeConverter converter) { - addItemToList(index, converter, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - protected void addObjectTypeConverter(EclipseLinkOrmObjectTypeConverter converter) { - this.addObjectTypeConverter(this.objectTypeConverters.size(), converter); - } - - public void removeObjectTypeConverter(int index) { - EclipseLinkOrmObjectTypeConverter removedObjectTypeConverter = this.objectTypeConverters.remove(index); - this.resourceConvertersHolder.getObjectTypeConverters().remove(index); - fireItemRemoved(OBJECT_TYPE_CONVERTERS_LIST, index, removedObjectTypeConverter); - } - - public void removeObjectTypeConverter(ObjectTypeConverter converter) { - this.removeObjectTypeConverter(this.objectTypeConverters.indexOf(converter)); - } - - protected void removeObjectTypeConverter_(ObjectTypeConverter 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, EclipseLinkOrmObjectTypeConverter converter) { - moveItemInList(index, this.objectTypeConverters.indexOf(converter), this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - public ListIterator<EclipseLinkOrmStructConverter> structConverters() { - return this.structConverters.listIterator(); - } - - public int structConvertersSize() { - return this.structConverters.size(); - } - - public StructConverter addStructConverter(int index) { - XmlStructConverter resourceStructConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverterImpl(); - EclipseLinkOrmStructConverter contextStructConverter = new EclipseLinkOrmStructConverter(this, 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, EclipseLinkOrmStructConverter converter) { - addItemToList(index, converter, this.structConverters, STRUCT_CONVERTERS_LIST); - } - - protected void addStructConverter(EclipseLinkOrmStructConverter converter) { - this.addStructConverter(this.structConverters.size(), converter); - } - - public void removeStructConverter(int index) { - EclipseLinkOrmStructConverter removedStructConverter = this.structConverters.remove(index); - this.resourceConvertersHolder.getStructConverters().remove(index); - fireItemRemoved(STRUCT_CONVERTERS_LIST, index, removedStructConverter); - } - - public void removeStructConverter(StructConverter converter) { - this.removeStructConverter(this.structConverters.indexOf(converter)); - } - - protected void removeStructConverter_(StructConverter 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, EclipseLinkOrmStructConverter converter) { - moveItemInList(index, this.structConverters.indexOf(converter), this.structConverters, STRUCT_CONVERTERS_LIST); - } - - - public ListIterator<EclipseLinkOrmTypeConverter> typeConverters() { - return this.typeConverters.listIterator(); - } - - public int typeConvertersSize() { - return this.typeConverters.size(); - } - - public TypeConverter addTypeConverter(int index) { - XmlTypeConverter resourceTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverterImpl(); - EclipseLinkOrmTypeConverter contextTypeConverter = new EclipseLinkOrmTypeConverter(this, 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, EclipseLinkOrmTypeConverter converter) { - addItemToList(index, converter, this.typeConverters, TYPE_CONVERTERS_LIST); - } - - protected void addTypeConverter(EclipseLinkOrmTypeConverter converter) { - this.addTypeConverter(this.typeConverters.size(), converter); - } - - public void removeTypeConverter(int index) { - EclipseLinkOrmTypeConverter removedTypeConverter = this.typeConverters.remove(index); - this.resourceConvertersHolder.getTypeConverters().remove(index); - fireItemRemoved(TYPE_CONVERTERS_LIST, index, removedTypeConverter); - } - - public void removeTypeConverter(TypeConverter converter) { - this.removeTypeConverter(this.typeConverters.indexOf(converter)); - } - - protected void removeTypeConverter_(TypeConverter 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, EclipseLinkOrmTypeConverter converter) { - moveItemInList(index, this.typeConverters.indexOf(converter), this.typeConverters, TYPE_CONVERTERS_LIST); - } - - - - public void initialize(XmlConvertersHolder resourceConvertersHolder) { - this.resourceConvertersHolder = resourceConvertersHolder; - this.initializeCustomConverters(); - this.initializeObjectTypeConverters(); - this.initializeStructConverters(); - this.initializeTypeConverters(); - } - - protected void initializeCustomConverters() { - for (XmlConverter resourceConverter : this.resourceConvertersHolder.getConverters()) { - this.customConverters.add(new EclipseLinkOrmCustomConverter(this, resourceConverter)); - } - } - - protected void initializeObjectTypeConverters() { - for (XmlObjectTypeConverter resourceConverter : this.resourceConvertersHolder.getObjectTypeConverters()) { - this.objectTypeConverters.add(new EclipseLinkOrmObjectTypeConverter(this, resourceConverter)); - } - } - - protected void initializeStructConverters() { - for (XmlStructConverter resourceConverter : this.resourceConvertersHolder.getStructConverters()) { - this.structConverters.add(new EclipseLinkOrmStructConverter(this, resourceConverter)); - } - } - - protected void initializeTypeConverters() { - for (XmlTypeConverter resourceConverter : this.resourceConvertersHolder.getTypeConverters()) { - this.typeConverters.add(new EclipseLinkOrmTypeConverter(this, resourceConverter)); - } - } - - public void update(XmlConvertersHolder resourceConvertersHolder) { - this.resourceConvertersHolder = resourceConvertersHolder; - this.updateCustomConverters(); - this.updateObjectTypeConverters(); - this.updateStructConverters(); - this.updateTypeConverters(); - } - - protected void updateCustomConverters() { - Collection<EclipseLinkOrmCustomConverter> contextConvertersToRemove = CollectionTools.collection(customConverters()); - Collection<EclipseLinkOrmCustomConverter> contextConvertersToUpdate = new ArrayList<EclipseLinkOrmCustomConverter>(); - ListIterator<XmlConverter> resourceConverters = new CloneListIterator<XmlConverter>(this.resourceConvertersHolder.getConverters());//prevent ConcurrentModificiationException - int resourceIndex = 0; - - for (XmlConverter resourceConverter : CollectionTools.iterable(resourceConverters)) { - boolean contextConverterFound = false; - for (EclipseLinkOrmCustomConverter contextConverter : contextConvertersToRemove) { - if (contextConverter.getXmlResource() == resourceConverter) { - moveCustomConverter_(resourceIndex, contextConverter); - contextConvertersToRemove.remove(contextConverter); - contextConvertersToUpdate.add(contextConverter); - contextConverterFound = true; - break; - } - } - if (!contextConverterFound) { - addCustomConverter(new EclipseLinkOrmCustomConverter(this, resourceConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmCustomConverter 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 (EclipseLinkOrmCustomConverter contextConverter : contextConvertersToUpdate) { - contextConverter.update(); - } - } - - protected void updateObjectTypeConverters() { - Collection<EclipseLinkOrmObjectTypeConverter> contextObjectTypeConvertersToRemove = CollectionTools.collection(objectTypeConverters()); - Collection<EclipseLinkOrmObjectTypeConverter> contextObjectTypeConvertersToUpdate = new ArrayList<EclipseLinkOrmObjectTypeConverter>(); - ListIterator<XmlObjectTypeConverter> resourceObjectTypeConverters = new CloneListIterator<XmlObjectTypeConverter>(this.resourceConvertersHolder.getObjectTypeConverters());//prevent ConcurrentModificiationException - int resourceIndex = 0; - - for (XmlObjectTypeConverter resourceObjectTypeConverter : CollectionTools.iterable(resourceObjectTypeConverters)) { - boolean contextObjectTypeConverterFound = false; - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextObjectTypeConvertersToRemove) { - if (contextObjectTypeConverter.getXmlResource() == resourceObjectTypeConverter) { - moveObjectTypeConverter_(resourceIndex, contextObjectTypeConverter); - contextObjectTypeConvertersToRemove.remove(contextObjectTypeConverter); - contextObjectTypeConvertersToUpdate.add(contextObjectTypeConverter); - contextObjectTypeConverterFound = true; - break; - } - } - if (!contextObjectTypeConverterFound) { - addObjectTypeConverter(new EclipseLinkOrmObjectTypeConverter(this, resourceObjectTypeConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextObjectTypeConvertersToRemove) { - removeObjectTypeConverter_(contextObjectTypeConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextObjectTypeConvertersToUpdate) { - contextObjectTypeConverter.update(); - } - } - - protected void updateTypeConverters() { - Collection<EclipseLinkOrmTypeConverter> contextTypeConvertersToRemove = CollectionTools.collection(typeConverters()); - Collection<EclipseLinkOrmTypeConverter> contextTypeConvertersToUpdate = new ArrayList<EclipseLinkOrmTypeConverter>(); - ListIterator<XmlTypeConverter> resourceTypeConverters = new CloneListIterator<XmlTypeConverter>(this.resourceConvertersHolder.getTypeConverters());//prevent ConcurrentModificiationException - int resourceIndex = 0; - - for (XmlTypeConverter resourceTypeConverter : CollectionTools.iterable(resourceTypeConverters)) { - boolean contextTypeConverterFound = false; - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextTypeConvertersToRemove) { - if (contextTypeConverter.getXmlResource() == resourceTypeConverter) { - moveTypeConverter_(resourceIndex, contextTypeConverter); - contextTypeConvertersToRemove.remove(contextTypeConverter); - contextTypeConvertersToUpdate.add(contextTypeConverter); - contextTypeConverterFound = true; - break; - } - } - if (!contextTypeConverterFound) { - addTypeConverter(new EclipseLinkOrmTypeConverter(this, resourceTypeConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextTypeConvertersToRemove) { - removeTypeConverter_(contextTypeConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextTypeConvertersToUpdate) { - contextTypeConverter.update(); - } - } - - protected void updateStructConverters() { - Collection<EclipseLinkOrmStructConverter> contextStructConvertersToRemove = CollectionTools.collection(structConverters()); - Collection<EclipseLinkOrmStructConverter> contextStructConvertersToUpdate = new ArrayList<EclipseLinkOrmStructConverter>(); - ListIterator<XmlStructConverter> resourceStructConverters = new CloneListIterator<XmlStructConverter>(this.resourceConvertersHolder.getStructConverters());//prevent ConcurrentModificiationException - int resourceIndex = 0; - - for (XmlStructConverter resourceStructConverter : CollectionTools.iterable(resourceStructConverters)) { - boolean contextStructConverterFound = false; - for (EclipseLinkOrmStructConverter contextStructConverter : contextStructConvertersToRemove) { - if (contextStructConverter.getXmlResource() == resourceStructConverter) { - moveStructConverter_(resourceIndex, contextStructConverter); - contextStructConvertersToRemove.remove(contextStructConverter); - contextStructConvertersToUpdate.add(contextStructConverter); - contextStructConverterFound = true; - break; - } - } - if (!contextStructConverterFound) { - addStructConverter(new EclipseLinkOrmStructConverter(this, resourceStructConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmStructConverter contextStructConverter : contextStructConvertersToRemove) { - removeStructConverter_(contextStructConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmStructConverter contextStructConverter : contextStructConvertersToUpdate) { - contextStructConverter.update(); - } - } - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - } - - - 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/EclipseLinkOrmCustomConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomConverter.java deleted file mode 100644 index 6c63448ffc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomConverter.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.CustomConverter; -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; - -public class EclipseLinkOrmCustomConverter extends EclipseLinkOrmConverter - implements CustomConverter -{ - private String converterClass; - - - public EclipseLinkOrmCustomConverter(XmlContextNode parent, XmlConverter xmlResource) { - super(parent, xmlResource); - } - - - public String getType() { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - - @Override - protected XmlConverter getXmlResource() { - return (XmlConverter) super.getXmlResource(); - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getXmlResource().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 *********************************** - - protected void initialize(XmlConverter xmlResource) { - super.initialize(xmlResource); - this.converterClass = calculateConverterClass(); - } - - public void update() { - super.update(); - setConverterClass_(calculateConverterClass()); - } - - protected String calculateConverterClass() { - return getXmlResource().getClassName(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - 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/EclipseLinkOrmCustomizer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomizer.java deleted file mode 100644 index 24be842238..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomizer.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -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 EclipseLinkOrmCustomizer extends AbstractXmlContextNode - implements Customizer -{ - protected XmlCustomizerHolder resource; - - protected String specifiedCustomizerClass; - - protected String defaultCustomizerClass; - - public EclipseLinkOrmCustomizer(OrmTypeMapping parent) { - super(parent); - } - - 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().isAllFeaturesUnset()) { - 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); - } - - // **************** initialize/update ************************************** - - protected void initialize(XmlCustomizerHolder resource, Customizer javaCustomizer) { - this.resource = resource; - this.defaultCustomizerClass = (javaCustomizer == null) ? null : javaCustomizer.getCustomizerClass(); - this.specifiedCustomizerClass = specifiedCustomizerClass(getResourceCustomizer()); - } - - protected void update(XmlCustomizerHolder resource, Customizer javaCustomizer) { - this.resource = resource; - setDefaultCustomizerClass((javaCustomizer == null) ? null : javaCustomizer.getCustomizerClass()); - setSpecifiedCustomizerClass_(specifiedCustomizerClass(getResourceCustomizer())); - } - - protected String specifiedCustomizerClass(XmlCustomizer resource) { - 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/EclipseLinkOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddable.java deleted file mode 100644 index 22811ef27b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddable.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.OrmEmbeddable; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEmbeddable; - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface EclipseLinkOrmEmbeddable extends EclipseLinkEmbeddable, OrmEmbeddable -{ - ConverterHolder getConverterHolder(); -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddableImpl.java deleted file mode 100644 index c2d4b941c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddableImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.GenericOrmEmbeddable; -import org.eclipse.jpt.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEmbeddable; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -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.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmEmbeddableImpl extends GenericOrmEmbeddable - implements EclipseLinkOrmEmbeddable -{ - protected final EclipseLinkOrmCustomizer customizer; - - protected final EclipseLinkOrmChangeTracking changeTracking; - - protected final EclipseLinkOrmConverterHolder converterHolder; - - public EclipseLinkOrmEmbeddableImpl(OrmPersistentType parent) { - super(parent); - this.customizer = new EclipseLinkOrmCustomizer(this); - this.changeTracking = new EclipseLinkOrmChangeTracking(this); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - - - // **************** resource-context interaction *************************** - - @Override - public XmlEmbeddable addToResourceModel(XmlEntityMappings entityMappings) { - XmlEmbeddable embeddable = EclipseLinkOrmFactory.eINSTANCE.createXmlEmbeddable(); - getPersistentType().initialize(embeddable); - entityMappings.getEmbeddables().add(embeddable); - return embeddable; - } - - @Override - public void initialize(XmlEmbeddable embeddable) { - super.initialize(embeddable); - this.customizer.initialize((XmlCustomizerHolder) embeddable, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) embeddable, getJavaChangeTracking()); - this.converterHolder.initialize((XmlConvertersHolder) embeddable); - } - - @Override - public void update(XmlEmbeddable embeddable) { - super.update(embeddable); - this.customizer.update((XmlCustomizerHolder) embeddable, getJavaCustomizer()); - this.changeTracking.update((XmlChangeTrackingHolder) embeddable, getJavaChangeTracking()); - this.converterHolder.update((XmlConvertersHolder) embeddable); - } - - @Override - protected EclipseLinkJavaEmbeddable getJavaEmbeddableForDefaults() { - return (EclipseLinkJavaEmbeddable) super.getJavaEmbeddableForDefaults(); - } - - - protected Customizer getJavaCustomizer() { - EclipseLinkJavaEmbeddable javaEmbeddable = getJavaEmbeddableForDefaults(); - return (javaEmbeddable == null) ? null : javaEmbeddable.getCustomizer(); - } - - protected ChangeTracking getJavaChangeTracking() { - EclipseLinkJavaEmbeddable javaEmbeddable = getJavaEmbeddableForDefaults(); - return (javaEmbeddable == null) ? null : javaEmbeddable.getChangeTracking(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - this.customizer.validate(messages); - this.changeTracking.validate(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntity.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntity.java deleted file mode 100644 index 43fafde3e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntity.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.OrmEntity; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEntity; - -public interface EclipseLinkOrmEntity extends EclipseLinkEntity, OrmEntity -{ - ConverterHolder getConverterHolder(); -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntityImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntityImpl.java deleted file mode 100644 index eda9adc885..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntityImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.GenericOrmEntity; -import org.eclipse.jpt.core.resource.orm.XmlEntity; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -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.XmlReadOnly; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmEntityImpl extends GenericOrmEntity - implements EclipseLinkOrmEntity -{ - protected final EclipseLinkOrmReadOnly readOnly; - - protected final EclipseLinkOrmCustomizer customizer; - - protected final EclipseLinkOrmChangeTracking changeTracking; - - protected final EclipseLinkOrmCaching caching; - - protected final EclipseLinkOrmConverterHolder converterHolder; - - - public EclipseLinkOrmEntityImpl(OrmPersistentType parent) { - super(parent); - this.readOnly = new EclipseLinkOrmReadOnly(this); - this.customizer = new EclipseLinkOrmCustomizer(this); - this.changeTracking = new EclipseLinkOrmChangeTracking(this); - this.caching = new EclipseLinkOrmCaching(this); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); - } - - public Caching getCaching() { - return this.caching; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public EclipseLinkOrmReadOnly getReadOnly() { - return this.readOnly; - } - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - // **************** resource-context interaction *************************** - - @Override - public XmlEntity addToResourceModel(XmlEntityMappings entityMappings) { - XmlEntity entity = EclipseLinkOrmFactory.eINSTANCE.createXmlEntity(); - getPersistentType().initialize(entity); - entityMappings.getEntities().add(entity); - return entity; - } - - @Override - public void initialize(XmlEntity entity) { - super.initialize(entity); - this.readOnly.initialize((XmlReadOnly) entity, getJavaReadOnly()); - this.customizer.initialize((XmlCustomizerHolder) entity, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) entity, getJavaChangeTracking()); - this.caching.initialize((XmlCacheHolder) entity, getJavaCaching()); - this.converterHolder.initialize((XmlConvertersHolder) entity); - } - - @Override - public void update(XmlEntity entity) { - super.update(entity); - this.readOnly.update((XmlReadOnly) entity, getJavaReadOnly()); - this.customizer.update((XmlCustomizerHolder) entity, getJavaCustomizer()); - this.changeTracking.update((XmlChangeTrackingHolder) entity, getJavaChangeTracking()); - this.caching.update((XmlCacheHolder) entity, getJavaCaching()); - this.converterHolder.update((XmlConvertersHolder) entity); - } - - @Override - protected EclipseLinkJavaEntity getJavaEntityForDefaults() { - return (EclipseLinkJavaEntity) super.getJavaEntityForDefaults(); - } - - protected ReadOnly getJavaReadOnly() { - EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getReadOnly(); - } - - protected Customizer getJavaCustomizer() { - EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getCustomizer(); - } - - protected ChangeTracking getJavaChangeTracking() { - EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getChangeTracking(); - } - - protected JavaCaching getJavaCaching() { - EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getCaching(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - this.readOnly.validate(messages); - this.customizer.validate(messages); - this.changeTracking.validate(messages); - this.caching.validate(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmExpiryTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmExpiryTimeOfDay.java deleted file mode 100644 index 3a48bf9122..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmExpiryTimeOfDay.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTimeOfDay; - -public class EclipseLinkOrmExpiryTimeOfDay extends AbstractXmlContextNode - implements ExpiryTimeOfDay -{ - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - protected XmlTimeOfDay resourceTimeOfDay; - - public EclipseLinkOrmExpiryTimeOfDay(Caching 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 = hour(); - this.minute = minute(); - this.second = second(); - this.millisecond = millisecond(); - } - - public void update(XmlTimeOfDay resource) { - this.resourceTimeOfDay = resource; - this.setHour_(hour()); - this.setMinute_(minute()); - this.setSecond_(second()); - this.setMillisecond_(millisecond()); - } - - protected Integer hour() { - return this.resourceTimeOfDay.getHour(); - } - - protected Integer minute() { - return this.resourceTimeOfDay.getMinute(); - } - - protected Integer second() { - return this.resourceTimeOfDay.getSecond(); - } - - protected Integer millisecond() { - return this.resourceTimeOfDay.getMillisecond(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMapping.java deleted file mode 100644 index 54d4aae114..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMapping.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.GenericOrmIdMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmIdMapping extends GenericOrmIdMapping - implements EclipseLinkIdMapping -{ - protected EclipseLinkOrmMutable mutable; - - - public EclipseLinkOrmIdMapping(OrmPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkOrmMutable(this); - } - - - public Mutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkOrmConvert(this, (XmlId) this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String specifiedConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlId) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(); - } - - // **************** resource-context interaction *************************** - - @Override - public XmlId addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlId id = EclipseLinkOrmFactory.eINSTANCE.createXmlIdImpl(); - getPersistentAttribute().initialize(id); - typeMapping.getAttributes().getIds().add(id); - return id; - } - - @Override - public void initialize(XmlAttributeMapping xmlAttributeMapping) { - super.initialize(xmlAttributeMapping); - this.mutable.initialize((XmlMutable) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmJoinFetch.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmJoinFetch.java deleted file mode 100644 index 59c4b1eca0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmJoinFetch.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; - -public class EclipseLinkOrmJoinFetch extends AbstractXmlContextNode - implements JoinFetch -{ - protected XmlJoinFetch resource; - - protected JoinFetchType joinFetchValue; - - - public EclipseLinkOrmJoinFetch(OrmAttributeMapping parent) { - super(parent); - } - - - public JoinFetchType getValue() { - return this.joinFetchValue; - } - - public void setValue(JoinFetchType newJoinFetchValue) { - JoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - this.resource.setJoinFetch(JoinFetchType.toOrmResourceModel(newJoinFetchValue)); - firePropertyChanged(VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - protected void setValue_(JoinFetchType newJoinFetchValue) { - JoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - firePropertyChanged(VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlJoinFetch xmlJoinFetch) { - this.resource = xmlJoinFetch; - this.joinFetchValue = JoinFetchType.fromOrmResourceModel(this.resource.getJoinFetch()); - } - - protected void update() { - setValue_(JoinFetchType.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/EclipseLinkOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToManyMapping.java deleted file mode 100644 index 9c805dabfc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToManyMapping.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.GenericOrmManyToManyMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmManyToManyMapping - extends GenericOrmManyToManyMapping - implements EclipseLinkRelationshipMapping -{ - protected EclipseLinkOrmJoinFetch joinFetch; - - - public EclipseLinkOrmManyToManyMapping(OrmPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkOrmJoinFetch(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlManyToMany addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlManyToMany manyToMany = EclipseLinkOrmFactory.eINSTANCE.createXmlManyToManyImpl(); - getPersistentAttribute().initialize(manyToMany); - typeMapping.getAttributes().getManyToManys().add(manyToMany); - return manyToMany; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.joinFetch.initialize((XmlJoinFetch) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // 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/EclipseLinkOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToOneMapping.java deleted file mode 100644 index fe53115d43..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToOneMapping.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.GenericOrmManyToOneMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmManyToOneMapping extends GenericOrmManyToOneMapping - implements EclipseLinkRelationshipMapping -{ - protected EclipseLinkOrmJoinFetch joinFetch; - - - public EclipseLinkOrmManyToOneMapping(OrmPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkOrmJoinFetch(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlManyToOne addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlManyToOne manyToOne = EclipseLinkOrmFactory.eINSTANCE.createXmlManyToOneImpl(); - getPersistentAttribute().initialize(manyToOne); - typeMapping.getAttributes().getManyToOnes().add(manyToOne); - return manyToOne; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.joinFetch.initialize((XmlJoinFetch) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // 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/EclipseLinkOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclass.java deleted file mode 100644 index 09950fc8e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclass.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.OrmMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMappedSuperclass; - -public interface EclipseLinkOrmMappedSuperclass extends EclipseLinkMappedSuperclass, OrmMappedSuperclass -{ - ConverterHolder getConverterHolder(); -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclassImpl.java deleted file mode 100644 index 2c8d9bde71..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclassImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.GenericOrmMappedSuperclass; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -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.XmlReadOnly; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmMappedSuperclassImpl extends GenericOrmMappedSuperclass - implements EclipseLinkOrmMappedSuperclass -{ - protected final EclipseLinkOrmReadOnly readOnly; - - protected final EclipseLinkOrmCustomizer customizer; - - protected final EclipseLinkOrmChangeTracking changeTracking; - - protected final EclipseLinkOrmCaching caching; - - protected final EclipseLinkOrmConverterHolder converterHolder; - - - public EclipseLinkOrmMappedSuperclassImpl(OrmPersistentType parent) { - super(parent); - this.readOnly = new EclipseLinkOrmReadOnly(this); - this.customizer = new EclipseLinkOrmCustomizer(this); - this.changeTracking = new EclipseLinkOrmChangeTracking(this); - this.caching = new EclipseLinkOrmCaching(this); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); -} - - public Caching getCaching() { - return this.caching; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public EclipseLinkOrmReadOnly getReadOnly() { - return this.readOnly; - } - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlMappedSuperclass addToResourceModel(XmlEntityMappings entityMappings) { - XmlMappedSuperclass mappedSuperclass = EclipseLinkOrmFactory.eINSTANCE.createXmlMappedSuperclass(); - getPersistentType().initialize(mappedSuperclass); - entityMappings.getMappedSuperclasses().add(mappedSuperclass); - return mappedSuperclass; - } - - @Override - public void initialize(XmlMappedSuperclass mappedSuperclass) { - super.initialize(mappedSuperclass); - this.readOnly.initialize((XmlReadOnly) mappedSuperclass, getJavaReadOnly()); - this.customizer.initialize((XmlCustomizerHolder) mappedSuperclass, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) mappedSuperclass, getJavaChangeTracking()); - this.caching.initialize((XmlCacheHolder) mappedSuperclass, getJavaCaching()); - this.converterHolder.initialize((XmlConvertersHolder) mappedSuperclass); - } - - @Override - public void update(XmlMappedSuperclass mappedSuperclass) { - super.update(mappedSuperclass); - this.readOnly.update((XmlReadOnly) mappedSuperclass, getJavaReadOnly()); - this.customizer.update((XmlCustomizerHolder) mappedSuperclass, getJavaCustomizer()); - this.changeTracking.update((XmlChangeTrackingHolder) mappedSuperclass, getJavaChangeTracking()); - this.caching.update((XmlCacheHolder) mappedSuperclass, getJavaCaching()); - this.converterHolder.update((XmlConvertersHolder) mappedSuperclass); - } - - @Override - protected EclipseLinkJavaMappedSuperclass getJavaMappedSuperclassForDefaults() { - return (EclipseLinkJavaMappedSuperclass) super.getJavaMappedSuperclassForDefaults(); - } - - protected ReadOnly getJavaReadOnly() { - EclipseLinkJavaMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getReadOnly(); - } - - protected Customizer getJavaCustomizer() { - EclipseLinkJavaMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getCustomizer(); - } - - protected ChangeTracking getJavaChangeTracking() { - EclipseLinkJavaMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getChangeTracking(); - } - - protected JavaCaching getJavaCaching() { - EclipseLinkJavaMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getCaching(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - this.readOnly.validate(messages); - this.customizer.validate(messages); - this.changeTracking.validate(messages); - this.caching.validate(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMutable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMutable.java deleted file mode 100644 index c585d9863c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMutable.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; - -public class EclipseLinkOrmMutable extends AbstractXmlContextNode - implements Mutable -{ - protected XmlMutable resource; - - protected boolean defaultMutable; - - protected Boolean specifiedMutable; - - - public EclipseLinkOrmMutable(OrmAttributeMapping parent) { - super(parent); - } - - @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 initialize(XmlMutable resource) { - this.resource = resource; - this.defaultMutable = calculateDefaultMutable(); - this.specifiedMutable = resource.getMutable(); - } - - protected void update() { - setDefaultMutable(calculateDefaultMutable()); - setSpecifiedMutable_(this.resource.getMutable()); - } - - protected boolean calculateDefaultMutable() { - OrmAttributeMapping attributeMapping = getAttributeMapping(); - JavaPersistentAttribute javaAttribute = attributeMapping.getJavaPersistentAttribute(); - if (javaAttribute == null) { - return false; - } - JavaResourcePersistentAttribute javaResourceAttribute = javaAttribute.getResourcePersistentAttribute(); - if (javaResourceAttribute.typeIsDateOrCalendar()) { - Boolean persistenceUnitDefaultMutable = getPersistenceUnit().getOptions().getTemporalMutable(); - return persistenceUnitDefaultMutable == null ? false : persistenceUnitDefaultMutable.booleanValue(); - } - return javaResourceAttribute.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/EclipseLinkOrmObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java deleted file mode 100644 index 4bf7b0ddc4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.ConversionValue; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -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.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmObjectTypeConverter extends EclipseLinkOrmConverter - implements ObjectTypeConverter -{ - private String dataType; - - private String objectType; - - private final List<EclipseLinkOrmConversionValue> conversionValues; - - private String defaultObjectValue; - - - public EclipseLinkOrmObjectTypeConverter(XmlContextNode parent, XmlObjectTypeConverter xmlResource) { - super(parent, xmlResource); - this.conversionValues = new ArrayList<EclipseLinkOrmConversionValue>(); - } - - - public String getType() { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - - @Override - protected XmlObjectTypeConverter getXmlResource() { - return (XmlObjectTypeConverter) super.getXmlResource(); - } - - - // **************** 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<EclipseLinkOrmConversionValue> conversionValues() { - return new CloneListIterator<EclipseLinkOrmConversionValue>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public EclipseLinkOrmConversionValue addConversionValue(int index) { - XmlConversionValue resourceConversionValue = EclipseLinkOrmFactory.eINSTANCE.createXmlConversionValueImpl(); - EclipseLinkOrmConversionValue contextConversionValue = buildConversionValue(resourceConversionValue); - this.conversionValues.add(index, contextConversionValue); - getXmlResource().getConversionValues().add(index, resourceConversionValue); - fireItemAdded(CONVERSION_VALUES_LIST, index, contextConversionValue); - return contextConversionValue; - } - - public EclipseLinkOrmConversionValue addConversionValue() { - return this.addConversionValue(this.conversionValues.size()); - } - - protected void addConversionValue(int index, EclipseLinkOrmConversionValue conversionValue) { - addItemToList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected void addConversionValue(EclipseLinkOrmConversionValue conversionValue) { - this.addConversionValue(this.conversionValues.size(), conversionValue); - } - - public void removeConversionValue(int index) { - EclipseLinkOrmConversionValue removedJoinColumn = this.conversionValues.remove(index); - getXmlResource().getConversionValues().remove(index); - fireItemRemoved(CONVERSION_VALUES_LIST, index, removedJoinColumn); - } - - public void removeConversionValue(ConversionValue conversionValue) { - this.removeConversionValue(this.conversionValues.indexOf(conversionValue)); - } - - protected void removeConversionValue_(ConversionValue 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<EclipseLinkOrmConversionValue, String>(conversionValues()) { - @Override - protected String transform(EclipseLinkOrmConversionValue 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 *********************************** - - protected void initialize(XmlObjectTypeConverter xmlResource) { - super.initialize(xmlResource); - this.dataType = this.calculateDataType(); - this.objectType = this.calculateObjectType(); - this.defaultObjectValue = this.calculateDefaultObjectValue(); - this.initializeConversionValues(); - } - - protected void initializeConversionValues() { - for (XmlConversionValue resourceConversionValue : getXmlResource().getConversionValues()) { - this.conversionValues.add(buildConversionValue(resourceConversionValue)); - } - } - - public void update() { - super.update(); - setDataType_(calculateDataType()); - setObjectType_(calculateObjectType()); - setDefaultObjectValue_(calculateDefaultObjectValue()); - updateConversionValues(); - } - - protected void updateConversionValues( ) { - ListIterator<EclipseLinkOrmConversionValue> contextConversionValues = conversionValues(); - ListIterator<XmlConversionValue> resourceConversionValues = - new CloneListIterator<XmlConversionValue>(getXmlResource().getConversionValues());//prevent ConcurrentModificiationException - - while (contextConversionValues.hasNext()) { - EclipseLinkOrmConversionValue conversionValues = contextConversionValues.next(); - if (resourceConversionValues.hasNext()) { - conversionValues.update(resourceConversionValues.next()); - } - else { - removeConversionValue_(conversionValues); - } - } - - while (resourceConversionValues.hasNext()) { - addConversionValue(buildConversionValue(resourceConversionValues.next())); - } - } - - protected EclipseLinkOrmConversionValue buildConversionValue(XmlConversionValue resourceConversionValue) { - EclipseLinkOrmConversionValue conversionValue = new EclipseLinkOrmConversionValue(this); - conversionValue.initialize(resourceConversionValue); - return conversionValue; - } - - protected String calculateDataType() { - return getXmlResource().getDataType(); - } - - protected String calculateObjectType() { - return getXmlResource().getObjectType(); - } - - protected String calculateDefaultObjectValue() { - return getXmlResource().getDefaultObjectValue(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - for (Iterator<EclipseLinkOrmConversionValue> stream = conversionValues(); stream.hasNext();) { - stream.next().validate(messages); - } - } -}
\ 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/EclipseLinkOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyMapping.java deleted file mode 100644 index 7d1fb25f4a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyMapping.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmOneToManyMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlPrivateOwned; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmOneToManyMapping extends GenericOrmOneToManyMapping - implements EclipseLinkOneToManyMapping -{ - protected EclipseLinkOrmPrivateOwned privateOwned; - - protected EclipseLinkOrmJoinFetch joinFetch; - - - public EclipseLinkOrmOneToManyMapping(OrmPersistentAttribute parent) { - super(parent); - this.privateOwned = new EclipseLinkOrmPrivateOwned(this); - this.joinFetch = new EclipseLinkOrmJoinFetch(this); - } - - // ********** NonOwningMapping implementation ********** - @Override - public boolean mappedByIsValid(AttributeMapping mappedByMapping) { - return super.mappedByIsValid(mappedByMapping) || (mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - } - - - public PrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlOneToMany addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlOneToMany oneToMany = EclipseLinkOrmFactory.eINSTANCE.createXmlOneToManyImpl(); - getPersistentAttribute().initialize(oneToMany); - typeMapping.getAttributes().getOneToManys().add(oneToMany); - return oneToMany; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.privateOwned.initialize((XmlPrivateOwned) this.resourceAttributeMapping); - this.joinFetch.initialize((XmlJoinFetch) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // 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/EclipseLinkOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToOneMapping.java deleted file mode 100644 index b5aa086121..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToOneMapping.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.GenericOrmOneToOneMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlPrivateOwned; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmOneToOneMapping extends GenericOrmOneToOneMapping - implements EclipseLinkOneToOneMapping -{ - protected EclipseLinkOrmPrivateOwned privateOwned; - - protected EclipseLinkOrmJoinFetch joinFetch; - - - public EclipseLinkOrmOneToOneMapping(OrmPersistentAttribute parent) { - super(parent); - this.privateOwned = new EclipseLinkOrmPrivateOwned(this); - this.joinFetch = new EclipseLinkOrmJoinFetch(this); - } - - - public PrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlOneToOne addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlOneToOne oneToOne = EclipseLinkOrmFactory.eINSTANCE.createXmlOneToOneImpl(); - getPersistentAttribute().initialize(oneToOne); - typeMapping.getAttributes().getOneToOnes().add(oneToOne); - return oneToOne; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.privateOwned.initialize((XmlPrivateOwned) this.resourceAttributeMapping); - this.joinFetch.initialize((XmlJoinFetch) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // 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/EclipseLinkOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentType.java deleted file mode 100644 index f02d132bd3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentType.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.PersistentTypeContext; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmPersistentType; -import org.eclipse.jpt.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; - -public class EclipseLinkOrmPersistentType extends GenericOrmPersistentType -{ - - public EclipseLinkOrmPersistentType(PersistentTypeContext parent, String mappingKey) { - super(parent, mappingKey); - } - - @Override - protected Attributes createAttributesResource() { - return EclipseLinkOrmFactory.eINSTANCE.createAttributes(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPrivateOwned.java deleted file mode 100644 index 75365e2100..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPrivateOwned.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlPrivateOwned; - -public class EclipseLinkOrmPrivateOwned extends AbstractXmlContextNode - implements PrivateOwned -{ - protected XmlPrivateOwned resource; - - protected boolean privateOwned; - - - public EclipseLinkOrmPrivateOwned(OrmAttributeMapping parent) { - super(parent); - } - - - 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 initialize(XmlPrivateOwned xmlPrivateOwned) { - this.resource = xmlPrivateOwned; - this.privateOwned = this.resource.isPrivateOwned(); - } - - protected void update() { - setPrivateOwned_(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/EclipseLinkOrmReadOnly.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmReadOnly.java deleted file mode 100644 index 2c40ecabe5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmReadOnly.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlReadOnly; - -public class EclipseLinkOrmReadOnly extends AbstractXmlContextNode - implements ReadOnly -{ - protected XmlReadOnly resource; - - protected boolean defaultReadOnly; - - protected Boolean specifiedReadOnly; - - - public EclipseLinkOrmReadOnly(OrmTypeMapping parent) { - super(parent); - } - - - 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 initialize(XmlReadOnly resource, ReadOnly javaReadOnly) { - this.resource = resource; - this.defaultReadOnly = (javaReadOnly == null) ? false : javaReadOnly.isReadOnly(); - this.specifiedReadOnly = resource.getReadOnly(); - } - - protected void update(XmlReadOnly resource, ReadOnly javaReadOnly) { - this.resource = resource; - setDefaultReadOnly((javaReadOnly == null) ? false : javaReadOnly.isReadOnly()); - setSpecifiedReadOnly(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/EclipseLinkOrmStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java deleted file mode 100644 index c1cda517ff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.StructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmStructConverter extends EclipseLinkOrmConverter - implements StructConverter -{ - private String converterClass; - - - public EclipseLinkOrmStructConverter(XmlContextNode parent, XmlStructConverter xmlResource) { - super(parent, xmlResource); - } - - - public String getType() { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - @Override - protected XmlStructConverter getXmlResource() { - return (XmlStructConverter) super.getXmlResource(); - } - - - // **************** 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 *********************************** - - protected void initialize(XmlStructConverter xmlResource) { - super.initialize(xmlResource); - this.converterClass = calculateConverterClass(); - } - - public void update() { - super.update(); - setConverterClass_(calculateConverterClass()); - } - - protected String calculateConverterClass() { - return getXmlResource().getConverter(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - 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/EclipseLinkOrmTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java deleted file mode 100644 index 721650ac72..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -public class EclipseLinkOrmTypeConverter extends EclipseLinkOrmConverter - implements TypeConverter -{ - private String dataType; - - private String objectType; - - - public EclipseLinkOrmTypeConverter(XmlContextNode parent, XmlTypeConverter xmlResource) { - super(parent, xmlResource); - } - - - public String getType() { - return EclipseLinkConverter.TYPE_CONVERTER; - } - - @Override - protected XmlTypeConverter getXmlResource() { - return (XmlTypeConverter) super.getXmlResource(); - } - - - // **************** 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 *********************************** - - protected void initialize(XmlTypeConverter xmlResource) { - super.initialize(xmlResource); - this.dataType = calculateDataType(); - this.objectType = calculateObjectType(); - } - - public void update() { - super.update(); - setDataType_(calculateDataType()); - setObjectType_(calculateObjectType()); - } - - protected String calculateDataType() { - return getXmlResource().getDataType(); - } - - protected String calculateObjectType() { - return getXmlResource().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/EclipseLinkOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmVersionMapping.java deleted file mode 100644 index 103ad77c76..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmVersionMapping.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.GenericOrmVersionMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVersion; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmVersionMapping extends GenericOrmVersionMapping - implements EclipseLinkVersionMapping -{ - protected EclipseLinkOrmMutable mutable; - - - public EclipseLinkOrmVersionMapping(OrmPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkOrmMutable(this); - } - - - public Mutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkOrmConvert(this, (XmlVersion) this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String specifiedConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlVersion) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(); - } - - // **************** resource-context interaction *************************** - - @Override - public XmlVersion addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlVersion version = EclipseLinkOrmFactory.eINSTANCE.createXmlVersionImpl(); - getPersistentAttribute().initialize(version); - typeMapping.getAttributes().getVersions().add(version); - return version; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.mutable.initialize((XmlMutable) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXml.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXml.java deleted file mode 100644 index f10d1fdcf4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXml.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.persistence.MappingFileRef; -import org.eclipse.jpt.core.internal.context.orm.OrmXmlImpl; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmResource; - -public class EclipseLinkOrmXml extends OrmXmlImpl -{ - public EclipseLinkOrmXml(MappingFileRef parent, EclipseLinkOrmResource ormResource) { - super(parent, ormResource); - } - - @Override - protected XmlEntityMappings buildEntityMappingsResource() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlEntityMappings(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlBasic.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlBasic.java deleted file mode 100644 index b8212e8131..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlBasic.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaBasicMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlBasic; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -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.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 EclipseLinkVirtualXmlBasic extends VirtualXmlBasic implements XmlBasic -{ - - public EclipseLinkVirtualXmlBasic(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) { - super(ormTypeMapping, javaBasicMapping); - } - - public Boolean getMutable() { - if (isOrmMetadataComplete()) { - return Boolean.valueOf(((EclipseLinkBasicMapping) this.javaAttributeMapping).getMutable().isDefaultMutable()); - } - return Boolean.valueOf(((EclipseLinkBasicMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - public void setMutable(@SuppressWarnings("unused") Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getConvert() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - return ((Convert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - public void setConvert(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getMutableTextRange() { - return null; - } - - public TextRange getConvertTextRange() { - return null; - } - - public XmlConverter getConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkVirtualXmlConverter(this.ormTypeMapping, (CustomConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setConverter(@SuppressWarnings("unused") XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlObjectTypeConverter getObjectTypeConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlObjectTypeConverter(this.ormTypeMapping, (ObjectTypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setObjectTypeConverter(@SuppressWarnings("unused") XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlStructConverter getStructConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkVirtualXmlStructConverter(this.ormTypeMapping, (StructConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setStructConverter(@SuppressWarnings("unused") XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlTypeConverter getTypeConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlTypeConverter(this.ormTypeMapping, (TypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setTypeConverter(@SuppressWarnings("unused") XmlTypeConverter 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/EclipseLinkVirtualXmlConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConversionValue.java deleted file mode 100644 index 38675d53fd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConversionValue.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -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 EclipseLinkVirtualXmlConversionValue extends AbstractJpaEObject implements XmlConversionValue -{ - protected OrmTypeMapping ormTypeMapping; - - protected ConversionValue javaConversionValue; - - public EclipseLinkVirtualXmlConversionValue(OrmTypeMapping ormTypeMapping, ConversionValue javaConversionValue) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConversionValue = javaConversionValue; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getDataValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConversionValue.getDataValue(); - } - - public void setDataValue(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getObjectValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConversionValue.getObjectValue(); - } - - public void setObjectValue(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getDataValueTextRange() { - return null; - } - - public TextRange getObjectValueTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java deleted file mode 100644 index d0a0f047af..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -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 EclipseLinkVirtualXmlConverter extends AbstractJpaEObject implements XmlConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected CustomConverter javaConverter; - - public EclipseLinkVirtualXmlConverter(OrmTypeMapping ormTypeMapping, CustomConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getClassName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getConverterClass(); - } - - public void setClassName(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - public void setName(@SuppressWarnings("unused") 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/EclipseLinkVirtualXmlId.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlId.java deleted file mode 100644 index e79810c929..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlId.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaIdMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlId; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -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.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 EclipseLinkVirtualXmlId extends VirtualXmlId implements XmlId -{ - - public EclipseLinkVirtualXmlId(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) { - super(ormTypeMapping, javaIdMapping); - } - - public Boolean getMutable() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - return Boolean.valueOf(((EclipseLinkIdMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - public void setMutable(@SuppressWarnings("unused") Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getConvert() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - return ((Convert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - public void setConvert(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlConverter getConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkVirtualXmlConverter(this.ormTypeMapping, (CustomConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setConverter(@SuppressWarnings("unused") XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlObjectTypeConverter getObjectTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlObjectTypeConverter(this.ormTypeMapping, (ObjectTypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setObjectTypeConverter(@SuppressWarnings("unused") XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlStructConverter getStructConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkVirtualXmlStructConverter(this.ormTypeMapping, (StructConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setStructConverter(@SuppressWarnings("unused") XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlTypeConverter getTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlTypeConverter(this.ormTypeMapping, (TypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setTypeConverter(@SuppressWarnings("unused") XmlTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - public TextRange getMutableTextRange() { - return null; - } - - public TextRange getConvertTextRange() { - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToMany.java deleted file mode 100644 index db318f3bcf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToMany.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaManyToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlManyToMany; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingImpl; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlManyToMany extends VirtualXmlManyToMany implements XmlManyToMany -{ - - public EclipseLinkVirtualXmlManyToMany(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) { - super(ormTypeMapping, javaManyToManyMapping); - } - - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return JoinFetchType.toOrmResourceModel(JoinFetch.DEFAULT_VALUE); - } - return JoinFetchType.toOrmResourceModel(((EclipseLinkJavaManyToManyMappingImpl) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - public void setJoinFetch(@SuppressWarnings("unused") XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getJoinFetchTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToOne.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToOne.java deleted file mode 100644 index ea91a20723..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToOne.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaManyToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlManyToOne; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingImpl; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToOne; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlManyToOne extends VirtualXmlManyToOne implements XmlManyToOne -{ - - public EclipseLinkVirtualXmlManyToOne(OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) { - super(ormTypeMapping, javaManyToOneMapping); - } - - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return JoinFetchType.toOrmResourceModel(JoinFetch.DEFAULT_VALUE); - } - return JoinFetchType.toOrmResourceModel(((EclipseLinkJavaManyToOneMappingImpl) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - public void setJoinFetch(@SuppressWarnings("unused") XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getJoinFetchTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java deleted file mode 100644 index 902c4599c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.core.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -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 EclipseLinkVirtualXmlObjectTypeConverter extends AbstractJpaEObject implements XmlObjectTypeConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected ObjectTypeConverter javaConverter; - - public EclipseLinkVirtualXmlObjectTypeConverter(OrmTypeMapping ormTypeMapping, ObjectTypeConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - public void setName(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getDataType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDataType(); - } - - public void setDataType(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getObjectType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getObjectType(); - } - - public void setObjectType(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getDefaultObjectValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDefaultObjectValue(); - } - - public void setDefaultObjectValue(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - 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 (ConversionValue javaConversionValue : CollectionTools.iterable(this.javaConverter.conversionValues())) { - XmlConversionValue xmlConversionValue = new EclipseLinkVirtualXmlConversionValue(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/EclipseLinkVirtualXmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToMany.java deleted file mode 100644 index de32d62548..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToMany.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaOneToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlOneToMany; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingImpl; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlOneToMany extends VirtualXmlOneToMany implements XmlOneToMany -{ - - public EclipseLinkVirtualXmlOneToMany(OrmTypeMapping ormTypeMapping, JavaOneToManyMapping javaOneToManyMapping) { - super(ormTypeMapping, javaOneToManyMapping); - } - - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return JoinFetchType.toOrmResourceModel(JoinFetch.DEFAULT_VALUE); - } - return JoinFetchType.toOrmResourceModel(((EclipseLinkJavaOneToManyMappingImpl) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - public void setJoinFetch(@SuppressWarnings("unused") XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public boolean isPrivateOwned() { - if (isOrmMetadataComplete()) { - return false; - } - return ((EclipseLinkJavaOneToManyMappingImpl) this.javaAttributeMapping).getPrivateOwned().isPrivateOwned(); - } - - public void setPrivateOwned(@SuppressWarnings("unused") boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getJoinFetchTextRange() { - return null; - } - - public TextRange getPrivateOwnedTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToOne.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToOne.java deleted file mode 100644 index 016e602b15..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToOne.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaOneToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlOneToOne; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingImpl; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlOneToOne extends VirtualXmlOneToOne implements XmlOneToOne -{ - - public EclipseLinkVirtualXmlOneToOne(OrmTypeMapping ormTypeMapping, JavaOneToOneMapping javaOneToOneMapping) { - super(ormTypeMapping, javaOneToOneMapping); - } - - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return JoinFetchType.toOrmResourceModel(JoinFetch.DEFAULT_VALUE); - } - return JoinFetchType.toOrmResourceModel(((EclipseLinkJavaOneToOneMappingImpl) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - public void setJoinFetch(@SuppressWarnings("unused") XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public boolean isPrivateOwned() { - if (isOrmMetadataComplete()) { - return false; - } - return ((EclipseLinkJavaOneToOneMappingImpl) this.javaAttributeMapping).getPrivateOwned().isPrivateOwned(); - } - - public void setPrivateOwned(@SuppressWarnings("unused") boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getJoinFetchTextRange() { - return null; - } - - public TextRange getPrivateOwnedTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java deleted file mode 100644 index 037bb746c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -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 EclipseLinkVirtualXmlStructConverter extends AbstractJpaEObject implements XmlStructConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected StructConverter javaConverter; - - public EclipseLinkVirtualXmlStructConverter(OrmTypeMapping ormTypeMapping, StructConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getConverter() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getConverterClass(); - } - - public void setConverter(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - public void setName(@SuppressWarnings("unused") 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/EclipseLinkVirtualXmlTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.java deleted file mode 100644 index f7ec01a1a9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -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 EclipseLinkVirtualXmlTypeConverter extends AbstractJpaEObject implements XmlTypeConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected TypeConverter javaConverter; - - public EclipseLinkVirtualXmlTypeConverter(OrmTypeMapping ormTypeMapping, TypeConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - public void setName(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getDataType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDataType(); - } - - public void setDataType(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getObjectType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getObjectType(); - } - - public void setObjectType(@SuppressWarnings("unused") 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/EclipseLinkVirtualXmlVersion.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlVersion.java deleted file mode 100644 index 02532e6aec..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlVersion.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JavaVersionMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlVersion; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -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.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 EclipseLinkVirtualXmlVersion extends VirtualXmlVersion implements XmlVersion -{ - - public EclipseLinkVirtualXmlVersion(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) { - super(ormTypeMapping, javaVersionMapping); - } - - public Boolean getMutable() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - return Boolean.valueOf(((EclipseLinkVersionMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - public void setMutable(@SuppressWarnings("unused") Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getConvert() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - return ((Convert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - public void setConvert(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getMutableTextRange() { - return null; - } - - public TextRange getConvertTextRange() { - return null; - } - - public XmlConverter getConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkVirtualXmlConverter(this.ormTypeMapping, (CustomConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setConverter(@SuppressWarnings("unused") XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlObjectTypeConverter getObjectTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlObjectTypeConverter(this.ormTypeMapping, (ObjectTypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setObjectTypeConverter(@SuppressWarnings("unused") XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlStructConverter getStructConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkVirtualXmlStructConverter(this.ormTypeMapping, (StructConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setStructConverter(@SuppressWarnings("unused") XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlTypeConverter getTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlTypeConverter(this.ormTypeMapping, (TypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setTypeConverter(@SuppressWarnings("unused") XmlTypeConverter 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/OrmBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMapping.java deleted file mode 100644 index 3d7a588765..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMapping.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; - -public class OrmBasicCollectionMapping extends AbstractOrmAttributeMapping<XmlBasicCollection> implements BasicCollectionMapping -{ - - public OrmBasicCollectionMapping(OrmPersistentAttribute parent) { - super(parent); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlBasicCollection addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlBasicCollection basicCollection = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicCollectionImpl(); - getPersistentAttribute().initialize(basicCollection); - ((Attributes) typeMapping.getAttributes()).getBasicCollections().add(basicCollection); - return basicCollection; - } - - public void removeFromResourceModel(AbstractXmlTypeMapping typeMapping) { - ((Attributes) typeMapping.getAttributes()).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/OrmBasicCollectionMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMappingProvider.java deleted file mode 100644 index 69f3f638cb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMappingProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicCollectionMapping; - -public class OrmBasicCollectionMappingProvider - implements OrmAttributeMappingProvider -{ - - // singleton - private static final OrmBasicCollectionMappingProvider INSTANCE = new OrmBasicCollectionMappingProvider(); - - /** - * Return the singleton. - */ - public static OrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrmBasicCollectionMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildOrmBasicCollectionMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildVirtualXmlBasicCollection(ormTypeMapping, (JavaBasicCollectionMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMapping.java deleted file mode 100644 index 6294f48e81..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMapping.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; - -public class OrmBasicMapMapping extends AbstractOrmAttributeMapping<XmlBasicMap> implements BasicMapMapping -{ - - public OrmBasicMapMapping(OrmPersistentAttribute parent) { - super(parent); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public XmlBasicMap addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlBasicMap basicMap = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicMapImpl(); - getPersistentAttribute().initialize(basicMap); - ((Attributes) typeMapping.getAttributes()).getBasicMaps().add(basicMap); - return basicMap; - } - - public void removeFromResourceModel(AbstractXmlTypeMapping typeMapping) { - ((Attributes) typeMapping.getAttributes()).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/OrmBasicMapMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMappingProvider.java deleted file mode 100644 index 087f5c9cfc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMappingProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicMapMapping; - -public class OrmBasicMapMappingProvider - implements OrmAttributeMappingProvider -{ - - // singleton - private static final OrmBasicMapMappingProvider INSTANCE = new OrmBasicMapMappingProvider(); - - /** - * Return the singleton. - */ - public static OrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrmBasicMapMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildOrmBasicMapMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildVirtualXmlBasicMap(ormTypeMapping, (JavaBasicMapMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMapping.java deleted file mode 100644 index 9c37b0bed5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMapping.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.TransformationMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; - -public class OrmTransformationMapping extends AbstractOrmAttributeMapping<XmlTransformation> implements TransformationMapping -{ - - public OrmTransformationMapping(OrmPersistentAttribute parent) { - super(parent); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlTransformation addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlTransformation transformation = EclipseLinkOrmFactory.eINSTANCE.createXmlTransformationImpl(); - getPersistentAttribute().initialize(transformation); - ((Attributes) typeMapping.getAttributes()).getTransformations().add(transformation); - return transformation; - } - - public void removeFromResourceModel(AbstractXmlTypeMapping typeMapping) { - ((Attributes) typeMapping.getAttributes()).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/OrmTransformationMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMappingProvider.java deleted file mode 100644 index f156c2ca37..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMappingProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaTransformationMapping; - -public class OrmTransformationMappingProvider - implements OrmAttributeMappingProvider -{ - - // singleton - private static final OrmTransformationMappingProvider INSTANCE = new OrmTransformationMappingProvider(); - - /** - * Return the singleton. - */ - public static OrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrmTransformationMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildOrmTransformationMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildVirtualXmlTransformation(ormTypeMapping, (JavaTransformationMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicCollection.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicCollection.java deleted file mode 100644 index 65eded5257..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicCollection.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.VirtualXmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlBasicCollection extends VirtualXmlAttributeMapping<JavaBasicCollectionMapping> implements XmlBasicCollection -{ - - public VirtualXmlBasicCollection(OrmTypeMapping ormTypeMapping, JavaBasicCollectionMapping javaBasicCollectionMapping) { - super(ormTypeMapping, javaBasicCollectionMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicMap.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicMap.java deleted file mode 100644 index 34abe15de7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicMap.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.VirtualXmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlBasicMap extends VirtualXmlAttributeMapping<JavaBasicMapMapping> implements XmlBasicMap -{ - - public VirtualXmlBasicMap(OrmTypeMapping ormTypeMapping, JavaBasicMapMapping javaBasicMapMappingg) { - super(ormTypeMapping, javaBasicMapMappingg); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlTransformation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlTransformation.java deleted file mode 100644 index db4ae6ecb0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlTransformation.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.VirtualXmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaTransformationMapping; -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 VirtualXmlTransformation extends VirtualXmlAttributeMapping<JavaTransformationMapping> implements XmlTransformation -{ - - public VirtualXmlTransformation(OrmTypeMapping ormTypeMapping, JavaTransformationMapping javaTransformationMapping) { - super(ormTypeMapping, javaTransformationMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkImpliedMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkImpliedMappingFileRef.java deleted file mode 100644 index 93566046e8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkImpliedMappingFileRef.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies 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.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.GenericMappingFileRef; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; - -/** - * Currently, this class is only used for implied eclipselink mapping files - */ -public class EclipseLinkImpliedMappingFileRef extends GenericMappingFileRef -{ - public EclipseLinkImpliedMappingFileRef(PersistenceUnit parent) { - super(parent, null); - } - - - @Override - protected void initializeFileName() { - fileName = JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH; - } - - @Override - protected void updateFileName() { - setFileName_(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH); - } -} 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 42bf7f5e2d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java +++ /dev/null @@ -1,341 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit; -import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.EclipseLinkConnection; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; -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.general.GeneralProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.EclipseLinkLogging; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.EclipseLinkOptions; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.EclipseLinkSchemaGeneration; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.core.internal.resource.orm.EclipseLinkOrmResourceModelProvider; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmResource; -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; -import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * EclipseLinkPersistenceUnit - */ -public class EclipseLinkPersistenceUnit extends AbstractPersistenceUnit -{ - protected MappingFileRef impliedEclipseLinkMappingFileRef; - - private GeneralProperties generalProperties; - private Connection connection; - private Customization customization; - private Caching caching; - private Logging logging; - private Options options; - private SchemaGeneration schemaGeneration; - - private final ListValueModel<Property> propertiesAdapter; - private final ListValueModel<Property> propertyListAdapter; - - /* global converter definitions, defined elsewhere in model */ - protected final List<EclipseLinkConverter> converters = new ArrayList<EclipseLinkConverter>(); - - - public EclipseLinkPersistenceUnit(Persistence parent, XmlPersistenceUnit persistenceUnit) { - super(parent); - this.propertiesAdapter = this.buildPropertiesAdapter(); - this.propertyListAdapter = this.buildPropertyListAdapter(this.propertiesAdapter); - this.initialize(persistenceUnit); - } - - @Override - protected void initializeProperties(XmlPersistenceUnit xpu) { - super.initializeProperties(xpu); - this.generalProperties = new EclipseLinkGeneralProperties(this, this.propertyListAdapter); - this.connection = new EclipseLinkConnection(this, this.propertyListAdapter); - this.customization = new EclipseLinkCustomization(this, this.propertyListAdapter); - this.caching = new EclipseLinkCaching(this, this.propertyListAdapter); - this.logging = new EclipseLinkLogging(this, this.propertyListAdapter); - this.options = new EclipseLinkOptions(this, this.propertyListAdapter); - this.schemaGeneration = new EclipseLinkSchemaGeneration(this, this.propertyListAdapter); - } - // ********** internal methods ********** - - private ListValueModel<Property> buildPropertyListAdapter(ListValueModel<Property> propertiesAdapter) { - return new ItemPropertyListValueModelAdapter<Property>(propertiesAdapter, Property.VALUE_PROPERTY); - } - - private ListValueModel<Property> buildPropertiesAdapter() { - return new ListAspectAdapter<PersistenceUnit, Property>(new SimplePropertyValueModel<PersistenceUnit>(this), PersistenceUnit.PROPERTIES_LIST) { - @Override - protected ListIterator<Property> listIterator_() { - return this.subject.properties(); - } - - @Override - protected int size_() { - return this.subject.propertiesSize(); - } - }; - } - - @Override - protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) { - super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - nonUpdateAspectNames.add(CONVERTERS_LIST); - } - - - // **************** mapping file refs ************************************** - - @Override - public ListIterator<MappingFileRef> mappingFileRefs() { - if (impliedEclipseLinkMappingFileRef == null) { - return super.mappingFileRefs(); - } - return new ReadOnlyCompositeListIterator<MappingFileRef>( - super.mappingFileRefs(), impliedEclipseLinkMappingFileRef); - } - - @Override - public int mappingFileRefsSize() { - if (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 impliedEclipseLinkMappingFileRef; - } - - protected MappingFileRef setImpliedEclipseLinkMappingFileRef() { - if (impliedEclipseLinkMappingFileRef != null) { - throw new IllegalStateException("The implied eclipselink mapping file ref is already set."); //$NON-NLS-1$ - } - MappingFileRef mappingFileRef = new EclipseLinkImpliedMappingFileRef(this); - impliedEclipseLinkMappingFileRef = mappingFileRef; - firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, null, mappingFileRef); - return mappingFileRef; - } - - protected void unsetImpliedEclipseLinkMappingFileRef() { - if (impliedEclipseLinkMappingFileRef == null) { - throw new IllegalStateException("The implied eclipselink mapping file ref is already unset."); //$NON-NLS-1$ - } - MappingFileRef mappingFileRef = impliedEclipseLinkMappingFileRef; - impliedEclipseLinkMappingFileRef.dispose(); - impliedEclipseLinkMappingFileRef = null; - firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, mappingFileRef, null); - } - - - // **************** properties ********************************************* - - public GeneralProperties getGeneralProperties() { - return this.generalProperties; - } - - public Connection getConnection() { - return this.connection; - } - - public Customization getCustomization() { - return this.customization; - } - - public Caching getCaching() { - return this.caching; - } - - public Logging getLogging() { - return this.logging; - } - - public Options getOptions() { - return this.options; - } - - public SchemaGeneration getSchemaGeneration() { - return this.schemaGeneration; - } - - - public ListValueModel<Property> getPropertiesAdapter() { - return this.propertiesAdapter; - } - - public ListValueModel<Property> getPropertyListAdapter() { - return this.propertyListAdapter; - } - - - // **************** 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); - } - - /** - * 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 - protected void initializeMappingFileRefs(XmlPersistenceUnit xpu) { - super.initializeMappingFileRefs(xpu); - - // 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()) { - - impliedEclipseLinkMappingFileRef = new EclipseLinkImpliedMappingFileRef(this); - } - } - - @Override - protected void updateMappingFileRefs(XmlPersistenceUnit persistenceUnit) { - super.updateMappingFileRefs(persistenceUnit); - - // 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 (impliedEclipseLinkMappingFileRef == null) { - setImpliedEclipseLinkMappingFileRef(); - } - getImpliedEclipseLinkMappingFileRef().update(null); - } - else if (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; - } - - protected boolean impliedEclipseLinkMappingFileExists() { - EclipseLinkOrmResourceModelProvider modelProvider = - EclipseLinkOrmResourceModelProvider.getDefaultModelProvider(getJpaProject().getProject()); - EclipseLinkOrmResource resource = modelProvider.getResource(); - return resource != null && resource.exists(); - } - - // This is called after the persistence unit has been updated to ensure - // we catch all added converters - protected void convertersUpdated() { - fireListChanged(CONVERTERS_LIST); - } -}
\ 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/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 f760941f26..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java +++ /dev/null @@ -1,469 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.HashMap; -import java.util.Map; -import java.util.Set; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.utility.internal.ClassTools; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.model.AbstractModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * EclipseLinkPersistenceUnitProperties - * - * Listens to the propertyListAdapter - */ -public abstract class EclipseLinkPersistenceUnitProperties extends AbstractModel - implements PersistenceUnitProperties -{ - private PersistenceUnit persistenceUnit; - - private PersistenceUnitPropertyListListener propertyListListener; - - // key = EclipseLink property key; value = property id - private Map<String, String> propertyNames; - - private static final long serialVersionUID = 1L; - - // ********** constructors / initialization ********** - protected EclipseLinkPersistenceUnitProperties( - PersistenceUnit parent, - ListValueModel<Property> propertyListAdapter) { - super(); - this.initialize(parent, propertyListAdapter); - } - - protected void initialize( - PersistenceUnit parent, - ListValueModel<Property> propertyListAdapter) { - this.persistenceUnit = parent; - - this.propertyListListener = new PersistenceUnitPropertyListListener(this); - propertyListAdapter.addListChangeListener(ListValueModel.LIST_VALUES, this.propertyListListener); - - this.initializePropertyNames(); - this.initializeProperties(); - } - - protected void initializePropertyNames() { - this.propertyNames = new HashMap<String, String>(); - this.addPropertyNames(this.propertyNames); - } - - /** - * Initializes properties with values from the persistence unit. - */ - protected abstract void initializeProperties(); - - // ********** behavior ********** - public PersistenceUnit getPersistenceUnit() { - return this.persistenceUnit; - } - - public JpaProject getJpaProject() { - return this.persistenceUnit.getJpaProject(); - } - - public PersistenceUnitPropertyListListener propertyListListener() { - return this.propertyListListener; - } - - private Map<String, String> propertyNames() { - return this.propertyNames; - } - - /** - * Adds property names key/value pairs, used by the methods: itemIsProperty - * and propertyIdFor. - * - * key = EclipseLink property key; value = property id - */ - protected abstract void addPropertyNames(Map<String, String> propertyNames); - - /** - * Method used for identifying the given property. - */ - public boolean itemIsProperty(Property item) { - if (item == null) { - throw new IllegalArgumentException("Property is null"); - } - return this.propertyNames().keySet().contains(item.getName()); - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - public String propertyIdFor(Property property) { - String propertyId = this.propertyNames().get(property.getName()); - if (propertyId == null) { - throw new IllegalArgumentException("Illegal property: " + property.toString()); - } - return propertyId; - } - - protected String eclipseLinkKeyFor(String propertyId) { - for (String eclipseLinkKey : this.propertyNames().keySet()) { - if (this.propertyNames().get(eclipseLinkKey).equals(propertyId)) { - return eclipseLinkKey; - } - } - throw new IllegalArgumentException("Illegal property: " + propertyId); - } - - // ****** get/set String convenience methods ******* - /** - * Returns the String value of the given Property from the PersistenceXml. - */ - protected String getStringValue(String elKey) { - return this.getStringValue(elKey, null); - } - - protected String getStringValue(String key, String keySuffix) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (this.getPersistenceUnit().containsProperty(elKey)) { - // TOREVIEW - handle incorrect String in persistence.xml - return this.getPersistenceUnit().getProperty(elKey).getValue(); - } - return null; - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - - * EclipseLink Key - * @param newValue - * value to be associated with the key - */ - protected void putStringValue(String key, String newValue) { - this.putStringValue(key, null, newValue, false); - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putStringValue(String key, String newValue, boolean allowDuplicate) { - this.putStringValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putStringValue(String key, String keySuffix, String newValue, boolean allowDuplicate) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (newValue == null) { - this.getPersistenceUnit().removeProperty(elKey); - } - else { - this.getPersistenceUnit().putProperty(elKey, newValue, allowDuplicate); - } - } - - // ****** Integer convenience methods ******* - /** - * Returns the Integer value of the given Property from the PersistenceXml. - */ - protected Integer getIntegerValue(String elKey) { - return this.getIntegerValue(elKey, null); - } - - protected Integer getIntegerValue(String key, String keySuffix) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (this.getPersistenceUnit().containsProperty(elKey)) { - String eclipseLinkValue = this.getPersistenceUnit().getProperty(elKey).getValue(); - // TOREVIEW - handle incorrect eclipseLinkValue String in - // persistence.xml - return getIntegerValueOf(eclipseLinkValue); - } - return null; - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - - * EclipseLink Key - * @param newValue - * value to be associated with the key - */ - protected void putIntegerValue(String key, Integer newValue) { - this.putIntegerValue(key, null, newValue, false); - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putIntegerValue(String key, Integer newValue, boolean allowDuplicate) { - this.putIntegerValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putIntegerValue(String key, String keySuffix, Integer newValue, boolean allowDuplicate) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (newValue == null) { - this.getPersistenceUnit().removeProperty(elKey); - } - else { - this.getPersistenceUnit().putProperty(elKey, newValue.toString(), allowDuplicate); - } - } - - // ****** Boolean convenience methods ******* - /** - * Returns the Boolean value of the given Property from the PersistenceXml. - */ - protected Boolean getBooleanValue(String elKey) { - return this.getBooleanValue(elKey, null); - } - - /** - * Returns the Boolean value of the given Property from the PersistenceXml. - */ - protected Boolean getBooleanValue(String key, String keySuffix) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (this.getPersistenceUnit().containsProperty(elKey)) { - String eclipseLinkValue = this.getPersistenceUnit().getProperty(elKey).getValue(); - // TOREVIEW - handle incorrect eclipseLinkValue String in - // persistence.xml - return getBooleanValueOf(eclipseLinkValue); - } - return null; - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param newValue - * value to be associated with the key - */ - protected void putBooleanValue(String key, Boolean newValue) { - this.putBooleanValue(key, null, newValue, false); - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putBooleanValue(String key, Boolean newValue, boolean allowDuplicate) { - this.putBooleanValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putBooleanValue(String key, String keySuffix, Boolean newValue, boolean allowDuplicate) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (newValue == null) { - this.getPersistenceUnit().removeProperty(elKey); - } - else { - this.getPersistenceUnit().putProperty(elKey, newValue.toString(), allowDuplicate); - } - } - - // ****** Enum convenience methods ******* - /** - * Returns the Enum value of the given Property from the PersistenceXml. - */ - protected <T extends Enum<T>> T getEnumValue(String elKey, T[] enumValues) { - return getEnumValue(elKey, null, enumValues); - } - - protected <T extends Enum<T>> T getEnumValue(String key, String keySuffix, T[] enumValues) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (this.getPersistenceUnit().containsProperty(elKey)) { - String elStringValue = this.getPersistenceUnit().getProperty(elKey).getValue(); - // TOREVIEW - handle incorrect eclipseLinkValue String in persistence.xml - return getEnumValueOf(elStringValue, enumValues); - } - return null; - } - - /** - * Put the given Enum value into the PersistenceXml. - * - * @param key - - * EclipseLink Key - */ - protected <T extends Enum<T>> void putEnumValue(String key, T newValue) { - this.putEnumValue(key, null, newValue, false); - } - - protected <T extends Enum<T>> void putEnumValue(String key, T newValue, boolean allowDuplicate) { - this.putEnumValue(key, null, newValue, allowDuplicate); - } - - protected <T extends Enum<T>> void putEnumValue(String key, String keySuffix, T newValue, boolean allowDuplicate) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (newValue == null) { - this.getPersistenceUnit().removeProperty(elKey); - } - else { - this.getPersistenceUnit().putProperty(elKey, getEclipseLinkStringValueOf(newValue), allowDuplicate); - } - } - - // ******** Convenience methods ******** - /** - * Put into persistenceUnit properties. - * - * @param key - - * property name - * @param value - - * property value - */ - protected void putProperty(String key, Object value) { - putProperty(key, value, false); - } - - @SuppressWarnings("unchecked") - protected void putProperty(String key, Object value, boolean allowDuplicates) { - String elKey = this.eclipseLinkKeyFor(key); - if (value == null) - this.removeEclipseLinkProperty(elKey); - else if (value.getClass().isEnum()) - this.putEnumValue(elKey, (Enum) value, allowDuplicates); - else - this.putEclipseLinkProperty(elKey, value, allowDuplicates); - } - - private void putEclipseLinkProperty(String key, Object value, boolean allowDuplicates) { - this.getPersistenceUnit().putProperty(key, value.toString(), allowDuplicates); - } - - /** - * Removes a property with the given EclipseLink key. - * - * @param elKey - - * EclipseLink key - */ - private void removeEclipseLinkProperty(String elKey) { - this.getPersistenceUnit().removeProperty(elKey); - } - - /** - * Removes a persistenceUnit property. - * - * @param key - - * property name - * @param value - - * property value - */ - protected void removeProperty(String key, String value) { - String elKey = this.eclipseLinkKeyFor(key); - - this.getPersistenceUnit().removeProperty(elKey, value); - } - - protected Set<Property> getPropertiesSetWithPrefix(String keyPrefix) { - return CollectionTools.set(this.getPersistenceUnit().propertiesWithPrefix(keyPrefix)); - } - - /** - * Extracts the entityName of the specified property name. If the property name - * has no suffix, return an empty string. - */ - protected String getEntityName(Property property) { - return getEntityName(property.getName()); - } - - /** - * Extracts the entityName of the specified string. If the string - * has no suffix, return an empty string. - */ - protected String getEntityName(String propertyName) { - int index = propertyName.lastIndexOf('.'); - if (index == -1) { - return ""; - } - return propertyName.substring(index + 1); - } - - // ****** Static methods ******* - /** - * Returns the EclipseLink string value for the given property value. - */ - public static String getEclipseLinkStringValueOf(Object value) { - - if (value.getClass().isEnum()) { - return (String) ClassTools.staticFieldValue(value.getClass(), value.toString().toUpperCase()); - } - return value.toString(); - } - - /** - * Returns the enum constant of the specified enum type with the specified - * EclipseLink value string. - */ - public static <T extends Enum<T>> T getEnumValueOf(String elStringValue, T[] enumValues) { - for (T enumValue : enumValues) { - if (getEclipseLinkStringValueOf(enumValue).equals(elStringValue)) { - return enumValue; - } - } - return null; - } - - public static Boolean getBooleanValueOf(String elStringValue) { - if (elStringValue == null) { - return null; - } - return Boolean.valueOf(elStringValue); - } - - public static Integer getIntegerValueOf(String elStringValue) { - if (elStringValue == null) { - return null; - } - return Integer.valueOf(elStringValue); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java deleted file mode 100644 index 14078bc7a9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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.JpaProject; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.utility.model.Model; -import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; - -/** - * PersistenceUnitProperties - */ -public interface PersistenceUnitProperties extends Model, PropertyChangeListener -{ - /** - * Method used for identifying the given property. - */ - boolean itemIsProperty(Property item); - - /** - * Returns the property name used for change notification of the given property. - */ - String propertyIdFor(Property property); - - /** - * Return the PersistenceUnit of this Properties. - */ - PersistenceUnit getPersistenceUnit(); - - /** - * Return the JPA project the PersistenceUnit belongs to. - */ - JpaProject getJpaProject(); -}
\ 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/PersistenceUnitPropertyListListener.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitPropertyListListener.java deleted file mode 100644 index 6e744c4dc3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitPropertyListListener.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.Iterator; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.utility.model.Model; -import org.eclipse.jpt.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.listener.ListChangeListener; - -/** - * PersistenceUnitPropertyListListener Notifies the given parent when a change - * occured in JPT PersistenceUnit properties - */ -public class PersistenceUnitPropertyListListener implements ListChangeListener -{ - private PersistenceUnitProperties parent; - - // ********** constructors / initialization ********** - public PersistenceUnitPropertyListListener(PersistenceUnitProperties parent) { - this.parent = parent; - } - - // ********** Behavior ********** - protected boolean add(Property newItem, Model source) { - if (this.model().itemIsProperty(newItem)) { - String propertyName = this.model().propertyIdFor(newItem); - this.model().propertyChanged( - new PropertyChangeEvent(source, propertyName, null, newItem)); - return true; - } - return false; - } - - protected boolean remove(Property item, Model source) { - if (this.model().itemIsProperty(item)) { - String propertyName = this.model().propertyIdFor(item); - this.model().propertyChanged( - new PropertyChangeEvent(source, propertyName, item, null)); // oldItem is the removed property - return true; - } - return false; - } - - // replace - protected Property set(Property newItem, Model source) { - if (this.model().itemIsProperty(newItem)) { - String propertyName = this.model().propertyIdFor(newItem); - this.model().propertyChanged( - new PropertyChangeEvent(source, propertyName, null, newItem)); // oldItem unknown - return newItem; - } - return null; - } - - // ********** ListChangeListener implementation ********** - public void itemsAdded(ListChangeEvent e) { - for (Iterator<Property> stream = this.items(e); stream.hasNext();) { - this.add(stream.next(), e.getSource()); - } - } - - public void itemsRemoved(ListChangeEvent e) { - for (Iterator<Property> stream = this.items(e); stream.hasNext();) { - this.remove(stream.next(), e.getSource()); - } - } - - public void itemsReplaced(ListChangeEvent e) { - // ItemAspectListValueModelAdapter(270) does not provide old value - for (Iterator<Property> newStream = this.items(e); newStream.hasNext();) { - this.set(newStream.next(), e.getSource()); - } - } - - public void itemsMoved(ListChangeEvent e) { - throw new UnsupportedOperationException("source: " + e.getSource() + " - aspect: " + e.getAspectName()); - } - - public void listCleared(ListChangeEvent e) { - throw new UnsupportedOperationException("source: " + e.getSource() + " - aspect: " + e.getAspectName()); - } - - public void listChanged(ListChangeEvent e) { - throw new UnsupportedOperationException("source: " + e.getSource() + " - aspect: " + e.getAspectName()); - } - - // ********** standard methods ********** - @Override - public String toString() { - return this.getClass().getSimpleName() + "( " + this.model().getClass().getSimpleName() + ")"; - } - - // ********** internal methods ********** - private PersistenceUnitProperties model() { - return this.parent; - } - - @SuppressWarnings("unchecked") - private Iterator<Property> items(ListChangeEvent event) { - return (Iterator<Property>) event.items(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheProperties.java deleted file mode 100644 index c06dec92e8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheProperties.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.utility.internal.StringTools; - -/** - * CacheProperties - */ -public class CacheProperties implements Cloneable, Serializable -{ - private String entityName; - - // ********** EclipseLink properties ********** - private CacheType type; - private Integer size; - private Boolean isShared; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public CacheProperties(String entityName) { - this.entityName = entityName; - } - - // ********** behaviors ********** - @Override - public boolean equals(Object o) { - if(o == null) { - return false; - } - CacheProperties cache = (CacheProperties) o; - return ( - (this.type == null ? - cache.type == null : this.type.equals(cache.type)) && - (this.isShared == null ? - cache.isShared == null : this.isShared.equals(cache.isShared)) && - (this.size == null ? - cache.size == null : this.size.equals(cache.size))); - } - - @Override - public synchronized CacheProperties clone() { - try { - return (CacheProperties)super.clone(); - } - catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean isEmpty() { - return (this.type == null) && - (this.size == null) && - (this.isShared == null); - } - - // ********** getter/setter ********** - public String getEntityName() { - return entityName; - } - - public CacheType getType() { - return this.type; - } - - public void setType(CacheType cacheType) { - this.type = cacheType; - } - - public Integer getSize() { - return this.size; - } - - public void setSize(Integer cacheSize) { - this.size = cacheSize; - } - - public Boolean isShared() { - return this.isShared; - } - - public void setShared(Boolean isShared) { - this.isShared = isShared; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - StringTools.buildSimpleToStringOn(this, sb); - sb.append(" ("); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - - public void toString(StringBuilder sb) { - sb.append("type: "); - sb.append(this.type); - sb.append(", size: "); - sb.append(this.size); - sb.append(", isShared: "); - sb.append(this.isShared); - sb.append(", entityName: "); - sb.append(this.entityName); - } -}
\ 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/caching/CacheType.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheType.java deleted file mode 100644 index 0c66da4968..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheType.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * CacheType - */ -public enum CacheType { - soft_weak, - hard_weak, - weak, - soft, - full, - none; - - // EclipseLink value string - public static final String FULL = "Full"; - public static final String HARD_WEAK = "HardWeak"; - public static final String NONE = "NONE"; - public static final String SOFT = "Soft"; - public static final String SOFT_WEAK = "SoftWeak"; - public static final String WEAK = "Weak"; -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java deleted file mode 100644 index 1c4cac45ed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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.ListIterator; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Caching - */ -public interface Caching extends PersistenceUnitProperties -{ - CacheType getDefaultCacheTypeDefault(); - CacheType getCacheTypeDefault(); - void setCacheTypeDefault(CacheType cacheTypeDefault); - static final String CACHE_TYPE_DEFAULT_PROPERTY = "cacheTypeDefaultProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_TYPE_DEFAULT = "eclipselink.cache.type.default"; - static final CacheType DEFAULT_CACHE_TYPE_DEFAULT = CacheType.soft_weak; - - Integer getDefaultCacheSizeDefault(); - Integer getCacheSizeDefault(); - void setCacheSizeDefault(Integer cacheSizeDefault); - static final String CACHE_SIZE_DEFAULT_PROPERTY = "cacheSizeDefaultProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_SIZE_DEFAULT = "eclipselink.cache.size.default"; - static final Integer DEFAULT_CACHE_SIZE_DEFAULT = Integer.valueOf(100); - - Boolean getDefaultSharedCacheDefault(); - Boolean getSharedCacheDefault(); - void setSharedCacheDefault(Boolean sharedCacheDefault); - static final String SHARED_CACHE_DEFAULT_PROPERTY = "sharedCacheDefaultProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_SHARED_DEFAULT = "eclipselink.cache.shared.default"; - static final Boolean DEFAULT_SHARED_CACHE_DEFAULT = Boolean.TRUE; - - - CacheType getDefaultCacheType(); - CacheType getCacheType(String entityName); - void setCacheType(CacheType cacheType, String entityName); - static final String CACHE_TYPE_PROPERTY = "cacheTypeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_TYPE = "eclipselink.cache.type."; - static final CacheType DEFAULT_CACHE_TYPE = CacheType.soft_weak; - - Integer getDefaultCacheSize(); - Integer getCacheSize(String entityName); - void setCacheSize(Integer cacheSize, String entityName); - static final String CACHE_SIZE_PROPERTY = "cacheSizeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_SIZE = "eclipselink.cache.size."; - static final Integer DEFAULT_CACHE_SIZE = Integer.valueOf(100); - - Boolean getDefaultSharedCache(); - Boolean getSharedCache(String entityName); - void setSharedCache(Boolean sharedCache, String entityName); - static final String SHARED_CACHE_PROPERTY = "sharedCacheProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SHARED_CACHE = "eclipselink.cache.shared."; - static final Boolean DEFAULT_SHARED_CACHE = Boolean.TRUE; - - - ListIterator<String> entities(); - int entitiesSize(); - boolean entityExists(String entity); - String addEntity(String entity); - void removeEntity(String entity); - String ENTITIES_LIST_PROPERTY = "entitiesListProperty"; - -} 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 1252760ab1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java +++ /dev/null @@ -1,492 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.HashMap; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * EclipseLinkCaching encapsulates EclipseLink Caching properties. - */ -public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties - implements Caching -{ - // ********** EclipseLink properties ********** - private CacheType cacheTypeDefault; - private Integer cacheSizeDefault; - private Boolean sharedCacheDefault; - - // key = Entity name ; value = Cache properties - private Map<String, CacheProperties> entitiesCacheProperties; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public EclipseLinkCaching(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.entitiesCacheProperties = - new HashMap<String, CacheProperties>(); - 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); - - Set<Property> cacheTypeProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_TYPE); - Set<Property> cacheSizeProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_SIZE); - Set<Property> sharedCacheProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_SHARED_CACHE); - - this.initializeEntitiesCacheType(cacheTypeProperties); - this.initializeEntitiesCacheSize(cacheSizeProperties); - this.initializeEntitiesSharedCache(sharedCacheProperties); - } - - private void initializeEntitiesCacheType(Set<Property> properties) { - for (Property property : properties) { - String entityName = this.getEntityName(property); - CacheType cacheType = getEnumValueOf(property.getValue(), CacheType.values()); - this.setCacheType_(cacheType, entityName); - } - } - - private void initializeEntitiesCacheSize(Set<Property> properties) { - for (Property property : properties) { - String entityName = this.getEntityName(property); - this.setCacheSize_(property, entityName); - } - } - - private void initializeEntitiesSharedCache(Set<Property> properties) { - for (Property property : properties) { - String entityName = this.getEntityName(property); - this.setSharedCache_(property, entityName); - } - } - - // ********** behavior ********** - /** - * 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); - - // Don't need to initialize propertyNames for: - // cacheType, sharedCache, cacheSize - } - - /** - * Method used for identifying the given property. - */ - @Override - public boolean itemIsProperty(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 propertyIdFor(Property property) { - try { - return super.propertyIdFor(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 void propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - if (aspectName.equals(CACHE_TYPE_DEFAULT_PROPERTY)) { - this.cacheTypeDefaultChanged(event); - } - else if (aspectName.equals(CACHE_SIZE_DEFAULT_PROPERTY)) { - this.cacheSizeDefaultChanged(event); - } - else if (aspectName.equals(SHARED_CACHE_DEFAULT_PROPERTY)) { - this.sharedCacheDefaultChanged(event); - } - else if (aspectName.equals(CACHE_TYPE_PROPERTY)) { - this.cacheTypeChanged(event); - } - else if (aspectName.equals(CACHE_SIZE_PROPERTY)) { - this.cacheSizeChanged(event); - } - else if (aspectName.equals(SHARED_CACHE_PROPERTY)) { - this.sharedCacheChanged(event); - } - else { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - // ********** CacheType ********** - public CacheType getCacheType(String entityName) { - CacheProperties cache = this.cachePropertiesOf(entityName); - return (cache == null) ? null : cache.getType(); - } - - public void setCacheType(CacheType newCacheType, String entityName) { - CacheProperties old = this.setCacheType_(newCacheType, entityName); - this.putEnumValue(ECLIPSELINK_CACHE_TYPE, entityName, newCacheType, false); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.cachePropertiesOf(entityName)); - } - - private void cacheTypeChanged(PropertyChangeEvent event) { - Property property = (Property) event.getNewValue(); - // property == null when removed - String entityName = (property == null) ? this.getEntityName((Property) event.getOldValue()) : this.getEntityName(property); - CacheProperties old = this.setCacheType_(property, entityName); - this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(entityName)); - } - - public CacheType getDefaultCacheType() { - return (this.cacheTypeDefault == null) ? DEFAULT_CACHE_TYPE : this.cacheTypeDefault; - } - - // ********** CacheSize ********** - public Integer getCacheSize(String entityName) { - CacheProperties cache = this.cachePropertiesOf(entityName); - return (cache == null) ? null : cache.getSize(); - } - - public void setCacheSize(Integer newCacheSize, String entityName) { - CacheProperties old = this.setCacheSize_(newCacheSize, entityName); - this.putIntegerValue(ECLIPSELINK_CACHE_SIZE + entityName, newCacheSize); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.cachePropertiesOf(entityName)); - } - - private void cacheSizeChanged(PropertyChangeEvent event) { - Property property = (Property) event.getNewValue(); - // property == null when removed - String entityName = (property == null) ? this.getEntityName((Property) event.getOldValue()) : this.getEntityName(property); - CacheProperties old = this.setCacheSize_(property, entityName); - this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(entityName)); - } - - public Integer getDefaultCacheSize() { - return (this.cacheSizeDefault == null) ? DEFAULT_CACHE_SIZE : this.cacheSizeDefault; - } - - // ********** SharedCache ********** - public Boolean getSharedCache(String entityName) { - CacheProperties cache = this.cachePropertiesOf(entityName); - return (cache == null) ? null : cache.isShared(); - } - - public void setSharedCache(Boolean newSharedCache, String entityName) { - CacheProperties old = this.setSharedCache_(newSharedCache, entityName); - this.putBooleanValue(ECLIPSELINK_SHARED_CACHE, entityName, newSharedCache, false); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.cachePropertiesOf(entityName)); - } - - private void sharedCacheChanged(PropertyChangeEvent event) { - String entityName; - Property newProperty = (Property) event.getNewValue(); - // property == null when removed - entityName = (newProperty == null) ? - this.getEntityName((Property) event.getOldValue()) : this.getEntityName(newProperty); - CacheProperties old = this.setSharedCache_(newProperty, entityName); - this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - CacheType newValue = getEnumValueOf(stringValue, CacheType.values()); - CacheType old = this.cacheTypeDefault; - this.cacheTypeDefault = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - Integer old = this.cacheSizeDefault; - this.cacheSizeDefault = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.sharedCacheDefault; - this.sharedCacheDefault = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultSharedCacheDefault() { - return DEFAULT_SHARED_CACHE_DEFAULT; - } - - // ****** CacheProperties ******* - /** - * Convenience method to update the CacheType in entitiesCache map. Returns - * the old value of CacheProperties - */ - private CacheProperties setCacheType_(Property newProperty, String entityName) { - String stringValue = (newProperty == null) ? null : newProperty.getValue(); - CacheType newValue = getEnumValueOf(stringValue, CacheType.values()); - return this.setCacheType_(newValue, entityName); - } - - private CacheProperties setCacheType_(CacheType newValue, String entityName) { - CacheProperties properties = this.cachePropertiesOf(entityName); - CacheProperties old = properties.clone(); - properties.setType(newValue); - this.putEntityCacheProperties(entityName, properties); - return old; - } - - /** - * Convenience method to update the CacheSize in entitiesCache map. Returns - * the old value of CacheProperties - */ - private CacheProperties setCacheSize_(Property newProperty, String entityName) { - String stringValue = (newProperty == null) ? null : newProperty.getValue(); - Integer newValue = getIntegerValueOf(stringValue); - return this.setCacheSize_(newValue, entityName); - } - - private CacheProperties setCacheSize_(Integer newValue, String entityName) { - CacheProperties properties = this.cachePropertiesOf(entityName); - CacheProperties old = properties.clone(); - properties.setSize(newValue); - this.putEntityCacheProperties(entityName, properties); - return old; - } - - /** - * Convenience method to update the SharedCache in entitiesCacheProperties map. - * Returns the old value of CacheProperties - */ - private CacheProperties setSharedCache_(Property newProperty, String entityName) { - String newValue = (newProperty == null) ? null : newProperty.getValue(); - return this.setSharedCache_(newValue, entityName); - } - - private CacheProperties setSharedCache_(String newString, String entityName) { - Boolean newValue = getBooleanValueOf(newString); - return setSharedCache_(newValue, entityName); - } - - private CacheProperties setSharedCache_(Boolean newValue, String entityName) { - CacheProperties properties = this.cachePropertiesOf(entityName); - CacheProperties old = properties.clone(); - properties.setShared(newValue); - this.putEntityCacheProperties(entityName, properties); - return old; - } - - /** - * Returns the CacheProperties of the Entity with the given name. - */ - private CacheProperties cachePropertiesOf(String entityName) { - CacheProperties properties = this.entitiesCacheProperties.get(entityName); - if (properties == null) { - properties = new CacheProperties(entityName); - } - return properties; - } - - /** - * Set all CacheProperties to default. - */ - private void clearCacheProperties(String entityName) { - this.setCacheType(null, entityName); - this.setCacheSize(null, entityName); - this.setSharedCache(null, entityName); - } - - // ****** convenience methods ******* - - /** - * Put the given Entity CacheProperties in this entitiesCacheProperties map. - * @param entityName - Entity name. The entity may be a new or an existing entity. - * @param properties - Entity CacheProperties - */ - private void putEntityCacheProperties(String entityName, CacheProperties properties) { - this.addOrReplacePropertiesForEntity(entityName, properties); - } - - // ****** entities list ******* - - public ListIterator<String> entities() { - return CollectionTools.list(this.entitiesCacheProperties.keySet()).listIterator(); - } - - public int entitiesSize() { - return this.entitiesCacheProperties.size(); - } - - /* - * Verifies if this entitiesCacheProperties map contains the given Entity. - */ - public boolean entityExists(String entity) { - return this.entitiesCacheProperties.containsKey(entity); - } - - public String addEntity(String entity) { - if (entityExists(entity)) { - throw new IllegalStateException("Entity " + entity + " already exist."); - } - return this.addOrReplacePropertiesForEntity(entity, new CacheProperties(entity)); - } - - /** - * Adds or replaces the given Entity CacheProperties in this - * entitiesCacheProperties map. - * If the specified Entity exists and the given CacheProperties is empty - * (i.e. all properties are null) the mapping will be removed from the map. - * - * @param entity - Entity name - * @param properties - Entity CacheProperties - * @return Entity name added - */ - private String addOrReplacePropertiesForEntity(String entity, CacheProperties properties) { - if (this.entityExists(entity)) { - this.replaceEntity_(entity, properties); - return null; - } - this.entitiesCacheProperties.put(entity, properties); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - return entity; - } - - /** - * Replaces the given Entity CacheProperties in this - * entitiesCacheProperties map. - * If the given Entity CacheProperties is empty (i.e. all properties are null) the - * mapping will be removed from the map. - * @param entity - Entity name - * @param properties - Entity CacheProperties - * @return Entity name replaced - */ - private CacheProperties replaceEntity_(String entity, CacheProperties properties) { - CacheProperties old = this.entitiesCacheProperties.get(entity); - if (properties.isEmpty()) { - this.entitiesCacheProperties.remove(entity); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - } - else { - this.entitiesCacheProperties.put(entity, properties); - } - return old; - } - - public void removeEntity(String entity) { - if ( ! this.entityExists(entity)) { - return; - } - this.clearCacheProperties(entity); - this.entitiesCacheProperties.remove(entity); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/BatchWriting.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/BatchWriting.java deleted file mode 100644 index 5494a1a31f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/BatchWriting.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * BatchWriting - */ -public enum BatchWriting { - none, - jdbc, - buffered, - oracle_jdbc; - - // EclipseLink value string - static final String NONE = "None"; - static final String JDBC = "JDBC"; - static final String BUFFERED = "Buffered"; - static final String ORACLE_JDBC = "Oracle-JDBC"; -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java deleted file mode 100644 index d53e6028f2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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 org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Connection - */ -public interface Connection extends PersistenceUnitProperties -{ - PersistenceUnitTransactionType getDefaultTransactionType(); - PersistenceUnitTransactionType getTransactionType(); - void setTransactionType(PersistenceUnitTransactionType newTransactionType); - // PersistenceUnit property - static final String TRANSACTION_TYPE_PROPERTY = "transactionTypeProperty"; - static final PersistenceUnitTransactionType DEFAULT_TRANSACTION_TYPE = PersistenceUnitTransactionType.JTA; - - String getDefaultJtaDataSource(); - String getJtaDataSource(); - void setJtaDataSource(String newJtaDataSource); - // PersistenceUnit property - static final String JTA_DATA_SOURCE_PROPERTY = "jtaDataSourceProperty"; - static final String DEFAULT_JTA_DATA_SOURCE = ""; - - String getDefaultNonJtaDataSource(); - String getNonJtaDataSource(); - void setNonJtaDataSource(String newNonJtaDataSource); - // PersistenceUnit property - static final String NON_JTA_DATA_SOURCE_PROPERTY = "nonJtaDataSourceProperty"; - static final String DEFAULT_NON_JTA_DATA_SOURCE = ""; - - Boolean getDefaultNativeSql(); - Boolean getNativeSql(); - void setNativeSql(Boolean newNativeSql); - static final String NATIVE_SQL_PROPERTY = "nativeSqlProperty"; - // EclipseLink key string - static final String ECLIPSELINK_NATIVE_SQL = "eclipselink.jdbc.native-sql"; - static final Boolean DEFAULT_NATIVE_SQL = Boolean.FALSE; - - BatchWriting getDefaultBatchWriting(); - BatchWriting getBatchWriting(); - void setBatchWriting(BatchWriting newBatchWriting); - static final String BATCH_WRITING_PROPERTY = "batchWritingProperty"; - // EclipseLink key string - static final String ECLIPSELINK_BATCH_WRITING = "eclipselink.jdbc.batch-writing"; - static final BatchWriting DEFAULT_BATCH_WRITING = BatchWriting.none; - - Boolean getDefaultCacheStatements(); - Boolean getCacheStatements(); - void setCacheStatements(Boolean newCacheStatements); - static final String CACHE_STATEMENTS_PROPERTY = "cacheStatementsProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_STATEMENTS = "eclipselink.jdbc.cache-statements"; - static final Boolean DEFAULT_CACHE_STATEMENTS = Boolean.FALSE; - - Integer getDefaultCacheStatementsSize(); - Integer getCacheStatementsSize(); - void setCacheStatementsSize(Integer newCacheStatementsSize); - static final String CACHE_STATEMENTS_SIZE_PROPERTY = "cacheStatementsSizeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_STATEMENTS_SIZE = "eclipselink.jdbc.cache-statements.size"; - static final Integer DEFAULT_CACHE_STATEMENTS_SIZE = 50; - - String getDefaultDriver(); - String getDriver(); - void setDriver(String newDriver); - static final String DRIVER_PROPERTY = "driverProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DRIVER = "eclipselink.jdbc.driver"; - static final String DEFAULT_DRIVER = ""; - - String getDefaultUrl(); - String getUrl(); - void setUrl(String newUrl); - static final String URL_PROPERTY = "urlProperty"; - // EclipseLink key string - static final String ECLIPSELINK_URL = "eclipselink.jdbc.url"; - static final String DEFAULT_URL = ""; - - String getDefaultUser(); - String getUser(); - void setUser(String newUser); - static final String USER_PROPERTY = "userProperty"; - // EclipseLink key string - static final String ECLIPSELINK_USER = "eclipselink.jdbc.user"; - static final String DEFAULT_USER = ""; - - String getDefaultPassword(); - String getPassword(); - void setPassword(String newPassword); - static final String PASSWORD_PROPERTY = "passwordProperty"; - // EclipseLink key string - static final String ECLIPSELINK_PASSWORD = "eclipselink.jdbc.password"; - static final String DEFAULT_PASSWORD = ""; - - Boolean getDefaultBindParameters(); - Boolean getBindParameters(); - void setBindParameters(Boolean newBindParameters); - static final String BIND_PARAMETERS_PROPERTY = "bindParametersProperty"; - // EclipseLink key string - static final String ECLIPSELINK_BIND_PARAMETERS = "eclipselink.jdbc.bind-parameters"; - static final Boolean DEFAULT_BIND_PARAMETERS = Boolean.TRUE; - - Boolean getDefaultReadConnectionsShared(); - Boolean getReadConnectionsShared(); - void setReadConnectionsShared(Boolean newReadConnectionsShared); - static final String READ_CONNECTIONS_SHARED_PROPERTY = "readConnectionsSharedProperty"; - // EclipseLink key string - static final String ECLIPSELINK_READ_CONNECTIONS_SHARED = "eclipselink.jdbc.read-connections.shared"; - static final Boolean DEFAULT_READ_CONNECTIONS_SHARED = Boolean.FALSE; - - Integer getDefaultReadConnectionsMin(); - Integer getReadConnectionsMin(); - void setReadConnectionsMin(Integer newReadConnectionsMin); - static final String READ_CONNECTIONS_MIN_PROPERTY = "readConnectionsMinProperty"; - // EclipseLink key string - static final String ECLIPSELINK_READ_CONNECTIONS_MIN = "eclipselink.jdbc.read-connections.min"; - static final Integer DEFAULT_READ_CONNECTIONS_MIN = 2; - - Integer getDefaultReadConnectionsMax(); - Integer getReadConnectionsMax(); - void setReadConnectionsMax(Integer newReadConnectionsMax); - static final String READ_CONNECTIONS_MAX_PROPERTY = "readConnectionsMaxProperty"; - // EclipseLink key string - static final String ECLIPSELINK_READ_CONNECTIONS_MAX = "eclipselink.jdbc.read-connections.max"; - static final Integer DEFAULT_READ_CONNECTIONS_MAX = 2; - - Integer getDefaultWriteConnectionsMin(); - Integer getWriteConnectionsMin(); - void setWriteConnectionsMin(Integer newWriteConnectionsMin); - static final String WRITE_CONNECTIONS_MIN_PROPERTY = "writeConnectionsMinProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WRITE_CONNECTIONS_MIN = "eclipselink.jdbc.write-connections.min"; - static final Integer DEFAULT_WRITE_CONNECTIONS_MIN = 5; - - Integer getDefaultWriteConnectionsMax(); - Integer getWriteConnectionsMax(); - void setWriteConnectionsMax(Integer newWriteConnectionsMax); - static final String WRITE_CONNECTIONS_MAX_PROPERTY = "writeConnectionsMaxProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WRITE_CONNECTIONS_MAX = "eclipselink.jdbc.write-connections.max"; - static final Integer DEFAULT_WRITE_CONNECTIONS_MAX = 10; -} 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 e7c686e209..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java +++ /dev/null @@ -1,655 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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.core.context.persistence.PersistenceUnitTransactionType; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * EclipseLinkConnection - */ -public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties - implements Connection -{ - // ********** PersistenceUnit properties ********** - private PersistenceUnitTransactionType transactionType; - private String jtaDataSource; - private String nonJtaDataSource; - - // ********** EclipseLink properties ********** - private BatchWriting batchWriting; - private Boolean nativeSql; - private Boolean cacheStatements; - private Integer cacheStatementsSize; - private String driver; - private String url; - private String user; - private 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, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.transactionType = - this.getPersistenceUnit().getSpecifiedTransactionType(); - this.jtaDataSource = - this.getPersistenceUnit().getJtaDataSource(); - this.nonJtaDataSource = - this.getPersistenceUnit().getNonJtaDataSource(); - 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.driver = - this.getStringValue(ECLIPSELINK_DRIVER); - this.url = - this.getStringValue(ECLIPSELINK_URL); - this.user = - this.getStringValue(ECLIPSELINK_USER); - this.password = - this.getStringValue(ECLIPSELINK_PASSWORD); - 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); - - } - - /** - * Initialize and add listeners to the persistence unit. - */ - @Override - protected void initialize(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super.initialize(parent, propertyListAdapter); - - this.getPersistenceUnit().addPropertyChangeListener( - PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY, - this.buildTransactionTypeChangeListener()); - this.getPersistenceUnit().addPropertyChangeListener( - PersistenceUnit.JTA_DATA_SOURCE_PROPERTY, - this.buildJtaDataSourceChangeListener()); - this.getPersistenceUnit().addPropertyChangeListener( - PersistenceUnit.NON_JTA_DATA_SOURCE_PROPERTY, - this.buildNonJtaDataSourceChangeListener()); - } - - // ********** behavior ********** - /** - * 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_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_DRIVER, - DRIVER_PROPERTY); - propertyNames.put( - ECLIPSELINK_URL, - URL_PROPERTY); - propertyNames.put( - ECLIPSELINK_USER, - USER_PROPERTY); - propertyNames.put( - ECLIPSELINK_PASSWORD, - PASSWORD_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); - } - - public void propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - if (aspectName.equals(NATIVE_SQL_PROPERTY)) { - this.nativeSqlChanged(event); - } - else if (aspectName.equals(BATCH_WRITING_PROPERTY)) { - this.batchWritingChanged(event); - } - else if (aspectName.equals(CACHE_STATEMENTS_PROPERTY)) { - this.cacheStatementsChanged(event); - } - else if (aspectName.equals(DRIVER_PROPERTY)) { - this.driverChanged(event); - } - else if (aspectName.equals(URL_PROPERTY)) { - this.urlChanged(event); - } - else if (aspectName.equals(USER_PROPERTY)) { - this.userChanged(event); - } - else if (aspectName.equals(PASSWORD_PROPERTY)) { - this.passwordChanged(event); - } - else if (aspectName.equals(BIND_PARAMETERS_PROPERTY)) { - this.bindParametersChanged(event); - } - else if (aspectName.equals(READ_CONNECTIONS_SHARED_PROPERTY)) { - this.readConnectionsSharedChanged(event); - } - else if (aspectName.equals(CACHE_STATEMENTS_SIZE_PROPERTY)) { - this.cacheStatementsSizeChanged(event); - } - else if (aspectName.equals(READ_CONNECTIONS_MIN_PROPERTY)) { - this.readConnectionsMinChanged(event); - } - else if (aspectName.equals(READ_CONNECTIONS_MAX_PROPERTY)) { - this.readConnectionsMaxChanged(event); - } - else if (aspectName.equals(WRITE_CONNECTIONS_MIN_PROPERTY)) { - this.writeConnectionsMinChanged(event); - } - else if (aspectName.equals(WRITE_CONNECTIONS_MAX_PROPERTY)) { - this.writeConnectionsMaxChanged(event); - } - } - - // ********** TransactionType ********** - - public PersistenceUnitTransactionType getTransactionType() { - return this.transactionType; - } - - public void setTransactionType(PersistenceUnitTransactionType newTransactionType) { - PersistenceUnitTransactionType old = this.transactionType; - this.transactionType = newTransactionType; - - this.getPersistenceUnit().setSpecifiedTransactionType( newTransactionType); - this.firePropertyChanged(TRANSACTION_TYPE_PROPERTY, old, newTransactionType); - } - - private void transactionTypeChanged(PropertyChangeEvent event) { - PersistenceUnitTransactionType newValue = (PersistenceUnitTransactionType) event.getNewValue(); - PersistenceUnitTransactionType old = this.transactionType; - this.transactionType = newValue; - this.firePropertyChanged(TRANSACTION_TYPE_PROPERTY, old, newValue); - } - - public PersistenceUnitTransactionType getDefaultTransactionType() { - return DEFAULT_TRANSACTION_TYPE; - } - - protected PropertyChangeListener buildTransactionTypeChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - EclipseLinkConnection.this.transactionTypeChanged(event); - } - }; - } - - // ********** JtaDataSource ********** - - public String getJtaDataSource() { - return this.jtaDataSource; - } - - public void setJtaDataSource(String newJtaDataSource) { - String old = this.jtaDataSource; - this.jtaDataSource = newJtaDataSource; - - this.getPersistenceUnit().setJtaDataSource( newJtaDataSource); - this.firePropertyChanged(JTA_DATA_SOURCE_PROPERTY, old, newJtaDataSource); - } - - private void jtaDataSourceChanged(PropertyChangeEvent event) { - String newValue = (String) event.getNewValue(); - String old = this.jtaDataSource; - this.jtaDataSource = newValue; - this.firePropertyChanged(JTA_DATA_SOURCE_PROPERTY, old, newValue); - } - - public String getDefaultJtaDataSource() { - return DEFAULT_JTA_DATA_SOURCE; - } - - protected PropertyChangeListener buildJtaDataSourceChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - EclipseLinkConnection.this.jtaDataSourceChanged(event); - } - }; - } - - // ********** NonJtaDataSource ********** - - public String getNonJtaDataSource() { - return this.nonJtaDataSource; - } - - public void setNonJtaDataSource(String newNonJtaDataSource) { - String old = this.nonJtaDataSource; - this.nonJtaDataSource = newNonJtaDataSource; - - this.getPersistenceUnit().setNonJtaDataSource( newNonJtaDataSource); - this.firePropertyChanged(NON_JTA_DATA_SOURCE_PROPERTY, old, newNonJtaDataSource); - } - - private void nonJtaDataSourceChanged(PropertyChangeEvent event) { - String newValue = (String) event.getNewValue(); - String old = this.nonJtaDataSource; - this.nonJtaDataSource = newValue; - this.firePropertyChanged(NON_JTA_DATA_SOURCE_PROPERTY, old, newValue); - } - - public String getDefaultNonJtaDataSource() { - return DEFAULT_NON_JTA_DATA_SOURCE; - } - - protected PropertyChangeListener buildNonJtaDataSourceChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - EclipseLinkConnection.this.nonJtaDataSourceChanged(event); - } - }; - } - - // ********** NativeSql ********** - public Boolean getNativeSql() { - return this.nativeSql; - } - - public void setNativeSql(Boolean newNativeSql) { - Boolean old = this.nativeSql; - this.nativeSql = newNativeSql; - this.putProperty(NATIVE_SQL_PROPERTY, newNativeSql); - this.firePropertyChanged(NATIVE_SQL_PROPERTY, old, newNativeSql); - } - - private void nativeSqlChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.nativeSql; - this.nativeSql = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultNativeSql() { - return DEFAULT_NATIVE_SQL; - } - - // ********** BatchWriting ********** - - public BatchWriting getBatchWriting() { - return this.batchWriting; - } - - public void setBatchWriting(BatchWriting newBatchWriting) { - BatchWriting old = this.batchWriting; - this.batchWriting = newBatchWriting; - this.putProperty(BATCH_WRITING_PROPERTY, newBatchWriting); - this.firePropertyChanged(BATCH_WRITING_PROPERTY, old, newBatchWriting); - } - - private void batchWritingChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - BatchWriting newValue = getEnumValueOf(stringValue, BatchWriting.values()); - BatchWriting old = this.batchWriting; - this.batchWriting = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public BatchWriting getDefaultBatchWriting() { - return DEFAULT_BATCH_WRITING; - } - - // ********** CacheStatements ********** - public Boolean getCacheStatements() { - return this.cacheStatements; - } - - public void setCacheStatements(Boolean newCacheStatements) { - Boolean old = this.cacheStatements; - this.cacheStatements = newCacheStatements; - this.putProperty(CACHE_STATEMENTS_PROPERTY, newCacheStatements); - this.firePropertyChanged(CACHE_STATEMENTS_PROPERTY, old, newCacheStatements); - } - - private void cacheStatementsChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.cacheStatements; - this.cacheStatements = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultCacheStatements() { - return DEFAULT_CACHE_STATEMENTS; - } - - // ********** CacheStatementsSize ********** - public Integer getCacheStatementsSize() { - return this.cacheStatementsSize; - } - - public void setCacheStatementsSize(Integer newCacheStatementsSize) { - 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.cacheStatementsSize; - this.cacheStatementsSize = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultCacheStatementsSize() { - return DEFAULT_CACHE_STATEMENTS_SIZE; - } - - // ********** Driver ********** - public String getDriver() { - return this.driver; - } - - public void setDriver(String newDriver) { - String old = this.driver; - this.driver = newDriver; - this.putProperty(DRIVER_PROPERTY, newDriver); - this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver); - } - - private void driverChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.driver; - this.driver = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultDriver() { - return DEFAULT_DRIVER; - } - - // ********** URL ********** - public String getUrl() { - return this.url; - } - - public void setUrl(String newUrl) { - String old = this.url; - this.url = newUrl; - this.putProperty(URL_PROPERTY, newUrl); - this.firePropertyChanged(URL_PROPERTY, old, newUrl); - } - - private void urlChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.url; - this.url = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultUrl() { - return DEFAULT_URL; - } - - // ********** User ********** - public String getUser() { - return this.user; - } - - public void setUser(String newUser) { - String old = this.user; - this.user = newUser; - this.putProperty(USER_PROPERTY, newUser); - this.firePropertyChanged(USER_PROPERTY, old, newUser); - } - - private void userChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.user; - this.user = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultUser() { - return DEFAULT_USER; - } - - // ********** Password ********** - public String getPassword() { - return this.password; - } - - public void setPassword(String newPassword) { - String old = this.password; - this.password = newPassword; - this.putProperty(PASSWORD_PROPERTY, newPassword); - this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword); - } - - private void passwordChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.password; - this.password = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultPassword() { - return DEFAULT_PASSWORD; - } - - // ********** BindParameters ********** - public Boolean getBindParameters() { - return this.bindParameters; - } - - public void setBindParameters(Boolean newBindParameters) { - Boolean old = this.bindParameters; - this.bindParameters = newBindParameters; - this.putProperty(BIND_PARAMETERS_PROPERTY, newBindParameters); - this.firePropertyChanged(BIND_PARAMETERS_PROPERTY, old, newBindParameters); - } - - private void bindParametersChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.bindParameters; - this.bindParameters = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultBindParameters() { - return DEFAULT_BIND_PARAMETERS; - } - - // ********** ReadConnectionsShared ********** - public Boolean getReadConnectionsShared() { - return this.readConnectionsShared; - } - - public void setReadConnectionsShared(Boolean newReadConnectionsShared) { - 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.readConnectionsShared; - this.readConnectionsShared = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultReadConnectionsShared() { - return DEFAULT_READ_CONNECTIONS_SHARED; - } - - // ********** ReadConnectionsMin ********** - public Integer getReadConnectionsMin() { - return this.readConnectionsMin; - } - - public void setReadConnectionsMin(Integer newReadConnectionsMin) { - 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.readConnectionsMin; - this.readConnectionsMin = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultReadConnectionsMin() { - return DEFAULT_READ_CONNECTIONS_MIN; - } - - // ********** ReadConnectionsMax ********** - public Integer getReadConnectionsMax() { - return this.readConnectionsMax; - } - - public void setReadConnectionsMax(Integer newReadConnectionsMax) { - 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.readConnectionsMax; - this.readConnectionsMax = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultReadConnectionsMax() { - return DEFAULT_READ_CONNECTIONS_MAX; - } - - // ********** WriteConnectionsMin ********** - public Integer getWriteConnectionsMin() { - return this.writeConnectionsMin; - } - - public void setWriteConnectionsMin(Integer newWriteConnectionsMin) { - 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.writeConnectionsMin; - this.writeConnectionsMin = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultWriteConnectionsMin() { - return DEFAULT_WRITE_CONNECTIONS_MIN; - } - - // ********** WriteConnectionsMax ********** - public Integer getWriteConnectionsMax() { - return this.writeConnectionsMax; - } - - public void setWriteConnectionsMax(Integer newWriteConnectionsMax) { - 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.writeConnectionsMax; - this.writeConnectionsMax = newValue; - this.firePropertyChanged(event.getAspectName(), 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/Customization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java deleted file mode 100644 index 238f411d7f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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.ListIterator; -import org.eclipse.jpt.core.context.persistence.ClassRef; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Customization - */ -public interface Customization extends PersistenceUnitProperties -{ - Boolean getDefaultThrowExceptions(); - Boolean getThrowExceptions(); - void setThrowExceptions(Boolean newThrowExceptions); - static final String THROW_EXCEPTIONS_PROPERTY = "throwExceptionsProperty"; - // EclipseLink key string - static final String ECLIPSELINK_THROW_EXCEPTIONS = "eclipselink.orm.throw.exceptions"; - static final Boolean DEFAULT_THROW_EXCEPTIONS = Boolean.TRUE; - - Weaving getDefaultWeaving(); - Weaving getWeaving(); - void setWeaving(Weaving newWeaving); - static final String WEAVING_PROPERTY = "weavingProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING = "eclipselink.weaving"; - static final Weaving DEFAULT_WEAVING = Weaving.true_; - - Boolean getDefaultWeavingLazy(); - Boolean getWeavingLazy(); - void setWeavingLazy(Boolean newWeavingLazy); - static final String WEAVING_LAZY_PROPERTY = "weavingLazyProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_LAZY = "eclipselink.weaving.lazy"; - static final Boolean DEFAULT_WEAVING_LAZY = Boolean.TRUE; - - Boolean getDefaultWeavingChangeTracking(); - Boolean getWeavingChangeTracking(); - void setWeavingChangeTracking(Boolean newWeavingChangeTracking); - static final String WEAVING_CHANGE_TRACKING_PROPERTY = "weavingChangeTrackingProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_CHANGE_TRACKING = "eclipselink.weaving.changetracking"; - static final Boolean DEFAULT_WEAVING_CHANGE_TRACKING = Boolean.TRUE; - - Boolean getDefaultWeavingFetchGroups(); - Boolean getWeavingFetchGroups(); - void setWeavingFetchGroups(Boolean newWeavingFetchGroups); - static final String WEAVING_FETCH_GROUPS_PROPERTY = "weavingFetchGroupsProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_FETCH_GROUPS = "eclipselink.weaving.fetchgroups"; - static final Boolean DEFAULT_WEAVING_FETCH_GROUPS = Boolean.TRUE; - - Boolean getDefaultWeavingInternal(); - Boolean getWeavingInternal(); - void setWeavingInternal(Boolean newWeavingInternal); - static final String WEAVING_INTERNAL_PROPERTY = "weavingInternalProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_INTERNAL = "eclipselink.weaving.internal"; - static final Boolean DEFAULT_WEAVING_INTERNAL = Boolean.TRUE; - - Boolean getDefaultWeavingEager(); - Boolean getWeavingEager(); - void setWeavingEager(Boolean newWeavingEager); - static final String WEAVING_EAGER_PROPERTY = "weavingEagerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_EAGER = "eclipselink.weaving.eager"; - static final Boolean DEFAULT_WEAVING_EAGER = Boolean.FALSE; - - String getDefaultDescriptorCustomizer(); - String getDescriptorCustomizer(String entityName); - void setDescriptorCustomizer(String newDescriptorCustomizer, String entityName); - static final String DESCRIPTOR_CUSTOMIZER_PROPERTY = "descriptorCustomizerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DESCRIPTOR_CUSTOMIZER = "eclipselink.descriptor.customizer."; - static final String DEFAULT_DESCRIPTOR_CUSTOMIZER = null; // no default - - ListIterator<ClassRef> sessionCustomizers(); - int sessionCustomizersSize(); - boolean sessionCustomizerExists(String sessionCustomizerClassName); - ClassRef addSessionCustomizer(String newSessionCustomizerClassName); - void removeSessionCustomizer(ClassRef classRef); - static final String SESSION_CUSTOMIZER_LIST_PROPERTY = "sessionCustomizerListProperty"; - static final String SESSION_CUSTOMIZER_PROPERTY = "sessionCustomizerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_CUSTOMIZER = "eclipselink.session.customizer"; - - ListIterator<String> entities(); - int entitiesSize(); - boolean entityExists(String entity); - String addEntity(String entity); - void removeEntity(String entity); - static final String ENTITIES_LIST_PROPERTY = "entitiesListProperty"; - - String getDefaultProfiler(); - String getProfiler(); - void setProfiler(String newProfiler); - void setProfiler(Profiler newProfiler); - static final String PROFILER_PROPERTY = "profilerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_PROFILER = "eclipselink.profiler"; - static final String DEFAULT_PROFILER = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(Profiler.no_profiler); - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/CustomizerProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/CustomizerProperties.java deleted file mode 100644 index def82d949d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/CustomizerProperties.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.utility.internal.StringTools; - -/** - * CustomizerProperties - */ -public class CustomizerProperties implements Cloneable, Serializable -{ - private String entityName; - - // ********** EclipseLink properties ********** - private String className; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public CustomizerProperties(String entityName) { - this.entityName = entityName; - } - - // ********** behaviors ********** - @Override - public boolean equals(Object o) { - if(o == null) { - return false; - } - CustomizerProperties customizer = (CustomizerProperties) o; - return ( - (this.className == null ? - customizer.className == null : this.className.equals(customizer.className))); - } - - @Override - public synchronized CustomizerProperties clone() { - try { - return (CustomizerProperties)super.clone(); - } - catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean isEmpty() { - return this.className == null; - } - - // ********** getter/setter ********** - public String getEntityName() { - return this.entityName; - } - - public String getClassName() { - return this.className; - } - - public void setClassName(String newClassName) { - this.className = newClassName; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - StringTools.buildSimpleToStringOn(this, sb); - sb.append(" ("); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - - public void toString(StringBuilder sb) { - sb.append(" class: "); - sb.append(this.className); - sb.append(", entityName: "); - sb.append(this.entityName); - } -}
\ 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/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 6a7ca4c363..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java +++ /dev/null @@ -1,696 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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.HashMap; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.context.persistence.ClassRef; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * 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 ArrayList<ClassRef> sessionCustomizers; - private String profiler; // storing EclipseLinkStringValue since value can be Profiler or custom class - - // key = Entity name ; value = Customizer properties - private Map<String, CustomizerProperties> entitiesCustomizerProperties; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public EclipseLinkCustomization(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.entitiesCustomizerProperties = - new HashMap<String, CustomizerProperties>(); - - 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.initializeSessionCustomizersFromPersistenceUnit(); - - Set<Property> properties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER); - this.initializeEntitiesCustomizerClass(properties); - - this.profiler = this.getProfilerProtertyValue(); - } - - private void initializeSessionCustomizersFromPersistenceUnit() { - Set<Property> properties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_SESSION_CUSTOMIZER); - - this.sessionCustomizers = new ArrayList<ClassRef>(properties.size()); - this.initializeSessionCustomizersWith(properties); - } - - private void initializeSessionCustomizersWith(Set<Property> properties) { - for (Property property : properties) { - String className = property.getValue(); - try { - IType sessionCustomizerClass = this.getJpaProject().getJavaProject().findType(className); - if(sessionCustomizerClass == null) { - throw new RuntimeException("could not find: \"" + className + "\" in project's classpath"); - } - ClassRef classRef = - this.getJpaProject().getJpaPlatform().getJpaFactory().buildClassRef( - this.getPersistenceUnit(), sessionCustomizerClass.getFullyQualifiedName()); - this.sessionCustomizers.add(classRef); - } - catch (Exception e) { - JptEclipseLinkCorePlugin.log(e); - } - } - } - - private void initializeEntitiesCustomizerClass(Set<Property> properties) { - for (Property property : properties) { - String entityName = this.getEntityName(property); - this.setCustomizerClass_(property, entityName); - } - } - - /** - * Gets the Profiler property from the persistence unit. - */ - private String getProfilerProtertyValue() { - - Profiler standardProfiler = this.getEnumValue(ECLIPSELINK_PROFILER, Profiler.values()); - if( ! this.getPersistenceUnit().containsProperty(ECLIPSELINK_PROFILER)) { - return null; // no property found - } - else if(standardProfiler == null) { - return this.getStringValue(ECLIPSELINK_PROFILER); // custom profiler - } - else { - return getEclipseLinkStringValueOf(standardProfiler); // a Profiler - } - } - - // ********** behavior ********** - /** - * 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_SESSION_CUSTOMIZER, - SESSION_CUSTOMIZER_PROPERTY); - propertyNames.put( - ECLIPSELINK_PROFILER, - PROFILER_PROPERTY); - - // Don't need to initialize propertyNames for: - // descriptorCustomizerProperty - } - - /** - * Method used for identifying the given property. - */ - @Override - public boolean itemIsProperty(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 propertyIdFor(Property property) { - try { - return super.propertyIdFor(property); - } - catch (IllegalArgumentException e) { - if (property.getName().startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - return DESCRIPTOR_CUSTOMIZER_PROPERTY; - } - } - throw new IllegalArgumentException("Illegal property: " + property.toString()); - } - - public void propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - if (aspectName.equals(THROW_EXCEPTIONS_PROPERTY)) { - this.throwExceptionsChanged(event); - } - else if (aspectName.equals(WEAVING_PROPERTY)) { - this.weavingChanged(event); - } - else if (aspectName.equals(WEAVING_LAZY_PROPERTY)) { - this.weavingLazyChanged(event); - } - else if (aspectName.equals(WEAVING_CHANGE_TRACKING_PROPERTY)) { - this.weavingChangeTrackingChanged(event); - } - else if (aspectName.equals(WEAVING_FETCH_GROUPS_PROPERTY)) { - this.weavingFetchGroupsChanged(event); - } - else if (aspectName.equals(WEAVING_INTERNAL_PROPERTY)) { - this.weavingInternalChanged(event); - } - else if (aspectName.equals(WEAVING_EAGER_PROPERTY)) { - this.weavingEagerChanged(event); - } - else if (aspectName.equals(SESSION_CUSTOMIZER_PROPERTY)) { - this.sessionCustomizersChanged(event); - } - else if (aspectName.equals(DESCRIPTOR_CUSTOMIZER_PROPERTY)) { - this.descriptorCustomizerChanged(event); - } - else if (aspectName.equals(PROFILER_PROPERTY)) { - this.profilerChanged(event); - } - else { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - - // ********** 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.throwExceptions; - this.throwExceptions = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingLazy; - this.weavingLazy = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingChangeTracking; - this.weavingChangeTracking = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingFetchGroups; - this.weavingFetchGroups = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingInternal; - this.weavingInternal = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingEager; - this.weavingEager = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultWeavingEager() { - return DEFAULT_WEAVING_EAGER; - } - - // ********** SessionCustomizers ********** - public ListIterator<ClassRef> sessionCustomizers(){ - return new CloneListIterator<ClassRef>(this.sessionCustomizers); - } - - public int sessionCustomizersSize(){ - return this.sessionCustomizers.size(); - } - - public boolean sessionCustomizerExists(String sessionCustomizerClassName) { - - for (ClassRef sessionCustomizer : this.sessionCustomizers) { - if(sessionCustomizer.getClassName().equals(sessionCustomizerClassName)) { - return true; - } - } - return false; - } - - public ClassRef addSessionCustomizer(String newSessionCustomizerClassName){ - - if( ! this.sessionCustomizerExists(newSessionCustomizerClassName)) { - ClassRef classRef = - this.getJpaProject().getJpaPlatform().getJpaFactory().buildClassRef( - this.getPersistenceUnit(), newSessionCustomizerClassName); - this.sessionCustomizers.add(classRef); - this.putProperty(SESSION_CUSTOMIZER_PROPERTY, classRef.getClassName(), true); - this.fireListChanged(SESSION_CUSTOMIZER_LIST_PROPERTY); - return classRef; - } - return null; - } - - public void removeSessionCustomizer(ClassRef classRef){ - - if(this.removeSessionCustomizer(classRef.getClassName()) != null) { - this.removeProperty(SESSION_CUSTOMIZER_PROPERTY, classRef.getClassName()); - this.fireListChanged(SESSION_CUSTOMIZER_LIST_PROPERTY); - } - } - - private ClassRef removeSessionCustomizer(String sessionCustomizerClassName){ - - for ( ListIterator<ClassRef> i = this.sessionCustomizers(); i.hasNext();) { - ClassRef classRef = i.next(); - if(classRef.getClassName().equals(sessionCustomizerClassName)) { - this.sessionCustomizers.remove(classRef); - return classRef; - } - } - return null; - } - - private void sessionCustomizersChanged(PropertyChangeEvent event) { - - this.initializeSessionCustomizersFromPersistenceUnit(); - this.fireListChanged(SESSION_CUSTOMIZER_LIST_PROPERTY); - } - - // ********** 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Weaving newValue = getEnumValueOf(stringValue, Weaving.values()); - Weaving old = this.weaving; - this.weaving = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Weaving getDefaultWeaving() { - return DEFAULT_WEAVING; - } - - // ********** DescriptorCustomizer ********** - - public String getDescriptorCustomizer(String entityName) { - CustomizerProperties customizer = this.customizerPropertiesOf(entityName); - return (customizer == null) ? null : customizer.getClassName(); - } - - public void setDescriptorCustomizer(String newDescriptorCustomizer, String entityName) { - CustomizerProperties old = this.setCustomizerClass_(newDescriptorCustomizer, entityName); - this.putStringValue(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER, entityName, newDescriptorCustomizer, false); - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.customizerPropertiesOf(entityName)); - } - - private void descriptorCustomizerChanged(PropertyChangeEvent event) { - String entityName; - Property newProperty = (Property) event.getNewValue(); - // property == null when removed - entityName = (newProperty == null) ? - this.getEntityName((Property) event.getOldValue()) : this.getEntityName(newProperty); - CustomizerProperties old = this.setCustomizerClass_(newProperty, entityName); - this.firePropertyChanged(event.getAspectName(), old, this.customizerPropertiesOf(entityName)); - } - - public String getDefaultDescriptorCustomizer() { - return DEFAULT_DESCRIPTOR_CUSTOMIZER; - } - - - // ****** CustomizerProperties ******* - - /** - * Convenience method to update the CustomizerClass in entitiesCustomizerProperties map. - * Returns the old value of CustomizerProperties - */ - private CustomizerProperties setCustomizerClass_(Property newProperty, String entityName) { - String newValue = (newProperty == null) ? null : newProperty.getValue(); - return this.setCustomizerClass_(newValue, entityName); - } - - private CustomizerProperties setCustomizerClass_(String newValue, String entityName) { - CustomizerProperties properties = this.customizerPropertiesOf(entityName); - CustomizerProperties old = properties.clone(); - properties.setClassName(newValue); - this.putEntityCustomizerProperties(entityName, properties); - return old; - } - - /** - * Returns the CustomizerProperties of the Entity with the given name. - */ - private CustomizerProperties customizerPropertiesOf(String entityName) { - CustomizerProperties properties = this.entitiesCustomizerProperties.get(entityName); - if (properties == null) { - properties = new CustomizerProperties(entityName); - } - return properties; - } - - /** - * Set all CustomizerProperties to default. - */ - private void clearCustomizerProperties(String entityName) { - this.setDescriptorCustomizer(null, entityName); - } - - // ****** convenience methods ******* - /** - * Put the given Entity CustomizerProperties in this entitiesCustomizerProperties map. - * @param entityName - Entity name. The entity may be a new or an existing entity. - * @param properties - Entity CustomizerProperties - */ - private void putEntityCustomizerProperties(String entityName, CustomizerProperties properties) { - this.addOrReplacePropertiesForEntity(entityName, properties); - } - - - - // ****** entities list ******* - - public ListIterator<String> entities() { - return CollectionTools.list(this.entitiesCustomizerProperties.keySet()).listIterator(); - } - - public int entitiesSize() { - return this.entitiesCustomizerProperties.size(); - } - - /* - * Verifies if this entitiesCacheProperties map contains the given Entity. - */ - public boolean entityExists(String entity) { - return this.entitiesCustomizerProperties.containsKey(entity); - } - - public String addEntity(String entity) { - if (entityExists(entity)) { - throw new IllegalStateException("Entity " + entity + " already exist."); - } - return this.addOrReplacePropertiesForEntity(entity, new CustomizerProperties(entity)); - } - - /** - * Adds or Replaces the given Entity CustomizerProperties in - * this entitiesCustomizerProperties map. - * If the specified Entity exists and the given CustomizerProperties is empty - * (i.e. all properties are null) the mapping will be removed from the map. - * @param entity - Entity name - * @param properties - Entity CustomizerProperties - * @return - */ - private String addOrReplacePropertiesForEntity(String entity, CustomizerProperties properties) { - if (entityExists(entity)) { - this.replaceEntity_(entity, properties); - return null; - } - this.entitiesCustomizerProperties.put(entity, properties); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - return entity; - } - - /** - * Replaces the given Entity CustomizerProperties in this - * entitiesCustomizerProperties map. - * If the Entity CustomizerProperties is empty (i.e. all properties is null) the - * mapping will be removed from the map. - * @param entity - Entity name - * @param properties - Entity CustomizerProperties - * @return - */ - private CustomizerProperties replaceEntity_(String entity, CustomizerProperties properties) { - CustomizerProperties old = this.entitiesCustomizerProperties.get(entity); - if (properties.isEmpty()) { - this.entitiesCustomizerProperties.remove(entity); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - } - else { - this.entitiesCustomizerProperties.put(entity, properties); - } - return old; - } - - public void removeEntity(String entity) { - if ( ! entityExists(entity)) { - return; - } - this.clearCustomizerProperties(entity); - this.entitiesCustomizerProperties.remove(entity); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - } - - // ********** 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_(getEclipseLinkStringValueOf(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 profiler = Profiler.getProfilerFor(newProfiler); - if(profiler == null) { // custom profiler class - this.setProfiler_(newProfiler); - } - else { - this.setProfiler(profiler); - } - } - - 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.profiler; - this.profiler = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultProfiler() { - return DEFAULT_PROFILER; - } - -}
\ 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/customization/Profiler.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Profiler.java deleted file mode 100644 index b3d82956c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Profiler.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * Profiler - */ -public enum Profiler { - performance_profiler, - query_monitor, - no_profiler; - - // EclipseLink value string - public static final String PERFORMANCE_PROFILER = "PerformanceProfiler"; - public static final String QUERY_MONITOR = "QueryMonitor"; - public static final String NO_PROFILER = "NoProfiler"; - - /** - * Return the Profiler value corresponding to the given literal. - */ - public static Profiler getProfilerFor(String literal) { - - for( Profiler profiler : Profiler.values()) { - if(profiler.toString().equals(literal)) { - return profiler; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Weaving.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Weaving.java deleted file mode 100644 index 0ecfedfdd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Weaving.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * Weaving - */ -public enum Weaving { - true_, - false_, - static_; - - // EclipseLink value string - public static final String TRUE_ = "true"; - public static final String FALSE_ = "false"; - public static final String STATIC_ = "static"; -} 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 836fc91c1d..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 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * EclipseLinkGeneralProperties - */ -public class EclipseLinkGeneralProperties extends EclipseLinkPersistenceUnitProperties - implements GeneralProperties -{ - // ********** EclipseLink properties ********** - private Boolean excludeEclipselinkOrm; - - // ********** constructors ********** - public EclipseLinkGeneralProperties(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - - this.excludeEclipselinkOrm = - this.getBooleanValue(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM); - } - - - // ********** behavior ********** - /** - * 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); - } - - public void propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - if (aspectName.equals(EXCLUDE_ECLIPSELINK_ORM_PROPERTY)) { - this.excludeEclipselinkOrmChanged(event); - } - else { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); //$NON-NLS-1$ - } - return; - } - - - // ********** 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.excludeEclipselinkOrm; - this.excludeEclipselinkOrm = newValue; - this.firePropertyChanged(event.getAspectName(), 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/general/GeneralProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/GeneralProperties.java deleted file mode 100644 index 6092ac03fc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/GeneralProperties.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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 org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * GeneralProperties - */ -public interface GeneralProperties extends PersistenceUnitProperties -{ - - Boolean getDefaultExcludeEclipselinkOrm(); - Boolean getExcludeEclipselinkOrm(); - void setExcludeEclipselinkOrm(Boolean newExcludeEclipselinkOrm); - static final String EXCLUDE_ECLIPSELINK_ORM_PROPERTY = "excludeEclipselinkOrmProperty"; - // EclipseLink key string - static final String ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM = "eclipselink.exclude-eclipselink-orm"; - static final Boolean DEFAULT_EXCLUDE_ECLIPSELINK_ORM = Boolean.FALSE; - -} 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 1f50d82e9c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java +++ /dev/null @@ -1,349 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * 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, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** 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() { - - Logger standardLogger = this.getEnumValue(ECLIPSELINK_LOGGER, Logger.values()); - if( ! this.getPersistenceUnit().containsProperty(ECLIPSELINK_LOGGER)) { - return null; // no property found - } - else if(standardLogger == null) { - return this.getStringValue(ECLIPSELINK_LOGGER); // custom logger - } - else { - return getEclipseLinkStringValueOf(standardLogger); // a Logger - } - } - - // ********** behavior ********** - /** - * 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); - } - - public void propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - if (aspectName.equals(LEVEL_PROPERTY)) { - this.levelChanged(event); - } - else if (aspectName.equals(TIMESTAMP_PROPERTY)) { - this.timestampChanged(event); - } - else if (aspectName.equals(THREAD_PROPERTY)) { - this.threadChanged(event); - } - else if (aspectName.equals(SESSION_PROPERTY)) { - this.sessionChanged(event); - } - else if (aspectName.equals(EXCEPTIONS_PROPERTY)) { - this.exceptionsChanged(event); - } - else if (aspectName.equals(LOG_FILE_LOCATION_PROPERTY)) { - this.logFileLocationChanged(event); - } - else if (aspectName.equals(LOGGER_PROPERTY)) { - this.loggerChanged(event); - } - else { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - // ********** 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - LoggingLevel newValue = getEnumValueOf(stringValue, LoggingLevel.values()); - LoggingLevel old = this.level; - this.level = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.timestamp; - this.timestamp = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.thread; - this.thread = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.session; - this.session = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.exceptions; - this.exceptions = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.logFileLocation; - this.logFileLocation = newValue; - this.firePropertyChanged(event.getAspectName(), 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_(getEclipseLinkStringValueOf(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_((String) null); - return; - } - Logger logger = Logger.getLoggerFor(newLogger); - if(logger == null) { // custom Logger class - this.setLogger_(newLogger); - } - else { - this.setLogger(logger); - } - } - - 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.logger; - this.logger = newValue; - this.firePropertyChanged(event.getAspectName(), 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/logging/Logger.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/Logger.java deleted file mode 100644 index 30aabea987..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/Logger.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * Logger - */ -public enum Logger { - default_logger, - java_logger, - server_logger; - - // EclipseLink value string - public static final String DEFAULT_LOGGER = "DefaultLogger"; - public static final String JAVA_LOGGER = "JavaLogger"; - public static final String SERVER_LOGGER = "ServerLogger"; - - /** - * Return the Logger value corresponding to the given literal. - */ - public static Logger getLoggerFor(String literal) { - - for( Logger logger : Logger.values()) { - if(logger.toString().equals(literal)) { - return logger; - } - } - return null; - } -}
\ 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/logging/Logging.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/Logging.java deleted file mode 100644 index 25590109ae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/Logging.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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 org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Logging - */ -public interface Logging extends PersistenceUnitProperties -{ - LoggingLevel getDefaultLevel(); - LoggingLevel getLevel(); - void setLevel(LoggingLevel level); - static final String LEVEL_PROPERTY = "levelProperty"; - // EclipseLink key string - static final String ECLIPSELINK_LEVEL = "eclipselink.logging.level"; - static final LoggingLevel DEFAULT_LEVEL = LoggingLevel.info; - - Boolean getDefaultTimestamp(); - Boolean getTimestamp(); - void setTimestamp(Boolean timestamp); - static final String TIMESTAMP_PROPERTY = "timestampProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TIMESTAMP = "eclipselink.logging.timestamp"; - static final Boolean DEFAULT_TIMESTAMP = Boolean.TRUE; - - Boolean getDefaultThread(); - Boolean getThread(); - void setThread(Boolean thread); - static final String THREAD_PROPERTY = "threadProperty"; - // EclipseLink key string - static final String ECLIPSELINK_THREAD = "eclipselink.logging.thread"; - static final Boolean DEFAULT_THREAD = Boolean.TRUE; - - Boolean getDefaultSession(); - Boolean getSession(); - void setSession(Boolean session); - static final String SESSION_PROPERTY = "sessionProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION = "eclipselink.logging.session"; - static final Boolean DEFAULT_SESSION = Boolean.TRUE; - - Boolean getDefaultExceptions(); - Boolean getExceptions(); - void setExceptions(Boolean exceptions); - static final String EXCEPTIONS_PROPERTY = "exceptionsProperty"; - // EclipseLink key string - static final String ECLIPSELINK_EXCEPTIONS = "eclipselink.logging.exceptions"; - static final Boolean DEFAULT_EXCEPTIONS = Boolean.FALSE; - - String getDefaultLogFileLocation(); - String getLogFileLocation(); - void setLogFileLocation(String newLogFileLocation); - static final String LOG_FILE_LOCATION_PROPERTY = "logFileLocationProperty"; - // EclipseLink key string - static final String ECLIPSELINK_LOG_FILE_LOCATION = "eclipselink.logging.file"; - static final String DEFAULT_LOG_FILE_LOCATION = null; // No Default - - String getDefaultLogger(); - String getLogger(); - void setLogger(String newLogger); - void setLogger(Logger newLogger); - static final String LOGGER_PROPERTY = "loggerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_LOGGER = "eclipselink.logging.logger"; - static final String DEFAULT_LOGGER = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(Logger.default_logger); - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java deleted file mode 100644 index 156404464c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * LoggingLevel - */ -public enum LoggingLevel { - off, - severe, - warning, - info, - config, - fine, - finer, - finest; - - // EclipseLink value string - public static final String OFF = "OFF"; - public static final String SEVERE = "SEVERE"; - public static final String WARNING = "WARNING"; - public static final String INFO = "INFO"; - public static final String CONFIG = "CONFIG"; - public static final String FINE = "FINE"; - public static final String FINER = "FINER"; - public static final String FINEST = "FINEST"; -} 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 658c0447bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java +++ /dev/null @@ -1,393 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * 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, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** 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() { - - TargetDatabase standardTargetDatabase = this.getEnumValue(ECLIPSELINK_TARGET_DATABASE, TargetDatabase.values()); - if( ! this.getPersistenceUnit().containsProperty(ECLIPSELINK_TARGET_DATABASE)) { - return(null); - } - else if(standardTargetDatabase == null) { - return(this.getStringValue(ECLIPSELINK_TARGET_DATABASE)); // custom targetDatabase - } - else { - return(getEclipseLinkStringValueOf(standardTargetDatabase)); - } - } - - protected String getTargetServerFromPersistenceXml() { - - TargetServer standardTargetServer = this.getEnumValue(ECLIPSELINK_TARGET_SERVER, TargetServer.values()); - if( ! this.getPersistenceUnit().containsProperty(ECLIPSELINK_TARGET_SERVER)) { - return(null); - } - else if(standardTargetServer == null) { - return(this.getStringValue(ECLIPSELINK_TARGET_SERVER)); // custom targetServer - } - else { - return(getEclipseLinkStringValueOf(standardTargetServer)); - } - } - - // ********** behavior ********** - /** - * 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); - } - - public void propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - if (aspectName.equals(SESSION_NAME_PROPERTY)) { - this.sessionNameChanged(event); - } - else if (aspectName.equals(SESSIONS_XML_PROPERTY)) { - this.sessionsXmlChanged(event); - } - else if (aspectName.equals(TARGET_DATABASE_PROPERTY)) { - this.targetDatabaseChanged(event); - } - else if (aspectName.equals(TARGET_SERVER_PROPERTY)) { - this.targetServerChanged(event); - } - else if (aspectName.equals(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)) { - this.includeDescriptorQueriesChanged(event); - } - else if (aspectName.equals(SESSION_EVENT_LISTENER_PROPERTY)) { - this.eventListenerChanged(event); - } - else if (aspectName.equals(TEMPORAL_MUTABLE_PROPERTY)) { - this.temporalMutableChanged(event); - } - else { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - // ********** 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.sessionName; - this.sessionName = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.sessionsXml; - this.sessionsXml = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newValue; - this.firePropertyChanged(event.getAspectName(), 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_(getEclipseLinkStringValueOf(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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.targetDatabase; - this.targetDatabase = newValue; - this.firePropertyChanged(event.getAspectName(), 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_(getEclipseLinkStringValueOf(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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.targetServer; - this.targetServer = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.eventListener; - this.eventListener = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.temporalMutable; - this.temporalMutable = newValue; - this.firePropertyChanged(event.getAspectName(), 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/options/Options.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/Options.java deleted file mode 100644 index 4c39623c52..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/Options.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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 org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Session Options - */ -public interface Options extends PersistenceUnitProperties -{ - String getDefaultSessionName(); - String getSessionName(); - void setSessionName(String newSessionName); - static final String SESSION_NAME_PROPERTY = "sessionNameProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_NAME = "eclipselink.session-name"; - static final String DEFAULT_SESSION_NAME = ""; // no default - - String getDefaultSessionsXml(); - String getSessionsXml(); - void setSessionsXml(String newSessionsXml); - static final String SESSIONS_XML_PROPERTY = "sessionsXmlProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSIONS_XML = "eclipselink.sessions-xml"; - static final String DEFAULT_SESSIONS_XML = ""; // no default - - Boolean getDefaultIncludeDescriptorQueries(); - Boolean getIncludeDescriptorQueries(); - void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries); - static final String SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY = "includeDescriptorQueriesProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES = "eclipselink.session.include.descriptor.queries"; - static final Boolean DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES = Boolean.TRUE; - - String getDefaultTargetDatabase(); - String getTargetDatabase(); - void setTargetDatabase(String newTargetDatabase); - void setTargetDatabase(TargetDatabase newTargetDatabase); - static final String TARGET_DATABASE_PROPERTY = "targetDatabaseProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TARGET_DATABASE = "eclipselink.target-database"; - static final String DEFAULT_TARGET_DATABASE = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(TargetDatabase.auto); - - String getDefaultTargetServer(); - String getTargetServer(); - void setTargetServer(String newTargetServer); - void setTargetServer(TargetServer newTargetServer); - static final String TARGET_SERVER_PROPERTY = "targetServerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TARGET_SERVER = "eclipselink.target-server"; - static final String DEFAULT_TARGET_SERVER = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(TargetServer.none); - - String getDefaultEventListener(); - String getEventListener(); - void setEventListener(String newEventListener); - static final String SESSION_EVENT_LISTENER_PROPERTY = "eventListenerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_EVENT_LISTENER = "eclipselink.session-event-listener"; - static final String DEFAULT_SESSION_EVENT_LISTENER = null; // no default - - - Boolean getDefaultTemporalMutable(); - Boolean getTemporalMutable(); - void setTemporalMutable(Boolean temporalMutable); - static final String TEMPORAL_MUTABLE_PROPERTY = "temporalMutableProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TEMPORAL_MUTABLE = "eclipselink.temporal.mutable"; - static final Boolean DEFAULT_TEMPORAL_MUTABLE = Boolean.FALSE; - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetDatabase.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetDatabase.java deleted file mode 100644 index 9b7c64ee73..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetDatabase.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * TargetDatabase - */ -public enum TargetDatabase { - attunity, - auto, - cloudscape, - database, - db2, - db2mainframe, - dbase, - derby, - hsql, - informix, - javadb, - mysql, - oracle, - oracle11, - oracle10, - oracle9, - oracle8, - pointbase, - postgresql, - sqlanywhere, - sqlserver, - sybase, - timesten; - - // EclipseLink value string - static final String ATTUNITY = "Attunity"; - static final String AUTO = "Auto"; - static final String CLOUDSCAPE = "Cloudscape"; - static final String DATABASE = "Database"; - static final String DB2 = "DB2"; - static final String DB2MAINFRAME = "DB2Mainframe"; - static final String DBASE = "DBase"; - static final String DERBY = "Derby"; - static final String HSQL = "HSQL"; - static final String INFORMIX = "Informix"; - static final String JAVADB = "JavaDB"; - static final String MYSQL = "MySQL"; - static final String ORACLE = "Oracle"; - static final String ORACLE11 = "Oracle11"; - static final String ORACLE10 = "Oracle10g"; - static final String ORACLE9 = "Oracle9i"; - static final String ORACLE8 = "Oracle8i"; - static final String POINTBASE = "PointBase"; - static final String POSTGRESQL = "PostgreSQL"; - static final String SQLANYWHERE = "SQLAnywhere"; - static final String SQLSERVER = "SQLServer"; - static final String SYBASE = "Sybase"; - static final String TIMESTEN = "TimesTen"; - - /** - * Return the TargetDatabase value corresponding to the given literal. - */ - public static TargetDatabase getTargetDatabaseFor(String literal) { - - for( TargetDatabase targetDatabase : TargetDatabase.values()) { - if(targetDatabase.toString().equals(literal)) { - return targetDatabase; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetServer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetServer.java deleted file mode 100644 index e0ea2a033d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetServer.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * TargetServer - */ -public enum TargetServer { - none, - oc4j, - sunas9, - websphere, - websphere_6_1, - weblogic, - weblogic_9, - weblogic_10, - jboss; - - // EclipseLink value string - static final String NONE = "None"; - static final String OC4J = "OC4J"; - static final String SUNAS9 = "SunAS9"; - static final String WEBSPHERE = "WebSphere"; - static final String WEBSPHERE_6_1 = "WebSphere_6_1"; - static final String WEBLOGIC = "WebLogic"; - static final String WEBLOGIC_9 = "WebLogic_9"; - static final String WEBLOGIC_10 = "WebLogic_10"; - static final String JBOSS = "JBoss"; - - /** - * Return the TargetServer value corresponding to the given literal. - */ - public static TargetServer getTargetServerFor(String literal) { - - for( TargetServer targetServer : TargetServer.values()) { - if(targetServer.toString().equals(literal)) { - return targetServer; - } - } - return null; - } -}
\ 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/DdlGenerationType.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/DdlGenerationType.java deleted file mode 100644 index 6abdfc3f83..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/DdlGenerationType.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * DdlGenerationType - */ -public enum DdlGenerationType { - none, - create_tables, - drop_and_create_tables; - - // EclipseLink value string - public static final String NONE = "none"; - public static final String CREATE_TABLES = "create-tables"; - public static final String DROP_AND_CREATE_TABLES = "drop-and-create-tables"; -}
\ 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 4817223992..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,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies 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.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * 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, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - /** - * 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 propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - - if (aspectName.equals(OUTPUT_MODE_PROPERTY)) { - this.outputModeChanged(event); - } - else if (aspectName.equals(DDL_GENERATION_TYPE_PROPERTY)) { - this.ddlGenerationTypeChanged(event); - } - else if (aspectName.equals(CREATE_FILE_NAME_PROPERTY)) { - this.createFileNameChanged(event); - } - else if (aspectName.equals(DROP_FILE_NAME_PROPERTY)) { - this.dropFileNameChanged(event); - } - else if (aspectName.equals(APPLICATION_LOCATION_PROPERTY)) { - this.applicationLocationChanged(event); - } - else { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - // ********** 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - DdlGenerationType newValue = getEnumValueOf(stringValue, DdlGenerationType.values()); - DdlGenerationType old = this.ddlGenerationType; - this.ddlGenerationType = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - OutputMode newValue = getEnumValueOf(stringValue, OutputMode.values()); - OutputMode old = this.outputMode; - this.outputMode = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.createFileName; - this.createFileName = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.dropFileName; - this.dropFileName = newValue; - this.firePropertyChanged(event.getAspectName(), 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(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.applicationLocation; - this.applicationLocation = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultApplicationLocation() { - return DEFAULT_SCHEMA_GENERATION_APPLICATION_LOCATION; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/OutputMode.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/OutputMode.java deleted file mode 100644 index a8617da839..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/OutputMode.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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; - -/** - * OutputMode - */ -public enum OutputMode { - both, - sql_script, - database; - - // EclipseLink value string - public static final String BOTH = "both"; - public static final String DATABASE = "database"; - public static final String SQL_SCRIPT = "sql-script"; -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/SchemaGeneration.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/SchemaGeneration.java deleted file mode 100644 index ef0766a746..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/SchemaGeneration.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies 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 org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * SchemaGeneration - */ -public interface SchemaGeneration extends PersistenceUnitProperties -{ - DdlGenerationType getDefaultDdlGenerationType(); - DdlGenerationType getDdlGenerationType(); - void setDdlGenerationType(DdlGenerationType ddlGenerationType); - static final String DDL_GENERATION_TYPE_PROPERTY = "ddlGenerationTypeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DDL_GENERATION_TYPE = "eclipselink.ddl-generation"; - static final DdlGenerationType DEFAULT_SCHEMA_GENERATION_DDL_GENERATION_TYPE = DdlGenerationType.none; - - OutputMode getDefaultOutputMode(); - OutputMode getOutputMode(); - void setOutputMode(OutputMode outputMode); // put - static final String OUTPUT_MODE_PROPERTY = "outputModeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE = "eclipselink.ddl-generation.output-mode"; - static final OutputMode DEFAULT_SCHEMA_GENERATION_OUTPUT_MODE = null; // No Default - - String getDefaultCreateFileName(); - String getCreateFileName(); - void setCreateFileName(String createFileName); - static final String CREATE_FILE_NAME_PROPERTY = "createFileNameProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CREATE_FILE_NAME = "eclipselink.create-ddl-jdbc-file-name"; - static final String DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME = "createDDL.jdbc"; - - String getDefaultDropFileName(); - String getDropFileName(); - void setDropFileName(String dropFileName); - static final String DROP_FILE_NAME_PROPERTY = "dropFileNameProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DROP_FILE_NAME = "eclipselink.drop-ddl-jdbc-file-name"; - static final String DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME = "dropDDL.jdbc"; - - String getDefaultApplicationLocation(); - String getApplicationLocation(); - void setApplicationLocation(String applicationLocation); - static final String APPLICATION_LOCATION_PROPERTY = "applicationLocationProperty"; - // EclipseLink key string - static final String ECLIPSELINK_APPLICATION_LOCATION = "eclipselink.application-location"; - static final String DEFAULT_SCHEMA_GENERATION_APPLICATION_LOCATION = "."; - -} |