diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm')
74 files changed, 0 insertions, 6796 deletions
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 e0b0fdc4e2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappings.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 java.util.ListIterator; - -import org.eclipse.jpt.core.context.orm.EntityMappings; -import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery; -import org.eclipse.jpt.core.context.orm.OrmNamedQuery; - -public interface EclipseLinkEntityMappings - extends EntityMappings -{ - - ConverterHolder getConverterHolder(); - - // hmmm - these suppress various warnings in EclipseLinkEntityMappingImpl... - ListIterator<OrmNamedQuery> namedQueries(); - ListIterator<OrmNamedNativeQuery> namedNativeQueries(); - -} 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 27c7fc0ce5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.GenericEntityMappings; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -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) { - super(parent); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); - } - - @Override - protected OrmPersistentType buildPersistentType(String mappingKey) { - return getJpaFactory().buildEclipseLinkOrmPersistentType(this, mappingKey); - } - - // **************** JpaNode impl ******************************************* - - @Override - protected EclipseLinkJpaFactory getJpaFactory() { - return (EclipseLinkJpaFactory) super.getJpaFactory(); - } - - @Override - public EclipseLinkOrmXml getParent() { - return (EclipseLinkOrmXml) super.getParent(); - } - - - // **************** EclipseLinkEntityMappings impl ********************************** - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - @Override - protected void initialize() { - super.initialize(); - this.converterHolder.initialize((XmlEntityMappings) this.xmlEntityMappings); - } - - @Override - public void update() { - super.update(); - this.converterHolder.update(); - } - - // **************** 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 acf14f9485..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMapping.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmBasicMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -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 getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlBasic) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlBasic addToResourceModel(XmlTypeMapping typeMapping) { - XmlBasic basic = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicImpl(); - getPersistentAttribute().initialize(basic); - typeMapping.getAttributes().getBasics().add(basic); - return basic; - } - - @Override - protected void initialize() { - super.initialize(); - 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/EclipseLinkOrmBasicMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMappingProvider.java deleted file mode 100644 index a3e9bd246c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmBasicMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmBasicMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmBasicMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmBasicMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlBasic(ormTypeMapping, (JavaBasicMapping) javaAttributeMapping); - } - -} 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 3713babb96..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCaching.java +++ /dev/null @@ -1,666 +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.ExistenceType; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.context.orm.XmlCaching; -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 XmlCaching -{ - 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); - if (newSpecifiedShared == Boolean.FALSE) { - setSpecifiedType(null); - setSpecifiedSize(null); - setSpecifiedAlwaysRefresh(null); - setSpecifiedRefreshOnlyIfNewer(null); - setSpecifiedDisableHits(null); - setSpecifiedCoordinationType(null); - setExpiry(null); - if (this.expiryTimeOfDay != null) { - removeExpiryTimeOfDay(); - } - } - } - - protected void setSpecifiedShared_(Boolean newSpecifiedShared) { - Boolean oldSpecifiedShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - firePropertyChanged(SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - } - - - public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh == null) ? this.defaultAlwaysRefresh : this.specifiedAlwaysRefresh.booleanValue(); - } - - public boolean isDefaultAlwaysRefresh() { - return this.defaultAlwaysRefresh; - } - - protected void setDefaultAlwaysRefresh(boolean newDefaultAlwaysRefresh) { - boolean oldDefaultAlwaysRefresh = this.defaultAlwaysRefresh; - this.defaultAlwaysRefresh = newDefaultAlwaysRefresh; - firePropertyChanged(DEFAULT_ALWAYS_REFRESH_PROPERTY, oldDefaultAlwaysRefresh, newDefaultAlwaysRefresh); - } - - public Boolean getSpecifiedAlwaysRefresh() { - return this.specifiedAlwaysRefresh; - } - - public void setSpecifiedAlwaysRefresh(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldSpecifiedAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - if (oldSpecifiedAlwaysRefresh != newSpecifiedAlwaysRefresh) { - if (this.getResourceCache() != null) { - this.getResourceCache().setAlwaysRefresh(newSpecifiedAlwaysRefresh); - if (this.getResourceCache().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); - 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 (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 = getResourceSize(resourceCache); - this.defaultShared = this.defaultShared(javaCaching); - this.specifiedShared = this.getResourceShared(resourceCache); - this.defaultAlwaysRefresh = this.defaultAlwaysRefresh(javaCaching); - this.specifiedAlwaysRefresh = this.getResourceAlwaysRefresh(resourceCache); - this.defaultRefreshOnlyIfNewer = this.defaultRefreshOnlyIfNewer(javaCaching); - this.specifiedRefreshOnlyIfNewer = this.getResourceRefreshOnlyIfNewer(resourceCache); - this.defaultDisableHits = this.defaultDisableHits(javaCaching); - this.specifiedDisableHits = this.getResourceDisableHits(resourceCache); - this.defaultType = this.defaultType(javaCaching); - this.specifiedType = this.getResourceType(resourceCache); - this.defaultCoordinationType = this.defaultCoordinationType(javaCaching); - this.specifiedCoordinationType = this.getResourceCoordinationType(resourceCache); - this.defaultExistenceType = this.defaultExistenceType(javaCaching); - this.specifiedExistenceType = this.getResourceExistenceChecking(); - this.initializeExpiry(resourceCache); - } - - 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(JavaCaching javaCaching) { - XmlCache resourceCache = getResourceCache(); - setDefaultSize(this.defaultSize(javaCaching)); - setSpecifiedSize_(this.getResourceSize(resourceCache)); - setDefaultShared(this.defaultShared(javaCaching)); - setSpecifiedShared_(this.getResourceShared(resourceCache)); - setDefaultAlwaysRefresh(this.defaultAlwaysRefresh(javaCaching)); - setSpecifiedAlwaysRefresh_(this.getResourceAlwaysRefresh(resourceCache)); - setDefaultRefreshOnlyIfNewer(this.defaultRefreshOnlyIfNewer(javaCaching)); - setSpecifiedRefreshOnlyIfNewer_(this.getResourceRefreshOnlyIfNewer(resourceCache)); - setDefaultDisableHits(this.defaultDisableHits(javaCaching)); - setSpecifiedDisableHits_(this.getResourceDisableHits(resourceCache)); - setDefaultType(this.defaultType(javaCaching)); - setSpecifiedType_(this.getResourceType(resourceCache)); - setDefaultCoordinationType(this.defaultCoordinationType(javaCaching)); - setSpecifiedCoordinationType_(this.getResourceCoordinationType(resourceCache)); - setDefaultExistenceType(this.defaultExistenceType(javaCaching)); - setSpecifiedExistenceType_(this.getResourceExistenceChecking()); - this.updateExpiry(resourceCache); - } - - 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 getResourceSize(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 getResourceShared(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 getResourceAlwaysRefresh(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 getResourceRefreshOnlyIfNewer(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 getResourceDisableHits(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 getResourceType(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 getResourceCoordinationType(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 getResourceExistenceChecking() { - return (this.resource == null) ? null : ExistenceType.fromOrmResourceModel(this.resource.getExistenceChecking()); - } - - protected Integer getResourceExpiry(XmlCache resource) { - return (resource == null) ? null : resource.getExpiry(); - } - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - XmlCache resource = getResourceCache(); - return resource == null ? null : resource.getValidationTextRange(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 3dd671cfa0..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 = getResourceChangeTracking(); - } - - protected void update(ChangeTracking javaChangeTracking) { - setDefaultType_(calculateDefaultType(javaChangeTracking)); - setSpecifiedType_(getResourceChangeTracking()); - } - - protected ChangeTrackingType calculateDefaultType(ChangeTracking javaChangeTracking) { - return (javaChangeTracking != null) ? javaChangeTracking.getType() : ChangeTracking.DEFAULT_TYPE; - } - - protected ChangeTrackingType getResourceChangeTracking() { - XmlChangeTracking xmlChangeTracking = this.resource.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 24d7b41b94..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.getResourceDataValue(); - this.objectValue = this.getResourceObjectValue(); - } - - public void update(XmlConversionValue resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.setDataValue_(this.getResourceDataValue()); - this.setObjectValue_(this.getResourceObjectValue()); - } - - protected String getResourceDataValue() { - return this.resourceConversionValue.getDataValue(); - } - - protected String getResourceObjectValue() { - return this.resourceConversionValue.getObjectValue(); - } - - public TextRange getDataValueTextRange() { - return this.resourceConversionValue.getDataValueTextRange(); - } - - public TextRange getObjectValueTextRange() { - return this.resourceConversionValue.getObjectValueTextRange(); - } - - @Override - public void validate(List<IMessage> messages) { - 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 4902e68680..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java +++ /dev/null @@ -1,273 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.internal.context.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 buildCustomConverter((XmlConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return buildTypeConverter((XmlTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return buildObjectTypeConverter((XmlObjectTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return buildStructConverter((XmlStructConverter) resourceConverter); - } - return null; - } - - protected void setConverter(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.getResourceConvert(); - this.converter = this.buildConverter(); - } - - public void update() { - this.setSpecifiedConverterName_(this.getResourceConvert()); - if (getResourceConverterType() == getConverterType()) { - this.converter.update(); - } - else { - setConverter(buildConverter()); - } - } - - protected String getResourceConvert() { - return this.resourceMapping == null ? null : this.resourceMapping.getConvert(); - } - - protected String getResourceConverterType() { - if (this.resourceMapping.getConverter() != null) { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - else if (this.resourceMapping.getTypeConverter() != null) { - return EclipseLinkConverter.TYPE_CONVERTER; - } - else if (this.resourceMapping.getObjectTypeConverter() != null) { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - else if (this.resourceMapping.getStructConverter() != null) { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - return null; - } - protected EclipseLinkOrmConverter<?> buildConverter() { - if (this.resourceMapping.getConverter() != null) { - return buildCustomConverter(this.resourceMapping.getConverter()); - } - else if (this.resourceMapping.getTypeConverter() != null) { - return buildTypeConverter(this.resourceMapping.getTypeConverter()); - } - else if (this.resourceMapping.getObjectTypeConverter() != null) { - return buildObjectTypeConverter(this.resourceMapping.getObjectTypeConverter()); - } - else if (this.resourceMapping.getStructConverter() != null) { - return buildStructConverter(this.resourceMapping.getStructConverter()); - } - - return null; - } - - protected EclipseLinkOrmCustomConverter buildCustomConverter(XmlConverter resourceConverter) { - EclipseLinkOrmCustomConverter contextConverter = new EclipseLinkOrmCustomConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected EclipseLinkOrmTypeConverter buildTypeConverter(XmlTypeConverter resourceConverter) { - EclipseLinkOrmTypeConverter contextConverter = new EclipseLinkOrmTypeConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected EclipseLinkOrmObjectTypeConverter buildObjectTypeConverter(XmlObjectTypeConverter resourceConverter) { - EclipseLinkOrmObjectTypeConverter contextConverter = new EclipseLinkOrmObjectTypeConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected EclipseLinkOrmStructConverter buildStructConverter(XmlStructConverter resourceConverter) { - EclipseLinkOrmStructConverter contextConverter = new EclipseLinkOrmStructConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - @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 4f26ef841f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.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<T extends XmlNamedConverter> - extends AbstractXmlContextNode implements EclipseLinkConverter -{ - protected T resourceConverter; - - protected String name; - - - protected EclipseLinkOrmConverter(XmlContextNode parent) { - super(parent); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - protected T getXmlResource() { - return this.resourceConverter; - } - - // **************** name *************************************************** - - public String getName() { - return this.name; - } - - public void setName(String newName) { - String oldName = this.name; - this.name = newName; - this.resourceConverter.setName(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - protected void setName_(String newName) { - String oldName = this.name; - this.name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - - // **************** resource interaction *********************************** - - protected void initialize(T resource) { - this.resourceConverter = resource; - this.name = getResourceName(); - getPersistenceUnit().addConverter(this); - } - - public void update() { - this.setName_(getResourceName()); - getPersistenceUnit().addConverter(this); - } - - protected String getResourceName() { - return this.resourceConverter.getName(); - } - - - // **************** validation ********************************************* - - public boolean overrides(EclipseLinkConverter converter) { - if (getName() == null) { - return false; - } - // this isn't ideal, but it will have to do until we have further adopter input - return this.getName().equals(converter.getName()) && converter instanceof 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 this.resourceConverter.getValidationTextRange(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 f31c79a03e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterHolder.java +++ /dev/null @@ -1,456 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.core.internal.context.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 = this.buildCustomConverter(resourceConverter); - this.customConverters.add(index, contextConverter); - this.resourceConvertersHolder.getConverters().add(index, resourceConverter); - this.fireItemAdded(CUSTOM_CONVERTERS_LIST, index, contextConverter); - return contextConverter; - } - - protected void addCustomConverter(int index, 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 = this.buildObjectTypeConverter(resourceObjectTypeConverter); - this.objectTypeConverters.add(index, contextObjectTypeConverter); - this.resourceConvertersHolder.getObjectTypeConverters().add(index, resourceObjectTypeConverter); - this.fireItemAdded(OBJECT_TYPE_CONVERTERS_LIST, index, contextObjectTypeConverter); - return contextObjectTypeConverter; - } - - protected void addObjectTypeConverter(int index, 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 = this.buildStructConverter(resourceStructConverter); - this.structConverters.add(index, contextStructConverter); - this.resourceConvertersHolder.getStructConverters().add(index, resourceStructConverter); - this.fireItemAdded(STRUCT_CONVERTERS_LIST, index, contextStructConverter); - return contextStructConverter; - } - - protected void addStructConverter(int index, 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 = this.buildTypeConverter(resourceTypeConverter); - this.typeConverters.add(index, contextTypeConverter); - this.resourceConvertersHolder.getTypeConverters().add(index, resourceTypeConverter); - this.fireItemAdded(TYPE_CONVERTERS_LIST, index, contextTypeConverter); - return contextTypeConverter; - } - - protected void addTypeConverter(int index, 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(this.buildCustomConverter(resourceConverter)); - } - } - - protected void initializeObjectTypeConverters() { - for (XmlObjectTypeConverter resourceConverter : this.resourceConvertersHolder.getObjectTypeConverters()) { - this.objectTypeConverters.add(this.buildObjectTypeConverter(resourceConverter)); - } - } - - protected void initializeStructConverters() { - for (XmlStructConverter resourceConverter : this.resourceConvertersHolder.getStructConverters()) { - this.structConverters.add(this.buildStructConverter(resourceConverter)); - } - } - - protected void initializeTypeConverters() { - for (XmlTypeConverter resourceConverter : this.resourceConvertersHolder.getTypeConverters()) { - this.typeConverters.add(this.buildTypeConverter(resourceConverter)); - } - } - - protected EclipseLinkOrmCustomConverter buildCustomConverter(XmlConverter resourceConverter) { - EclipseLinkOrmCustomConverter contextConverter = new EclipseLinkOrmCustomConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected EclipseLinkOrmTypeConverter buildTypeConverter(XmlTypeConverter resourceConverter) { - EclipseLinkOrmTypeConverter contextConverter = new EclipseLinkOrmTypeConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected EclipseLinkOrmObjectTypeConverter buildObjectTypeConverter(XmlObjectTypeConverter resourceConverter) { - EclipseLinkOrmObjectTypeConverter contextConverter = new EclipseLinkOrmObjectTypeConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected EclipseLinkOrmStructConverter buildStructConverter(XmlStructConverter resourceConverter) { - EclipseLinkOrmStructConverter contextConverter = new EclipseLinkOrmStructConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - public void update() { - this.updateCustomConverters(); - this.updateObjectTypeConverters(); - this.updateStructConverters(); - this.updateTypeConverters(); - } - - protected void updateCustomConverters() { - Collection<EclipseLinkOrmCustomConverter> contextConvertersToRemove = CollectionTools.collection(customConverters()); - Collection<EclipseLinkOrmCustomConverter> contextConvertersToUpdate = new ArrayList<EclipseLinkOrmCustomConverter>(); - int resourceIndex = 0; - - // make a copy of the XML conversion values (to prevent ConcurrentModificationException) - List<XmlConverter> xmlConverters = this.resourceConvertersHolder.getConverters(); - for (XmlConverter resourceConverter : xmlConverters.toArray(new XmlConverter[xmlConverters.size()])) { - boolean contextConverterFound = false; - for (EclipseLinkOrmCustomConverter contextConverter : contextConvertersToRemove) { - if (contextConverter.getXmlResource() == resourceConverter) { - moveCustomConverter_(resourceIndex, contextConverter); - contextConvertersToRemove.remove(contextConverter); - contextConvertersToUpdate.add(contextConverter); - contextConverterFound = true; - break; - } - } - if (!contextConverterFound) { - addCustomConverter(this.buildCustomConverter(resourceConverter)); - } - resourceIndex++; - } - for (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> contextConvertersToRemove = CollectionTools.collection(objectTypeConverters()); - Collection<EclipseLinkOrmObjectTypeConverter> contextConvertersToUpdate = new ArrayList<EclipseLinkOrmObjectTypeConverter>(); - int resourceIndex = 0; - - // make a copy of the XML converters (to prevent ConcurrentModificationException) - List<XmlObjectTypeConverter> xmlConverters = this.resourceConvertersHolder.getObjectTypeConverters(); - for (XmlObjectTypeConverter xmlConverter : xmlConverters.toArray(new XmlObjectTypeConverter[xmlConverters.size()])) { - boolean contextConverterFound = false; - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextConvertersToRemove) { - if (contextObjectTypeConverter.getXmlResource() == xmlConverter) { - moveObjectTypeConverter_(resourceIndex, contextObjectTypeConverter); - contextConvertersToRemove.remove(contextObjectTypeConverter); - contextConvertersToUpdate.add(contextObjectTypeConverter); - contextConverterFound = true; - break; - } - } - if (!contextConverterFound) { - addObjectTypeConverter(this.buildObjectTypeConverter(xmlConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextConvertersToRemove) { - removeObjectTypeConverter_(contextObjectTypeConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextConvertersToUpdate) { - contextObjectTypeConverter.update(); - } - } - - protected void updateTypeConverters() { - Collection<EclipseLinkOrmTypeConverter> contextConvertersToRemove = CollectionTools.collection(typeConverters()); - Collection<EclipseLinkOrmTypeConverter> contextConvertersToUpdate = new ArrayList<EclipseLinkOrmTypeConverter>(); - int resourceIndex = 0; - - List<XmlTypeConverter> xmlConverters = this.resourceConvertersHolder.getTypeConverters(); - for (XmlTypeConverter xmlConverter : xmlConverters.toArray(new XmlTypeConverter[xmlConverters.size()])) { - boolean contextTypeConverterFound = false; - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextConvertersToRemove) { - if (contextTypeConverter.getXmlResource() == xmlConverter) { - moveTypeConverter_(resourceIndex, contextTypeConverter); - contextConvertersToRemove.remove(contextTypeConverter); - contextConvertersToUpdate.add(contextTypeConverter); - contextTypeConverterFound = true; - break; - } - } - if (!contextTypeConverterFound) { - addTypeConverter(this.buildTypeConverter(xmlConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextConvertersToRemove) { - removeTypeConverter_(contextTypeConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextConvertersToUpdate) { - contextTypeConverter.update(); - } - } - - protected void updateStructConverters() { - Collection<EclipseLinkOrmStructConverter> contextConvertersToRemove = CollectionTools.collection(structConverters()); - Collection<EclipseLinkOrmStructConverter> contextConvertersToUpdate = new ArrayList<EclipseLinkOrmStructConverter>(); - int resourceIndex = 0; - - // make a copy of the XML converters (to prevent ConcurrentModificationException) - List<XmlStructConverter> xmlConverters = this.resourceConvertersHolder.getStructConverters(); - for (XmlStructConverter resourceStructConverter : xmlConverters.toArray(new XmlStructConverter[xmlConverters.size()])) { - boolean contextStructConverterFound = false; - for (EclipseLinkOrmStructConverter contextStructConverter : contextConvertersToRemove) { - if (contextStructConverter.getXmlResource() == resourceStructConverter) { - moveStructConverter_(resourceIndex, contextStructConverter); - contextConvertersToRemove.remove(contextStructConverter); - contextConvertersToUpdate.add(contextStructConverter); - contextStructConverterFound = true; - break; - } - } - if (!contextStructConverterFound) { - addStructConverter(this.buildStructConverter(resourceStructConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmStructConverter contextStructConverter : contextConvertersToRemove) { - removeStructConverter_(contextStructConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmStructConverter contextStructConverter : contextConvertersToUpdate) { - 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 0f1e895bc4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomConverter.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.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<XmlConverter> - implements CustomConverter -{ - private String converterClass; - - - public EclipseLinkOrmCustomConverter(XmlContextNode parent) { - super(parent); - } - - - public String getType() { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - this.resourceConverter.setClassName(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(XmlConverter xmlResource) { - super.initialize(xmlResource); - this.converterClass = getResourceClassName(); - } - - @Override - public void update() { - super.update(); - setConverterClass_(getResourceClassName()); - } - - protected String getResourceClassName() { - return this.resourceConverter.getClassName(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - 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 207ce44950..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomizer.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.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 = getJavaCustomizerClass(javaCustomizer); - this.specifiedCustomizerClass = getResourceCustomizerClass(); - } - - protected void update(Customizer javaCustomizer) { - setDefaultCustomizerClass(getJavaCustomizerClass(javaCustomizer)); - setSpecifiedCustomizerClass_(getResourceCustomizerClass()); - } - - protected String getJavaCustomizerClass(Customizer javaCustomizer) { - return (javaCustomizer == null) ? null : javaCustomizer.getCustomizerClass(); - } - - protected String getResourceCustomizerClass() { - XmlCustomizer resource = getResourceCustomizer(); - return (resource == null) ? null : resource.getCustomizerClassName(); - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - XmlCustomizer resource = getResourceCustomizer(); - return resource == null ? null : resource.getCustomizerClassNameTextRange(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 bb25acf8ab..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, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.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() { - super.initialize(); - this.customizer.initialize((XmlCustomizerHolder) this.resourceTypeMapping, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) this.resourceTypeMapping, getJavaChangeTracking()); - this.converterHolder.initialize((XmlConvertersHolder) this.resourceTypeMapping); - } - - @Override - public void update() { - super.update(); - this.customizer.update(getJavaCustomizer()); - this.changeTracking.update(getJavaChangeTracking()); - this.converterHolder.update(); - } - - @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/EclipseLinkOrmEmbeddableProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddableProvider.java deleted file mode 100644 index 206f9ddd8a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddableProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.orm.ExtendedOrmTypeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -/** - * EclipseLink ORM Embeddable provider - * Allow for EclipseLink extensions to Embeddable - */ -public class EclipseLinkOrmEmbeddableProvider - implements ExtendedOrmTypeMappingProvider -{ - - // singleton - private static final ExtendedOrmTypeMappingProvider INSTANCE = new EclipseLinkOrmEmbeddableProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmTypeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmEmbeddableProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public OrmTypeMapping buildMapping(OrmPersistentType parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmEmbeddable(parent); - } - - public String getKey() { - return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedIdMapping.java deleted file mode 100644 index 66f756a830..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedIdMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmEmbeddedIdMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbeddedId; - -public class EclipseLinkOrmEmbeddedIdMapping extends GenericOrmEmbeddedIdMapping -{ - - public EclipseLinkOrmEmbeddedIdMapping(OrmPersistentAttribute parent) { - super(parent); - } - - // **************** resource-context interaction *************************** - - @Override - public XmlEmbeddedId addToResourceModel(XmlTypeMapping typeMapping) { - XmlEmbeddedId embeddedId = EclipseLinkOrmFactory.eINSTANCE.createXmlEmbeddedIdImpl(); - getPersistentAttribute().initialize(embeddedId); - typeMapping.getAttributes().getEmbeddedIds().add(embeddedId); - return embeddedId; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedIdMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedIdMappingProvider.java deleted file mode 100644 index cfbf9e534e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedIdMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmEmbeddedIdMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmEmbeddedIdMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmEmbeddedIdMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmEmbeddedIdMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlEmbeddedId(ormTypeMapping, (JavaEmbeddedIdMapping) javaAttributeMapping); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedMapping.java deleted file mode 100644 index fc53c9e34b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmEmbeddedMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbedded; - -public class EclipseLinkOrmEmbeddedMapping extends GenericOrmEmbeddedMapping -{ - - public EclipseLinkOrmEmbeddedMapping(OrmPersistentAttribute parent) { - super(parent); - } - - // **************** resource-context interaction *************************** - - @Override - public XmlEmbedded addToResourceModel(XmlTypeMapping typeMapping) { - XmlEmbedded embedded = EclipseLinkOrmFactory.eINSTANCE.createXmlEmbeddedImpl(); - getPersistentAttribute().initialize(embedded); - typeMapping.getAttributes().getEmbeddeds().add(embedded); - return embedded; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedMappingProvider.java deleted file mode 100644 index d8821ba23a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddedMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmEmbeddedMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmEmbeddedMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmEmbeddedMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmEmbeddedMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlEmbedded(ormTypeMapping, (JavaEmbeddedMapping) javaAttributeMapping); - } - -} 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 0567b1e511..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, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.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() { - super.initialize(); - this.readOnly.initialize((XmlReadOnly) this.resourceTypeMapping, getJavaReadOnly()); - this.customizer.initialize((XmlCustomizerHolder) this.resourceTypeMapping, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) this.resourceTypeMapping, getJavaChangeTracking()); - this.caching.initialize((XmlCacheHolder) this.resourceTypeMapping, getJavaCaching()); - this.converterHolder.initialize((XmlConvertersHolder) this.resourceTypeMapping); - } - - @Override - public void update() { - super.update(); - this.readOnly.update(getJavaReadOnly()); - this.customizer.update(getJavaCustomizer()); - this.changeTracking.update(getJavaChangeTracking()); - this.caching.update(getJavaCaching()); - this.converterHolder.update(); - } - - @Override - protected 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/EclipseLinkOrmEntityProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntityProvider.java deleted file mode 100644 index 0d4e734227..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntityProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.orm.ExtendedOrmTypeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -/** - * EclipseLink ORM Entity provider - * Allow for EclipseLink extensions to Entity - */ -public class EclipseLinkOrmEntityProvider - implements ExtendedOrmTypeMappingProvider -{ - // singleton - private static final ExtendedOrmTypeMappingProvider INSTANCE = new EclipseLinkOrmEntityProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmTypeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmEntityProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public OrmTypeMapping buildMapping(OrmPersistentType parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmEntity(parent); - } - - public String getKey() { - return MappingKeys.ENTITY_TYPE_MAPPING_KEY; - } - -} 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 d19d18195b..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.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.orm.XmlCaching; -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(XmlCaching parent) { - super(parent); - } - - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - this.resourceTimeOfDay.setHour(newHour); - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - protected void setHour_(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - this.resourceTimeOfDay.setMinute(newMinute); - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - protected void setMinute_(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - this.resourceTimeOfDay.setSecond(newSecond); - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - protected void setSecond_(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - this.resourceTimeOfDay.setMillisecond(newMillisecond); - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - protected void setMillisecond_(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - public TextRange getValidationTextRange() { - return this.resourceTimeOfDay.getValidationTextRange(); - } - - public void initialize(XmlTimeOfDay resource) { - this.resourceTimeOfDay = resource; - this.hour = getResourceHour(); - this.minute = getResourceMinute(); - this.second = getResourceSecond(); - this.millisecond = getResourceMillisecond(); - } - - public void update(XmlTimeOfDay resource) { - this.resourceTimeOfDay = resource; - this.setHour_(getResourceHour()); - this.setMinute_(getResourceMinute()); - this.setSecond_(getResourceSecond()); - this.setMillisecond_(getResourceMillisecond()); - } - - protected Integer getResourceHour() { - return this.resourceTimeOfDay.getHour(); - } - - protected Integer getResourceMinute() { - return this.resourceTimeOfDay.getMinute(); - } - - protected Integer getResourceSecond() { - return this.resourceTimeOfDay.getSecond(); - } - - protected Integer getResourceMillisecond() { - return this.resourceTimeOfDay.getMillisecond(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 2d754e403d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMapping.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmIdMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -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 getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlId) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - // **************** resource-context interaction *************************** - - @Override - public XmlId addToResourceModel(XmlTypeMapping typeMapping) { - XmlId id = EclipseLinkOrmFactory.eINSTANCE.createXmlIdImpl(); - getPersistentAttribute().initialize(id); - typeMapping.getAttributes().getIds().add(id); - return id; - } - - @Override - protected void initialize() { - super.initialize(); - 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/EclipseLinkOrmIdMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMappingProvider.java deleted file mode 100644 index 24bab669cd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaIdMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmIdMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmIdMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmIdMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmIdMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlId(ormTypeMapping, (JavaIdMapping) javaAttributeMapping); - } - -} 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 eea0d25bb4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmJoinFetch.java +++ /dev/null @@ -1,71 +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 = getResourceJoinFetch(); - } - - protected void update() { - setValue_(getResourceJoinFetch()); - } - - protected JoinFetchType getResourceJoinFetch() { - return 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 c163b7129e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToManyMapping.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import 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.XmlTypeMapping; -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(XmlTypeMapping typeMapping) { - XmlManyToMany manyToMany = EclipseLinkOrmFactory.eINSTANCE.createXmlManyToManyImpl(); - getPersistentAttribute().initialize(manyToMany); - typeMapping.getAttributes().getManyToManys().add(manyToMany); - return manyToMany; - } - - @Override - protected void initialize() { - super.initialize(); - 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/EclipseLinkOrmManyToManyMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToManyMappingProvider.java deleted file mode 100644 index 85f4175f7b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToManyMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmManyToManyMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmManyToManyMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmManyToManyMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmManyToManyMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlManyToMany(ormTypeMapping, (JavaManyToManyMapping) javaAttributeMapping); - } - -} 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 b663577326..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToOneMapping.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmManyToOneMapping; -import org.eclipse.jpt.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -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(XmlTypeMapping typeMapping) { - XmlManyToOne manyToOne = EclipseLinkOrmFactory.eINSTANCE.createXmlManyToOneImpl(); - getPersistentAttribute().initialize(manyToOne); - typeMapping.getAttributes().getManyToOnes().add(manyToOne); - return manyToOne; - } - - @Override - protected void initialize() { - super.initialize(); - 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/EclipseLinkOrmManyToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToOneMappingProvider.java deleted file mode 100644 index f8ba6a5084..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToOneMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmManyToOneMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmManyToOneMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmManyToOneMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmManyToOneMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlManyToOne(ormTypeMapping, (JavaManyToOneMapping) javaAttributeMapping); - } - -} 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 509515706b..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, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.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() { - super.initialize(); - this.readOnly.initialize((XmlReadOnly) this.resourceTypeMapping, getJavaReadOnly()); - this.customizer.initialize((XmlCustomizerHolder) this.resourceTypeMapping, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) this.resourceTypeMapping, getJavaChangeTracking()); - this.caching.initialize((XmlCacheHolder) this.resourceTypeMapping, getJavaCaching()); - this.converterHolder.initialize((XmlConvertersHolder) this.resourceTypeMapping); - } - - @Override - public void update() { - super.update(); - this.readOnly.update(getJavaReadOnly()); - this.customizer.update(getJavaCustomizer()); - this.changeTracking.update(getJavaChangeTracking()); - this.caching.update(getJavaCaching()); - this.converterHolder.update(); - } - - @Override - protected 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/EclipseLinkOrmMappedSuperclassProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclassProvider.java deleted file mode 100644 index 6a03fcff5b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclassProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.orm.ExtendedOrmTypeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -/** - * EclipseLink ORM Mapped Superclass provider - * Allow for EclipseLink extensions to Mapped Superclass - */ -public class EclipseLinkOrmMappedSuperclassProvider - implements ExtendedOrmTypeMappingProvider -{ - // singleton - private static final ExtendedOrmTypeMappingProvider INSTANCE = new EclipseLinkOrmMappedSuperclassProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmTypeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmMappedSuperclassProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public OrmTypeMapping buildMapping(OrmPersistentType parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmMappedSuperclass(parent); - } - - public String getKey() { - return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY; - } - -} 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 5230a852f8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMutable.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.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 = this.calculateDefaultMutable(); - this.specifiedMutable = this.getResourceMutable(); - } - - protected void update() { - setDefaultMutable(this.calculateDefaultMutable()); - setSpecifiedMutable_(this.getResourceMutable()); - } - - protected Boolean getResourceMutable() { - return this.resource.getMutable(); - } - - protected boolean calculateDefaultMutable() { - JavaPersistentAttribute javaAttribute = getAttributeMapping().getPersistentAttribute().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 0791aea5c7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.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.CloneIterator; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmObjectTypeConverter extends EclipseLinkOrmConverter<XmlObjectTypeConverter> - implements ObjectTypeConverter -{ - private String dataType; - - private String objectType; - - private final List<EclipseLinkOrmConversionValue> conversionValues; - - private String defaultObjectValue; - - - public EclipseLinkOrmObjectTypeConverter(XmlContextNode parent) { - super(parent); - this.conversionValues = new ArrayList<EclipseLinkOrmConversionValue>(); - } - - public String getType() { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getXmlResource().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getXmlResource().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** conversion values ************************************** - - public ListIterator<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 *********************************** - - @Override - protected void initialize(XmlObjectTypeConverter xmlResource) { - super.initialize(xmlResource); - this.dataType = this.getResourceDataType(); - this.objectType = this.getResourceObjectType(); - this.defaultObjectValue = this.getResourceDefaultObjectValue(); - this.initializeConversionValues(); - } - - protected void initializeConversionValues() { - for (XmlConversionValue resourceConversionValue : getXmlResource().getConversionValues()) { - this.conversionValues.add(buildConversionValue(resourceConversionValue)); - } - } - - @Override - public void update() { - super.update(); - setDataType_(getResourceDataType()); - setObjectType_(getResourceObjectType()); - setDefaultObjectValue_(getResourceDefaultObjectValue()); - updateConversionValues(); - } - - protected void updateConversionValues( ) { - // make a copy of the XML conversion values (to prevent ConcurrentModificationException) - Iterator<XmlConversionValue> xmlConversionValues = new CloneIterator<XmlConversionValue>(this.getXmlResource().getConversionValues()); - - for (Iterator<EclipseLinkOrmConversionValue> contextConversionValues = this.conversionValues(); contextConversionValues.hasNext(); ) { - EclipseLinkOrmConversionValue contextConversionValue = contextConversionValues.next(); - if (xmlConversionValues.hasNext()) { - contextConversionValue.update(xmlConversionValues.next()); - } - else { - removeConversionValue_(contextConversionValue); - } - } - - while (xmlConversionValues.hasNext()) { - addConversionValue(buildConversionValue(xmlConversionValues.next())); - } - } - - protected EclipseLinkOrmConversionValue buildConversionValue(XmlConversionValue resourceConversionValue) { - EclipseLinkOrmConversionValue conversionValue = new EclipseLinkOrmConversionValue(this); - conversionValue.initialize(resourceConversionValue); - return conversionValue; - } - - protected String getResourceDataType() { - return this.resourceConverter.getDataType(); - } - - protected String getResourceObjectType() { - return this.resourceConverter.getObjectType(); - } - - protected String getResourceDefaultObjectValue() { - return this.resourceConverter.getDefaultObjectValue(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - 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 503e861793..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyMapping.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.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.XmlTypeMapping; -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(XmlTypeMapping typeMapping) { - XmlOneToMany oneToMany = EclipseLinkOrmFactory.eINSTANCE.createXmlOneToManyImpl(); - getPersistentAttribute().initialize(oneToMany); - typeMapping.getAttributes().getOneToManys().add(oneToMany); - return oneToMany; - } - - @Override - protected void initialize() { - super.initialize(); - 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/EclipseLinkOrmOneToManyMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyMappingProvider.java deleted file mode 100644 index a3e6965e76..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmOneToManyMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmOneToManyMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmOneToManyMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmOneToManyMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlOneToMany(ormTypeMapping, (JavaOneToManyMapping) javaAttributeMapping); - } - -} 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 fddc228f78..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToOneMapping.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import 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.XmlTypeMapping; -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(XmlTypeMapping typeMapping) { - XmlOneToOne oneToOne = EclipseLinkOrmFactory.eINSTANCE.createXmlOneToOneImpl(); - getPersistentAttribute().initialize(oneToOne); - typeMapping.getAttributes().getOneToOnes().add(oneToOne); - return oneToOne; - } - - @Override - protected void initialize() { - super.initialize(); - 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/EclipseLinkOrmOneToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToOneMappingProvider.java deleted file mode 100644 index 58a652a4b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToOneMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaOneToOneMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmOneToOneMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmOneToOneMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmOneToOneMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmOneToOneMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlOneToOne(ormTypeMapping, (JavaOneToOneMapping) javaAttributeMapping); - } - -} 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 1956b397f5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentType.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmPersistentType; -import org.eclipse.jpt.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; - -public class EclipseLinkOrmPersistentType extends AbstractOrmPersistentType -{ - - public EclipseLinkOrmPersistentType(EclipseLinkEntityMappings 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 82ba1321bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPrivateOwned.java +++ /dev/null @@ -1,70 +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.getResourcePrivateOwned(); - } - - protected void update() { - setPrivateOwned_(this.getResourcePrivateOwned()); - } - - protected boolean getResourcePrivateOwned() { - return this.resource.isPrivateOwned(); - } - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getPrivateOwnedTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 b21277a288..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmReadOnly.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.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 = this.getJavaReadOnly(javaReadOnly); - this.specifiedReadOnly = this.getResourceReadOnly(); - } - - protected void update(ReadOnly javaReadOnly) { - setDefaultReadOnly(this.getJavaReadOnly(javaReadOnly)); - setSpecifiedReadOnly(this.getResourceReadOnly()); - } - - protected boolean getJavaReadOnly(ReadOnly javaReadOnly) { - return (javaReadOnly == null) ? false : javaReadOnly.isReadOnly(); - } - - protected Boolean getResourceReadOnly() { - return this.resource.getReadOnly(); - } - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getReadOnlyTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 bbbc42622b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmStructConverter extends EclipseLinkOrmConverter<XmlStructConverter> - implements StructConverter -{ - private String converterClass; - - - public EclipseLinkOrmStructConverter(XmlContextNode parent) { - super(parent); - } - - public String getType() { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getXmlResource().setConverter(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(XmlStructConverter xmlResource) { - super.initialize(xmlResource); - this.converterClass = getResourceConverterClass(); - } - - @Override - public void update() { - super.update(); - setConverterClass_(getResourceConverterClass()); - } - - protected String getResourceConverterClass() { - return this.resourceConverter.getConverter(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - 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 3ea6279bf7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -public class EclipseLinkOrmTypeConverter extends EclipseLinkOrmConverter<XmlTypeConverter> - implements TypeConverter -{ - private String dataType; - - private String objectType; - - - public EclipseLinkOrmTypeConverter(XmlContextNode parent) { - super(parent); - } - - public String getType() { - return EclipseLinkConverter.TYPE_CONVERTER; - } - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getXmlResource().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getXmlResource().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(XmlTypeConverter xmlResource) { - super.initialize(xmlResource); - this.dataType = getResourceDataType(); - this.objectType = getResourceObjectType(); - } - - @Override - public void update() { - super.update(); - setDataType_(getResourceDataType()); - setObjectType_(getResourceObjectType()); - } - - protected String getResourceDataType() { - return this.resourceConverter.getDataType(); - } - - protected String getResourceObjectType() { - return this.resourceConverter.getObjectType(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 2a1204322d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmVersionMapping.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmVersionMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -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 getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlVersion) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - // **************** resource-context interaction *************************** - - @Override - public XmlVersion addToResourceModel(XmlTypeMapping typeMapping) { - XmlVersion version = EclipseLinkOrmFactory.eINSTANCE.createXmlVersionImpl(); - getPersistentAttribute().initialize(version); - typeMapping.getAttributes().getVersions().add(version); - return version; - } - - @Override - protected void initialize() { - super.initialize(); - 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/EclipseLinkOrmVersionMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmVersionMappingProvider.java deleted file mode 100644 index 8bd7d16522..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmVersionMappingProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.core.context.orm.ExtendedOrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmXmlResource; - -public class EclipseLinkOrmVersionMappingProvider - implements ExtendedOrmAttributeMappingProvider -{ - // singleton - private static final ExtendedOrmAttributeMappingProvider INSTANCE = new EclipseLinkOrmVersionMappingProvider(); - - /** - * Return the singleton. - */ - public static ExtendedOrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmVersionMappingProvider() { - super(); - } - - public String getOrmType() { - return EclipseLinkOrmXmlResource.TYPE; - } - - public String getKey() { - return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmVersionMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildEclipseLinkVirtualXmlVersion(ormTypeMapping, (JavaVersionMapping) javaAttributeMapping); - } - -} 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 81a4984892..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXml.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.EntityMappings; -import org.eclipse.jpt.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmXml; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; - -public class EclipseLinkOrmXml extends GenericOrmXml -{ - public EclipseLinkOrmXml(MappingFileRef parent) { - super(parent); - } - - @Override - protected EclipseLinkJpaFactory getJpaFactory() { - return (EclipseLinkJpaFactory) super.getJpaFactory(); - } - - @Override - protected XmlEntityMappings buildEntityMappingsResource() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlEntityMappings(); - } - - - @Override - protected EntityMappings buildEntityMappings(XmlEntityMappings xmlEntityMappings) { - return getJpaFactory().buildEclipseLinkEntityMappings(this, (org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings) xmlEntityMappings); - } - -} 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 c218bd7e4a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlBasic.java +++ /dev/null @@ -1,156 +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.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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class 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$ - } - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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/EclipseLinkVirtualXmlEmbedded.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlEmbedded.java deleted file mode 100644 index 8ce8a65e2c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlEmbedded.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlEmbedded; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbedded; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlEmbedded extends VirtualXmlEmbedded implements XmlEmbedded -{ - - public EclipseLinkVirtualXmlEmbedded(OrmTypeMapping ormTypeMapping, JavaEmbeddedMapping javaEmbeddedMapping) { - super(ormTypeMapping, javaEmbeddedMapping); - } - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlEmbeddedId.java deleted file mode 100644 index dda40aacf9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlEmbeddedId.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlEmbeddedId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbeddedId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlEmbeddedId extends VirtualXmlEmbeddedId implements XmlEmbeddedId -{ - - public EclipseLinkVirtualXmlEmbeddedId(OrmTypeMapping ormTypeMapping, JavaEmbeddedIdMapping javaEmbeddedIdMapping) { - super(ormTypeMapping, javaEmbeddedIdMapping); - } - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 2f7abd7564..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlId.java +++ /dev/null @@ -1,145 +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.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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class 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 XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - 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 59ea2fa260..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToMany.java +++ /dev/null @@ -1,63 +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.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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class 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 XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - 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 db004888d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToOne.java +++ /dev/null @@ -1,63 +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.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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class 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 XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - 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 61d543c861..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToMany.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.orm; - -import org.eclipse.emf.common.util.EList; -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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * 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 XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - 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 ecae88bf41..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToOne.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.orm; - -import org.eclipse.emf.common.util.EList; -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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class 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 XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - 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 887bfceb19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlVersion.java +++ /dev/null @@ -1,146 +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.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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVersion; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class 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$ - } - - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 ca0ba50ab4..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, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -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(XmlTypeMapping typeMapping) { - XmlBasicCollection basicCollection = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicCollectionImpl(); - getPersistentAttribute().initialize(basicCollection); - ((Attributes) typeMapping.getAttributes()).getBasicCollections().add(basicCollection); - return basicCollection; - } - - public void removeFromResourceModel(XmlTypeMapping 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 4a953b6673..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, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -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(XmlTypeMapping typeMapping) { - XmlBasicMap basicMap = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicMapImpl(); - getPersistentAttribute().initialize(basicMap); - ((Attributes) typeMapping.getAttributes()).getBasicMaps().add(basicMap); - return basicMap; - } - - public void removeFromResourceModel(XmlTypeMapping 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 2f3719a29f..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, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -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(XmlTypeMapping typeMapping) { - XmlTransformation transformation = EclipseLinkOrmFactory.eINSTANCE.createXmlTransformationImpl(); - getPersistentAttribute().initialize(transformation); - ((Attributes) typeMapping.getAttributes()).getTransformations().add(transformation); - return transformation; - } - - public void removeFromResourceModel(XmlTypeMapping 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/OrmVariableOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmVariableOneToOneMapping.java deleted file mode 100644 index 760b6146a9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmVariableOneToOneMapping.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.VariableOneToOneMapping; -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.XmlVariableOneToOne; - -public class OrmVariableOneToOneMapping extends AbstractOrmAttributeMapping<XmlVariableOneToOne> implements VariableOneToOneMapping -{ - - public OrmVariableOneToOneMapping(OrmPersistentAttribute parent) { - super(parent); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public XmlVariableOneToOne addToResourceModel(XmlTypeMapping typeMapping) { - XmlVariableOneToOne xmlVariableOneToOne = EclipseLinkOrmFactory.eINSTANCE.createXmlVariableOneToOneImpl(); - getPersistentAttribute().initialize(xmlVariableOneToOne); - ((Attributes) typeMapping.getAttributes()).getVariableOneToOnes().add(xmlVariableOneToOne); - return xmlVariableOneToOne; - } - - public void removeFromResourceModel(XmlTypeMapping typeMapping) { - ((Attributes) typeMapping.getAttributes()).getVariableOneToOnes().remove(this.resourceAttributeMapping); - } - - public int getXmlSequence() { - return 65; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmVariableOneToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmVariableOneToOneMappingProvider.java deleted file mode 100644 index 5c39fd04c6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmVariableOneToOneMappingProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.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.JavaVariableOneToOneMapping; - -public class OrmVariableOneToOneMappingProvider - implements OrmAttributeMappingProvider -{ - - // singleton - private static final OrmVariableOneToOneMappingProvider INSTANCE = new OrmVariableOneToOneMappingProvider(); - - /** - * Return the singleton. - */ - public static OrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrmVariableOneToOneMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildOrmVariableOneToOneMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildVirtualXmlVariableOneToOne(ormTypeMapping, (JavaVariableOneToOneMapping) 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 b1b69457d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicCollection.java +++ /dev/null @@ -1,45 +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.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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlBasicCollection extends VirtualXmlAttributeMapping<JavaBasicCollectionMapping> implements XmlBasicCollection -{ - - public VirtualXmlBasicCollection(OrmTypeMapping ormTypeMapping, JavaBasicCollectionMapping javaBasicCollectionMapping) { - super(ormTypeMapping, javaBasicCollectionMapping); - } - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 657af71eef..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicMap.java +++ /dev/null @@ -1,45 +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.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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlBasicMap extends VirtualXmlAttributeMapping<JavaBasicMapMapping> implements XmlBasicMap -{ - - public VirtualXmlBasicMap(OrmTypeMapping ormTypeMapping, JavaBasicMapMapping javaBasicMapMappingg) { - super(ormTypeMapping, javaBasicMapMappingg); - } - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/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 3460a801b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlTransformation.java +++ /dev/null @@ -1,45 +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.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.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlTransformation extends VirtualXmlAttributeMapping<JavaTransformationMapping> implements XmlTransformation -{ - - public VirtualXmlTransformation(OrmTypeMapping ormTypeMapping, JavaTransformationMapping javaTransformationMapping) { - super(ormTypeMapping, javaTransformationMapping); - } - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlVariableOneToOne.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlVariableOneToOne.java deleted file mode 100644 index 48487a9c5b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlVariableOneToOne.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaVariableOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVariableOneToOne; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlVariableOneToOne extends VirtualXmlAttributeMapping<JavaVariableOneToOneMapping> implements XmlVariableOneToOne -{ - - public VirtualXmlVariableOneToOne(OrmTypeMapping ormTypeMapping, JavaVariableOneToOneMapping javaVariableOneToOneMapping) { - super(ormTypeMapping, javaVariableOneToOneMapping); - } - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} |