Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jpa
diff options
context:
space:
mode:
authorkmoore2008-09-11 18:24:13 +0000
committerkmoore2008-09-11 18:24:13 +0000
commitbc076026c3a1c342b376321e4a53dc8e6893c0ea (patch)
tree11019f8e903252d7f695621c0a8d8d78f9b56cc8 /jpa
parent7316bc1266423bc111cf8ea840d3b92df72ad1fa (diff)
downloadwebtools.dali-bc076026c3a1c342b376321e4a53dc8e6893c0ea.tar.gz
webtools.dali-bc076026c3a1c342b376321e4a53dc8e6893c0ea.tar.xz
webtools.dali-bc076026c3a1c342b376321e4a53dc8e6893c0ea.zip
239163- refactoring existing converters(lob, enumerated, temporal) in order to better support eclipseLink converters
Diffstat (limited to 'jpa')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/orm.ecore18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BasicMapping.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ColumnMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Converter.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ConvertibleMapping.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/EnumeratedConverter.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/IdMapping.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/LobConverter.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TemporalConverter.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/VersionMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaBasicMapping.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaConverter.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaIdMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaVersionMapping.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmBasicMapping.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmConverter.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmIdMapping.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmVersionMapping.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaBasicMapping.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaEnumeratedConverter.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdMapping.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaLobConverter.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaNullConverter.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaTemporalConverter.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVersionMapping.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmBasicMapping.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEnumeratedConverter.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdMapping.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmLobConverter.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmNullConverter.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmTemporalConverter.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVersionMapping.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java590
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasic.java89
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasicImpl.java166
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlConvertibleMapping.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlId.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlIdImpl.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersion.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersionImpl.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties13
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java189
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobComposite.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java217
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java65
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java64
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java137
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java69
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java69
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java3
72 files changed, 3277 insertions, 1393 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel b/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel
index d1e973f4ab..34e5c1ee41 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel
+++ b/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel
@@ -162,7 +162,6 @@
</genClasses>
<genClasses image="false" ecoreClass="orm.ecore#//XmlId">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//XmlId/generatedValue"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlId/temporal"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//XmlId/tableGenerator"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//XmlId/sequenceGenerator"/>
</genClasses>
@@ -174,17 +173,17 @@
<genClasses ecoreClass="orm.ecore#//XmlEmbeddedIdImpl"/>
<genClasses image="false" ecoreClass="orm.ecore#//XmlEmbedded"/>
<genClasses ecoreClass="orm.ecore#//XmlEmbeddedImpl"/>
+ <genClasses image="false" ecoreClass="orm.ecore#//XmlConvertibleMapping">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlConvertibleMapping/lob"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlConvertibleMapping/temporal"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlConvertibleMapping/enumerated"/>
+ </genClasses>
<genClasses image="false" ecoreClass="orm.ecore#//XmlBasic">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlBasic/fetch"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlBasic/optional"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlBasic/lob"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlBasic/temporal"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlBasic/enumerated"/>
</genClasses>
<genClasses ecoreClass="orm.ecore#//XmlBasicImpl"/>
- <genClasses image="false" ecoreClass="orm.ecore#//XmlVersion">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlVersion/temporal"/>
- </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//XmlVersion"/>
<genClasses ecoreClass="orm.ecore#//XmlVersionImpl"/>
<genClasses image="false" ecoreClass="orm.ecore#//XmlManyToOne"/>
<genClasses ecoreClass="orm.ecore#//XmlManyToOneImpl"/>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
index f2fb5fb3d6..67874d44a3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
+++ b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
@@ -189,10 +189,9 @@
eType="#//XmlJoinColumn" containment="true" resolveProxies="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XmlId" abstract="true" interface="true"
- eSuperTypes="#//XmlAttributeMapping #//ColumnMapping">
+ eSuperTypes="#//XmlAttributeMapping #//ColumnMapping #//XmlConvertibleMapping">
<eStructuralFeatures xsi:type="ecore:EReference" name="generatedValue" eType="#//XmlGeneratedValue"
containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//TemporalType"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="tableGenerator" eType="#//XmlTableGenerator"
containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sequenceGenerator" eType="#//XmlSequenceGenerator"
@@ -210,20 +209,21 @@
<eClassifiers xsi:type="ecore:EClass" name="XmlEmbedded" abstract="true" interface="true"
eSuperTypes="#//BaseXmlEmbedded"/>
<eClassifiers xsi:type="ecore:EClass" name="XmlEmbeddedImpl" eSuperTypes="#//AbstractXmlAttributeMapping #//XmlEmbedded"/>
+ <eClassifiers xsi:type="ecore:EClass" name="XmlConvertibleMapping" abstract="true"
+ interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="lob" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//TemporalType"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="enumerated" eType="#//EnumType"/>
+ </eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XmlBasic" abstract="true" interface="true"
- eSuperTypes="#//XmlAttributeMapping #//ColumnMapping">
+ eSuperTypes="#//XmlAttributeMapping #//ColumnMapping #//XmlConvertibleMapping">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fetch" eType="#//FetchType"
defaultValueLiteral="LAZY"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="optional" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="lob" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//TemporalType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="enumerated" eType="#//EnumType"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XmlBasicImpl" eSuperTypes="#//AbstractXmlAttributeMapping #//XmlBasic"/>
<eClassifiers xsi:type="ecore:EClass" name="XmlVersion" abstract="true" interface="true"
- eSuperTypes="#//XmlAttributeMapping #//ColumnMapping">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//TemporalType"/>
- </eClassifiers>
+ eSuperTypes="#//XmlAttributeMapping #//ColumnMapping #//XmlConvertibleMapping"/>
<eClassifiers xsi:type="ecore:EClass" name="XmlVersionImpl" eSuperTypes="#//AbstractXmlAttributeMapping #//XmlVersion"/>
<eClassifiers xsi:type="ecore:EClass" name="XmlManyToOne" abstract="true" interface="true"
eSuperTypes="#//XmlSingleRelationshipMapping"/>
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BasicMapping.java
index 44005adb88..dd39440ed1 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BasicMapping.java
@@ -18,23 +18,9 @@ package org.eclipse.jpt.core.context;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface BasicMapping extends AttributeMapping, ColumnMapping, Fetchable, Nullable
+public interface BasicMapping extends AttributeMapping, ColumnMapping, Fetchable, Nullable, ConvertibleMapping
{
FetchType DEFAULT_FETCH_TYPE = FetchType.EAGER;
- boolean isLob();
-
- void setLob(boolean value);
- String LOB_PROPERTY = "lobProperty";
-
- EnumType getEnumerated();
- EnumType getDefaultEnumerated();
- String DEFAULT_ENUMERATED_PROPERTY = "defaultEnumeratedProperty";
- EnumType DEFAULT_ENUMERATED = EnumType.ORDINAL;
-
- EnumType getSpecifiedEnumerated();
- void setSpecifiedEnumerated(EnumType newSpecifiedEnumerated);
- String SPECIFIED_ENUMERATED_PROPERTY = "specifiedEnumeratedProperty";
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ColumnMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ColumnMapping.java
index a96ad2248c..8e3c920caa 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ColumnMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ColumnMapping.java
@@ -21,9 +21,5 @@ package org.eclipse.jpt.core.context;
public interface ColumnMapping extends JpaContextNode, Column.Owner
{
Column getColumn();
-
- TemporalType getTemporal();
- void setTemporal(TemporalType value);
- String TEMPORAL_PROPERTY = "temporalProperty";
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Converter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Converter.java
new file mode 100644
index 0000000000..7936266387
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Converter.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.core.context;
+
+/**
+ *
+ *
+ * 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 Converter extends JpaContextNode
+{
+ /**
+ * Return a string that represents the type of converter.
+ * Possibilities are below, NO_CONVERTER, LOB_CONVERTER, ENUMERATED_CONVERTER, TEMPORAL_CONVERTER
+ */
+ String getType();
+
+ String NO_CONVERTER = "noConverter";
+ String LOB_CONVERTER = "lobConverter";
+ String ENUMERATED_CONVERTER = "enumeratedConverter";
+ String TEMPORAL_CONVERTER = "temporalConverter";
+
+ /**
+ * Remove the Converter from the resource model
+ */
+ void removeFromResourceModel();
+
+ /**
+ * Add the appropriate Converter to the resource model
+ */
+ void addToResourceModel();
+
+
+ //****** covariant overrides ******
+ AttributeMapping getParent();
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ConvertibleMapping.java
new file mode 100644
index 0000000000..2b340496ca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/ConvertibleMapping.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.core.context;
+
+/**
+ *
+ *
+ * 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 ConvertibleMapping
+{
+ /**
+ * Return the specified converter if it is not null and the default converter otherwise.
+ */
+ Converter getConverter();
+
+ /**
+ * Return the default converter, NO_CONVERTER except in instances where an underlying
+ * model has a converter set (an xml mapping could return a default converter if one is set in java)
+ */
+ Converter getDefaultConverter();
+ String DEFAULT_CONVERTER_PROPERTY = "defaultConverterProperty";
+
+ /**
+ * Return the specified converter or null, if none is specified in the underlying resource model
+ */
+ Converter getSpecifiedConverter();
+
+ /**
+ * Set the specified converter type, adding the converter to the resource model
+ * and removing the old converter, if any, from the resource model. JPA 1.0
+ * support Enumerated, Lob, and Temporal as converter types for basic mapppings.
+ * {@link Converter#ENUMERATED_CONVERTER}
+ * {@link Converter#LOB_CONVERTER}
+ * {@link Converter#TEMPORAL_CONVERTER}
+ * {@link Converter#NO_CONVERTER}
+ */
+ void setSpecifiedConverter(String converterType);
+ String SPECIFIED_CONVERTER_PROPERTY = "specifiedConverterProperty";
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/EnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/EnumeratedConverter.java
new file mode 100644
index 0000000000..cadf12c67f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/EnumeratedConverter.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.core.context;
+
+/**
+ *
+ *
+ * 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 EnumeratedConverter extends Converter
+{
+ EnumType getEnumType();
+
+ EnumType getDefaultEnumType();
+ EnumType DEFAULT_ENUM_TYPE = EnumType.ORDINAL;
+
+ EnumType getSpecifiedEnumType();
+ void setSpecifiedEnumType(EnumType newSpecifiedEnumType);
+ String SPECIFIED_ENUM_TYPE_PROPERTY = "specifiedEnumTypeProperty";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/IdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/IdMapping.java
index 5f3f7d75df..dc39bfa4b6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/IdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/IdMapping.java
@@ -18,7 +18,7 @@ package org.eclipse.jpt.core.context;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface IdMapping extends AttributeMapping, ColumnMapping, GeneratorHolder
+public interface IdMapping extends AttributeMapping, ColumnMapping, GeneratorHolder, ConvertibleMapping
{
GeneratedValue getGeneratedValue();
GeneratedValue addGeneratedValue();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/LobConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/LobConverter.java
new file mode 100644
index 0000000000..bb81cdd9fd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/LobConverter.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.core.context;
+
+/**
+ *
+ *
+ * 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 LobConverter extends Converter
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TemporalConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TemporalConverter.java
new file mode 100644
index 0000000000..938ffb8fc2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TemporalConverter.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.core.context;
+
+/**
+ *
+ *
+ * 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 TemporalConverter extends Converter
+{
+ TemporalType getTemporalType();
+ void setTemporalType(TemporalType temporalType);
+ String TEMPORAL_TYPE_PROPERTY = "temporalTypeProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/VersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/VersionMapping.java
index 333d0de0e6..566512ffcb 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/VersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/VersionMapping.java
@@ -19,7 +19,7 @@ package org.eclipse.jpt.core.context;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface VersionMapping
- extends AttributeMapping, ColumnMapping
+ extends AttributeMapping, ColumnMapping, ConvertibleMapping
{
- // nothing yet
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaBasicMapping.java
index 1c68a451c6..8c2fb881b0 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaBasicMapping.java
@@ -23,5 +23,8 @@ import org.eclipse.jpt.core.context.BasicMapping;
public interface JavaBasicMapping
extends JavaAttributeMapping, BasicMapping, JavaColumnMapping
{
- // nothing yet
+ //********* covariant overrides **********
+ JavaConverter getDefaultConverter();
+ JavaConverter getSpecifiedConverter();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaConverter.java
new file mode 100644
index 0000000000..64abaff8c2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaConverter.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.core.context.java;
+
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ *
+ *
+ * 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 JavaConverter extends JavaJpaContextNode, Converter
+{
+
+ /**
+ * Update the JavaConverter context model object to match the JavaResourcePersistentAttribute
+ * resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
+ */
+ void update(JavaResourcePersistentAttribute jrpa);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaIdMapping.java
index 506bfa4167..628862c0a8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaIdMapping.java
@@ -22,6 +22,10 @@ import org.eclipse.jpt.core.context.IdMapping;
*/
public interface JavaIdMapping extends JavaAttributeMapping, IdMapping, JavaColumnMapping, JavaGeneratorHolder
{
+ //********* covariant overrides **********
+ JavaConverter getDefaultConverter();
+ JavaConverter getSpecifiedConverter();
+
JavaGeneratedValue getGeneratedValue();
JavaGeneratedValue addGeneratedValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaVersionMapping.java
index 1077b1f7ad..81c44e4665 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaVersionMapping.java
@@ -23,5 +23,8 @@ import org.eclipse.jpt.core.context.VersionMapping;
public interface JavaVersionMapping
extends JavaAttributeMapping, VersionMapping, JavaColumnMapping
{
- // nothing yet
+ //********* covariant overrides **********
+ JavaConverter getDefaultConverter();
+ JavaConverter getSpecifiedConverter();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmBasicMapping.java
index ca0d425e77..9ba0f51a0c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmBasicMapping.java
@@ -30,4 +30,9 @@ public interface OrmBasicMapping extends BasicMapping, OrmAttributeMapping, OrmC
* resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
*/
void update(XmlBasic basic);
+
+ //********* covariant overrides **********
+ OrmConverter getDefaultConverter();
+ OrmConverter getSpecifiedConverter();
+
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmConverter.java
new file mode 100644
index 0000000000..6dc763c67a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmConverter.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.core.context.orm;
+
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
+
+/**
+ *
+ *
+ * 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 OrmConverter extends OrmJpaContextNode, Converter
+{
+ /**
+ * Update the OrmConverter context model object to match the XmlConvertibleMapping
+ * resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
+ */
+ void update(XmlConvertibleMapping convertableMapping);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmIdMapping.java
index 92f46e919d..29c2ad286e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmIdMapping.java
@@ -23,8 +23,6 @@ import org.eclipse.jpt.core.resource.orm.XmlId;
*/
public interface OrmIdMapping extends IdMapping, OrmColumnMapping, OrmAttributeMapping, OrmGeneratorHolder
{
- OrmGeneratedValue getGeneratedValue();
- OrmGeneratedValue addGeneratedValue();
void initialize(XmlId id);
@@ -33,4 +31,12 @@ public interface OrmIdMapping extends IdMapping, OrmColumnMapping, OrmAttributeM
* resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
*/
void update(XmlId id);
+
+ //********* covariant overrides **********
+ OrmConverter getDefaultConverter();
+ OrmConverter getSpecifiedConverter();
+
+ OrmGeneratedValue getGeneratedValue();
+ OrmGeneratedValue addGeneratedValue();
+
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmVersionMapping.java
index a982145350..46d9f9ec7e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmVersionMapping.java
@@ -30,4 +30,9 @@ public interface OrmVersionMapping extends VersionMapping, OrmColumnMapping, Orm
* resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
*/
void update(XmlVersion version);
+
+ //********* covariant overrides **********
+ OrmConverter getDefaultConverter();
+ OrmConverter getSpecifiedConverter();
+
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaBasicMapping.java
index 3ba68d6109..3f5e4c7fe2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaBasicMapping.java
@@ -14,14 +14,13 @@ import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.EnumType;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.Fetchable;
import org.eclipse.jpt.core.context.Nullable;
-import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.java.JavaBasicMapping;
import org.eclipse.jpt.core.context.java.JavaColumn;
+import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -43,14 +42,13 @@ public class GenericJavaBasicMapping extends AbstractJavaAttributeMapping<BasicA
protected Boolean specifiedOptional;
- protected EnumType specifiedEnumerated;
-
protected final JavaColumn column;
-
- protected boolean lob;
-
- protected TemporalType temporal;
+ protected JavaConverter defaultConverter;
+
+ protected JavaConverter specifiedConverter;
+
+
public GenericJavaBasicMapping(JavaPersistentAttribute parent) {
super(parent);
this.column = createJavaColumn();
@@ -61,12 +59,11 @@ public class GenericJavaBasicMapping extends AbstractJavaAttributeMapping<BasicA
}
@Override
- public void initialize(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- super.initialize(resourcePersistentAttribute);
+ public void initialize(JavaResourcePersistentAttribute jrpa) {
+ super.initialize(jrpa);
this.column.initialize(this.getResourceColumn());
- this.specifiedEnumerated = this.specifiedEnumerated(this.getEnumeratedResource());
- this.lob = this.lob(resourcePersistentAttribute);
- this.temporal = this.temporal(this.getTemporalResource());
+ this.defaultConverter = new GenericJavaNullConverter(this);
+ this.specifiedConverter = this.buildSpecifiedConverter(this.specifiedConverterType(jrpa));
}
@Override
@@ -74,24 +71,17 @@ public class GenericJavaBasicMapping extends AbstractJavaAttributeMapping<BasicA
this.specifiedFetch = this.specifiedFetchType(basicResource);
this.specifiedOptional = this.specifiedOptional(basicResource);
}
-
- protected EnumeratedAnnotation getEnumeratedResource() {
- return (EnumeratedAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
- }
-
- protected TemporalAnnotation getTemporalResource() {
- return (TemporalAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- }
public ColumnAnnotation getResourceColumn() {
return (ColumnAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
- //************** IJavaAttributeMapping implementation ***************
+ //************** AttributeMapping implementation ***************
public String getKey() {
return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
}
+ //************** JavaAttributeMapping implementation ***************
public String getAnnotationName() {
return BasicAnnotation.ANNOTATION_NAME;
}
@@ -112,7 +102,7 @@ public class GenericJavaBasicMapping extends AbstractJavaAttributeMapping<BasicA
return getTypeMapping().getTableName();
}
- //************** IBasicMapping implementation ***************
+ //************** BasicMapping implementation ***************
public JavaColumn getColumn() {
return this.column;
@@ -174,87 +164,59 @@ public class GenericJavaBasicMapping extends AbstractJavaAttributeMapping<BasicA
firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
}
- public boolean isLob() {
- return this.lob;
- }
-
- public void setLob(boolean newLob) {
- boolean oldLob = this.lob;
- this.lob = newLob;
- if (newLob) {
- if (lobResource(getResourcePersistentAttribute()) == null) {
- getResourcePersistentAttribute().addAnnotation(LobAnnotation.ANNOTATION_NAME);
- }
- }
- else {
- if (lobResource(getResourcePersistentAttribute()) != null) {
- getResourcePersistentAttribute().removeAnnotation(LobAnnotation.ANNOTATION_NAME);
- }
- }
- firePropertyChanged(BasicMapping.LOB_PROPERTY, oldLob, newLob);
- }
-
- public TemporalType getTemporal() {
- return this.temporal;
- }
-
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- this.getTemporalResource().setValue(TemporalType.toJavaResourceModel(newTemporal));
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setTemporal_(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ public JavaConverter getConverter() {
+ return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
}
- public EnumType getEnumerated() {
- return (this.getSpecifiedEnumerated() == null) ? this.getDefaultEnumerated() : this.getSpecifiedEnumerated();
+ public JavaConverter getDefaultConverter() {
+ return this.defaultConverter;
}
- public EnumType getDefaultEnumerated() {
- return BasicMapping.DEFAULT_ENUMERATED;
+ public JavaConverter getSpecifiedConverter() {
+ return this.specifiedConverter;
}
- public EnumType getSpecifiedEnumerated() {
- return this.specifiedEnumerated;
+ protected String getSpecifedConverterType() {
+ if (this.specifiedConverter == null) {
+ return Converter.NO_CONVERTER;
+ }
+ return this.specifiedConverter.getType();
}
- public void setSpecifiedEnumerated(EnumType newSpecifiedEnumerated) {
- EnumType oldEnumerated = this.specifiedEnumerated;
- this.specifiedEnumerated = newSpecifiedEnumerated;
- this.getEnumeratedResource().setValue(EnumType.toJavaResourceModel(newSpecifiedEnumerated));
- firePropertyChanged(BasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated);
+ public void setSpecifiedConverter(String converterType) {
+ if (getSpecifedConverterType() == converterType) {
+ return;
+ }
+ JavaConverter oldConverter = this.specifiedConverter;
+ JavaConverter newConverter = buildSpecifiedConverter(converterType);
+ this.specifiedConverter = null;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.specifiedConverter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
}
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedEnumerated_(EnumType newSpecifiedEnumerated) {
- EnumType oldEnumerated = this.specifiedEnumerated;
- this.specifiedEnumerated = newSpecifiedEnumerated;
- firePropertyChanged(BasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated);
+ protected void setSpecifiedConverter(JavaConverter newConverter) {
+ JavaConverter oldConverter = this.specifiedConverter;
+ this.specifiedConverter = newConverter;
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
}
@Override
- public void update(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- super.update(resourcePersistentAttribute);
+ public void update(JavaResourcePersistentAttribute jrpa) {
+ super.update(jrpa);
this.column.update(this.getResourceColumn());
- this.setSpecifiedEnumerated_(this.specifiedEnumerated(this.getEnumeratedResource()));
- this.setLob(this.lob(resourcePersistentAttribute));
- this.setTemporal_(this.temporal(this.getTemporalResource()));
+ if (specifiedConverterType(jrpa) == getSpecifedConverterType()) {
+ getSpecifiedConverter().update(jrpa);
+ }
+ else {
+ JavaConverter javaConverter = buildSpecifiedConverter(specifiedConverterType(jrpa));
+ setSpecifiedConverter(javaConverter);
+ }
}
@Override
@@ -271,23 +233,33 @@ public class GenericJavaBasicMapping extends AbstractJavaAttributeMapping<BasicA
return basic.getOptional();
}
- protected EnumType specifiedEnumerated(EnumeratedAnnotation enumerated) {
- return EnumType.fromJavaResourceModel(enumerated.getValue());
- }
-
- protected boolean lob(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return lobResource(resourcePersistentAttribute) != null;
- }
-
- protected LobAnnotation lobResource(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (LobAnnotation) resourcePersistentAttribute.getAnnotation(LobAnnotation.ANNOTATION_NAME);
+ protected JavaConverter buildSpecifiedConverter(String converterType) {
+ if (converterType == Converter.ENUMERATED_CONVERTER) {
+ return new GenericJavaEnumeratedConverter(this, this.resourcePersistentAttribute);
+ }
+ else if (converterType == Converter.TEMPORAL_CONVERTER) {
+ return new GenericJavaTemporalConverter(this, this.resourcePersistentAttribute);
+ }
+ else if (converterType == Converter.LOB_CONVERTER) {
+ return new GenericJavaLobConverter(this, this.resourcePersistentAttribute);
+ }
+ return null;
}
- protected TemporalType temporal(TemporalAnnotation temporal) {
- return TemporalType.fromJavaResourceModel(temporal.getValue());
+ protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) {
+ if (jrpa.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME) != null) {
+ return Converter.ENUMERATED_CONVERTER;
+ }
+ else if (jrpa.getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+ else if (jrpa.getAnnotation(LobAnnotation.ANNOTATION_NAME) != null) {
+ return Converter.LOB_CONVERTER;
+ }
+
+ return null;
}
-
@Override
public boolean isOverridableAttributeMapping() {
return true;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaEnumeratedConverter.java
new file mode 100644
index 0000000000..9aaec3174d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaEnumeratedConverter.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * 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.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.EnumType;
+import org.eclipse.jpt.core.context.EnumeratedConverter;
+import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.core.context.java.JavaConverter;
+import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class GenericJavaEnumeratedConverter extends AbstractJavaJpaContextNode
+ implements JavaConverter, EnumeratedConverter
+{
+ private EnumType specifiedEnumType;
+
+ private JavaResourcePersistentAttribute resourcePersistenceAttribute;
+
+ public GenericJavaEnumeratedConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
+ super(parent);
+ this.initialize(jrpa);
+ }
+
+ @Override
+ public JavaAttributeMapping getParent() {
+ return (JavaAttributeMapping) super.getParent();
+ }
+
+ public String getType() {
+ return Converter.ENUMERATED_CONVERTER;
+ }
+
+ protected String getAnnotationName() {
+ return EnumeratedAnnotation.ANNOTATION_NAME;
+ }
+
+ public void addToResourceModel() {
+ this.resourcePersistenceAttribute.addAnnotation(getAnnotationName());
+ }
+
+ public void removeFromResourceModel() {
+ this.resourcePersistenceAttribute.removeAnnotation(getAnnotationName());
+ }
+
+ public EnumType getEnumType() {
+ return getSpecifiedEnumType() == null ? getDefaultEnumType() : getSpecifiedEnumType();
+ }
+
+ public EnumType getDefaultEnumType() {
+ return EnumeratedConverter.DEFAULT_ENUM_TYPE;
+ }
+
+ public EnumType getSpecifiedEnumType() {
+ return this.specifiedEnumType;
+ }
+
+ public void setSpecifiedEnumType(EnumType newSpecifiedEnumType) {
+ EnumType oldSpecifiedEnumType = this.specifiedEnumType;
+ this.specifiedEnumType = newSpecifiedEnumType;
+ this.getResourceEnumerated().setValue(EnumType.toJavaResourceModel(newSpecifiedEnumType));
+ firePropertyChanged(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY, oldSpecifiedEnumType, newSpecifiedEnumType);
+ }
+
+ protected void setSpecifiedEnumType_(EnumType newSpecifiedEnumType) {
+ EnumType oldSpecifiedEnumType = this.specifiedEnumType;
+ this.specifiedEnumType = newSpecifiedEnumType;
+ firePropertyChanged(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY, oldSpecifiedEnumType, newSpecifiedEnumType);
+ }
+
+ protected EnumeratedAnnotation getResourceEnumerated() {
+ return (EnumeratedAnnotation) this.resourcePersistenceAttribute.getAnnotation(getAnnotationName());
+ }
+
+ protected void initialize(JavaResourcePersistentAttribute jrpa) {
+ this.resourcePersistenceAttribute = jrpa;
+ this.specifiedEnumType = this.specifiedEnumType(getResourceEnumerated());
+ }
+
+ public void update(JavaResourcePersistentAttribute jrpa) {
+ this.resourcePersistenceAttribute = jrpa;
+ this.setSpecifiedEnumType_(this.specifiedEnumType(getResourceEnumerated()));
+ }
+
+ protected EnumType specifiedEnumType(EnumeratedAnnotation resourceEnumerated) {
+ return resourceEnumerated == null ? null : EnumType.fromJavaResourceModel(resourceEnumerated.getValue());
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getResourceEnumerated().getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdMapping.java
index 7c711a5180..cbfa956dee 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdMapping.java
@@ -13,10 +13,10 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.ColumnMapping;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.java.JavaColumn;
+import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
import org.eclipse.jpt.core.context.java.JavaGenerator;
import org.eclipse.jpt.core.context.java.JavaIdMapping;
@@ -48,12 +48,15 @@ public class GenericJavaIdMapping extends AbstractJavaAttributeMapping<IdAnnotat
protected JavaGeneratedValue generatedValue;
- protected TemporalType temporal;
-
protected JavaTableGenerator tableGenerator;
protected JavaSequenceGenerator sequenceGenerator;
+ protected JavaConverter defaultConverter;
+
+ protected JavaConverter specifiedConverter;
+
+
public GenericJavaIdMapping(JavaPersistentAttribute parent) {
super(parent);
this.column = createJavaColumn();
@@ -64,46 +67,43 @@ public class GenericJavaIdMapping extends AbstractJavaAttributeMapping<IdAnnotat
}
@Override
- public void initialize(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- super.initialize(resourcePersistentAttribute);
+ public void initialize(JavaResourcePersistentAttribute jrpa) {
+ super.initialize(jrpa);
this.column.initialize(this.getResourceColumn());
- this.temporal = this.temporal(this.getResourceTemporal());
- this.initializeTableGenerator(resourcePersistentAttribute);
- this.initializeSequenceGenerator(resourcePersistentAttribute);
- this.initializeGeneratedValue(resourcePersistentAttribute);
+ this.initializeTableGenerator(jrpa);
+ this.initializeSequenceGenerator(jrpa);
+ this.initializeGeneratedValue(jrpa);
this.updatePersistenceUnitGenerators();
+ this.defaultConverter = new GenericJavaNullConverter(this);
+ this.specifiedConverter = this.buildSpecifiedConverter(this.specifiedConverterType(jrpa));
}
- protected void initializeTableGenerator(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- TableGeneratorAnnotation tableGeneratorResource = tableGenerator(resourcePersistentAttribute);
- if (tableGeneratorResource != null) {
- this.tableGenerator = buildTableGenerator(tableGeneratorResource);
+ protected void initializeTableGenerator(JavaResourcePersistentAttribute jrpa) {
+ TableGeneratorAnnotation resourceTableGenerator = getResourceTableGenerator(jrpa);
+ if (resourceTableGenerator != null) {
+ this.tableGenerator = buildTableGenerator(resourceTableGenerator);
}
}
- protected void initializeSequenceGenerator(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- SequenceGeneratorAnnotation sequenceGeneratorResource = sequenceGenerator(resourcePersistentAttribute);
- if (sequenceGeneratorResource != null) {
- this.sequenceGenerator = buildSequenceGenerator(sequenceGeneratorResource);
+ protected void initializeSequenceGenerator(JavaResourcePersistentAttribute jrpa) {
+ SequenceGeneratorAnnotation resourceSequenceGenerator = getResourceSequenceGenerator(jrpa);
+ if (resourceSequenceGenerator != null) {
+ this.sequenceGenerator = buildSequenceGenerator(resourceSequenceGenerator);
}
}
- protected void initializeGeneratedValue(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- GeneratedValueAnnotation generatedValueResource = generatedValue(resourcePersistentAttribute);
- if (generatedValueResource != null) {
- this.generatedValue = buildGeneratedValue(generatedValueResource);
+ protected void initializeGeneratedValue(JavaResourcePersistentAttribute jrpa) {
+ GeneratedValueAnnotation resourceGeneratedValue = getResourceGeneratedValue(jrpa);
+ if (resourceGeneratedValue != null) {
+ this.generatedValue = buildGeneratedValue(resourceGeneratedValue);
}
}
- protected TemporalAnnotation getResourceTemporal() {
- return (TemporalAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- }
-
public ColumnAnnotation getResourceColumn() {
return (ColumnAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
- //************** IJavaAttributeMapping implementation ***************
+ //************** JavaAttributeMapping implementation ***************
public String getKey() {
return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
@@ -130,34 +130,11 @@ public class GenericJavaIdMapping extends AbstractJavaAttributeMapping<IdAnnotat
return getTypeMapping().getTableName();
}
- //************** IIdMapping implementation ***************
+ //************** IdMapping implementation ***************
public JavaColumn getColumn() {
return this.column;
}
-
- public TemporalType getTemporal() {
- return this.temporal;
- }
-
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- this.getResourceTemporal().setValue(TemporalType.toJavaResourceModel(newTemporal));
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setTemporal_(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
- }
public JavaGeneratedValue addGeneratedValue() {
if (getGeneratedValue() != null) {
@@ -260,46 +237,90 @@ public class GenericJavaIdMapping extends AbstractJavaAttributeMapping<IdAnnotat
(getTableGenerator() == null) ? EmptyIterator.instance() : new SingleElementIterator(getTableGenerator()));
}
+ public JavaConverter getConverter() {
+ return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
+ }
+
+ public JavaConverter getDefaultConverter() {
+ return this.defaultConverter;
+ }
+
+ public JavaConverter getSpecifiedConverter() {
+ return this.specifiedConverter;
+ }
+
+ protected String getSpecifedConverterType() {
+ if (this.specifiedConverter == null) {
+ return Converter.NO_CONVERTER;
+ }
+ return this.specifiedConverter.getType();
+ }
+
+ public void setSpecifiedConverter(String converterType) {
+ if (getSpecifedConverterType() == converterType) {
+ return;
+ }
+ JavaConverter oldConverter = this.specifiedConverter;
+ JavaConverter newConverter = buildSpecifiedConverter(converterType);
+ this.specifiedConverter = null;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.specifiedConverter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
+ protected void setSpecifiedConverter(JavaConverter newConverter) {
+ JavaConverter oldConverter = this.specifiedConverter;
+ this.specifiedConverter = newConverter;
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
@Override
- public void update(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- super.update(resourcePersistentAttribute);
+ public void update(JavaResourcePersistentAttribute jrpa) {
+ super.update(jrpa);
this.column.update(this.getResourceColumn());
- this.setTemporal_(this.temporal(this.getResourceTemporal()));
- this.updateTableGenerator(resourcePersistentAttribute);
- this.updateSequenceGenerator(resourcePersistentAttribute);
- this.updateGeneratedValue(resourcePersistentAttribute);
+ this.updateTableGenerator(jrpa);
+ this.updateSequenceGenerator(jrpa);
+ this.updateGeneratedValue(jrpa);
this.updatePersistenceUnitGenerators();
+ if (specifiedConverterType(jrpa) == getSpecifedConverterType()) {
+ getSpecifiedConverter().update(jrpa);
+ }
+ else {
+ JavaConverter javaConverter = buildSpecifiedConverter(specifiedConverterType(jrpa));
+ setSpecifiedConverter(javaConverter);
+ }
}
- protected TemporalType temporal(TemporalAnnotation temporal) {
- return TemporalType.fromJavaResourceModel(temporal.getValue());
- }
-
- protected void updateTableGenerator(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- TableGeneratorAnnotation tableGeneratorResource = tableGenerator(resourcePersistentAttribute);
- if (tableGeneratorResource == null) {
+ protected void updateTableGenerator(JavaResourcePersistentAttribute jrpa) {
+ TableGeneratorAnnotation resourceTableGenerator = getResourceTableGenerator(jrpa);
+ if (resourceTableGenerator == null) {
if (getTableGenerator() != null) {
setTableGenerator(null);
}
}
else {
if (getTableGenerator() == null) {
- setTableGenerator(buildTableGenerator(tableGeneratorResource));
+ setTableGenerator(buildTableGenerator(resourceTableGenerator));
}
else {
- getTableGenerator().update(tableGeneratorResource);
+ getTableGenerator().update(resourceTableGenerator);
}
}
}
- protected JavaTableGenerator buildTableGenerator(TableGeneratorAnnotation tableGeneratorResource) {
+ protected JavaTableGenerator buildTableGenerator(TableGeneratorAnnotation resourceTableGenerator) {
JavaTableGenerator tableGenerator = getJpaFactory().buildJavaTableGenerator(this);
- tableGenerator.initialize(tableGeneratorResource);
+ tableGenerator.initialize(resourceTableGenerator);
return tableGenerator;
}
- protected void updateSequenceGenerator(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- SequenceGeneratorAnnotation sequenceGeneratorResource = sequenceGenerator(resourcePersistentAttribute);
+ protected void updateSequenceGenerator(JavaResourcePersistentAttribute jrpa) {
+ SequenceGeneratorAnnotation sequenceGeneratorResource = getResourceSequenceGenerator(jrpa);
if (sequenceGeneratorResource == null) {
if (getSequenceGenerator() != null) {
setSequenceGenerator(null);
@@ -315,45 +336,45 @@ public class GenericJavaIdMapping extends AbstractJavaAttributeMapping<IdAnnotat
}
}
- protected JavaSequenceGenerator buildSequenceGenerator(SequenceGeneratorAnnotation sequenceGeneratorResource) {
+ protected JavaSequenceGenerator buildSequenceGenerator(SequenceGeneratorAnnotation resourceSequenceGenerator) {
JavaSequenceGenerator sequenceGenerator = getJpaFactory().buildJavaSequenceGenerator(this);
- sequenceGenerator.initialize(sequenceGeneratorResource);
+ sequenceGenerator.initialize(resourceSequenceGenerator);
return sequenceGenerator;
}
- protected void updateGeneratedValue(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- GeneratedValueAnnotation generatedValueResource = generatedValue(resourcePersistentAttribute);
- if (generatedValueResource == null) {
+ protected void updateGeneratedValue(JavaResourcePersistentAttribute jrpa) {
+ GeneratedValueAnnotation resourceGeneratedValue = getResourceGeneratedValue(jrpa);
+ if (resourceGeneratedValue == null) {
if (getGeneratedValue() != null) {
setGeneratedValue(null);
}
}
else {
if (getGeneratedValue() == null) {
- setGeneratedValue(buildGeneratedValue(generatedValueResource));
+ setGeneratedValue(buildGeneratedValue(resourceGeneratedValue));
}
else {
- getGeneratedValue().update(generatedValueResource);
+ getGeneratedValue().update(resourceGeneratedValue);
}
}
}
- protected JavaGeneratedValue buildGeneratedValue(GeneratedValueAnnotation generatedValueResource) {
+ protected JavaGeneratedValue buildGeneratedValue(GeneratedValueAnnotation resourceGeneratedValue) {
JavaGeneratedValue generatedValue = getJpaFactory().buildJavaGeneratedValue(this);
- generatedValue.initialize(generatedValueResource);
+ generatedValue.initialize(resourceGeneratedValue);
return generatedValue;
}
- protected TableGeneratorAnnotation tableGenerator(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (TableGeneratorAnnotation) resourcePersistentAttribute.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
+ protected TableGeneratorAnnotation getResourceTableGenerator(JavaResourcePersistentAttribute jrpa) {
+ return (TableGeneratorAnnotation) jrpa.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
}
- protected SequenceGeneratorAnnotation sequenceGenerator(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (SequenceGeneratorAnnotation) resourcePersistentAttribute.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
+ protected SequenceGeneratorAnnotation getResourceSequenceGenerator(JavaResourcePersistentAttribute jrpa) {
+ return (SequenceGeneratorAnnotation) jrpa.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
}
- protected GeneratedValueAnnotation generatedValue(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (GeneratedValueAnnotation) resourcePersistentAttribute.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
+ protected GeneratedValueAnnotation getResourceGeneratedValue(JavaResourcePersistentAttribute jrpa) {
+ return (GeneratedValueAnnotation) jrpa.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
}
protected void updatePersistenceUnitGenerators() {
@@ -366,7 +387,21 @@ public class GenericJavaIdMapping extends AbstractJavaAttributeMapping<IdAnnotat
}
}
+ protected JavaConverter buildSpecifiedConverter(String converterType) {
+ if (converterType == Converter.TEMPORAL_CONVERTER) {
+ return new GenericJavaTemporalConverter(this, this.resourcePersistentAttribute);
+ }
+ return null;
+ }
+ protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) {
+ if (jrpa.getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+
+ return null;
+ }
+
// *************************************************************************
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaLobConverter.java
new file mode 100644
index 0000000000..038d0f3411
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaLobConverter.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.LobConverter;
+import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.core.context.java.JavaConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.LobAnnotation;
+import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class GenericJavaLobConverter extends AbstractJavaJpaContextNode
+ implements LobConverter, JavaConverter
+{
+ private JavaResourcePersistentAttribute resourcePersistentAttribute;
+
+
+ public GenericJavaLobConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
+ super(parent);
+ this.initialize(jrpa);
+ }
+
+ @Override
+ public JavaAttributeMapping getParent() {
+ return (JavaAttributeMapping) super.getParent();
+ }
+
+ public String getType() {
+ return Converter.LOB_CONVERTER;
+ }
+
+ protected String getAnnotationName() {
+ return LobAnnotation.ANNOTATION_NAME;
+ }
+
+ public void addToResourceModel() {
+ this.resourcePersistentAttribute.addAnnotation(getAnnotationName());
+ }
+
+ public void removeFromResourceModel() {
+ this.resourcePersistentAttribute.removeAnnotation(getAnnotationName());
+ }
+
+ protected TemporalAnnotation getResourceLob() {
+ return (TemporalAnnotation) this.resourcePersistentAttribute.getAnnotation(getAnnotationName());
+ }
+
+ protected void initialize(JavaResourcePersistentAttribute jrpa) {
+ this.resourcePersistentAttribute = jrpa;
+ }
+
+ public void update(JavaResourcePersistentAttribute jrpa) {
+ this.resourcePersistentAttribute = jrpa;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return getResourceLob().getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaNullConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaNullConverter.java
new file mode 100644
index 0000000000..4b5c29ce93
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaNullConverter.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.core.context.java.JavaConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class GenericJavaNullConverter extends AbstractJavaJpaContextNode
+ implements JavaConverter
+{
+
+ public GenericJavaNullConverter(JavaAttributeMapping parent) {
+ super(parent);
+ }
+
+ @Override
+ public JavaAttributeMapping getParent() {
+ return (JavaAttributeMapping) super.getParent();
+ }
+
+ public String getType() {
+ return Converter.NO_CONVERTER;
+ }
+
+ public void addToResourceModel() {
+
+ }
+
+ public void removeFromResourceModel() {
+
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void update(JavaResourcePersistentAttribute jrpa) {
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaTemporalConverter.java
new file mode 100644
index 0000000000..7abb0ae17d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaTemporalConverter.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.TemporalConverter;
+import org.eclipse.jpt.core.context.TemporalType;
+import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.core.context.java.JavaConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class GenericJavaTemporalConverter extends AbstractJavaJpaContextNode
+ implements JavaConverter, TemporalConverter
+{
+ private TemporalType temporalType;
+
+ private JavaResourcePersistentAttribute resourcePersistentAttribute;
+
+ public GenericJavaTemporalConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
+ super(parent);
+ this.initialize(jrpa);
+ }
+
+ @Override
+ public JavaAttributeMapping getParent() {
+ return (JavaAttributeMapping) super.getParent();
+ }
+
+ public String getType() {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+
+ protected String getAnnotationName() {
+ return TemporalAnnotation.ANNOTATION_NAME;
+ }
+
+ public void addToResourceModel() {
+ this.resourcePersistentAttribute.addAnnotation(getAnnotationName());
+ }
+
+ public void removeFromResourceModel() {
+ this.resourcePersistentAttribute.removeAnnotation(getAnnotationName());
+ }
+
+ public TemporalType getTemporalType() {
+ return this.temporalType;
+ }
+
+ public void setTemporalType(TemporalType newTemporalType) {
+ TemporalType oldTemporalType = this.temporalType;
+ this.temporalType = newTemporalType;
+ this.getResourceTemporal().setValue(TemporalType.toJavaResourceModel(newTemporalType));
+ firePropertyChanged(TEMPORAL_TYPE_PROPERTY, oldTemporalType, newTemporalType);
+ }
+
+ protected void setTemporalType_(TemporalType newTemporalType) {
+ TemporalType oldTemporalType = this.temporalType;
+ this.temporalType = newTemporalType;
+ firePropertyChanged(TEMPORAL_TYPE_PROPERTY, oldTemporalType, newTemporalType);
+ }
+
+
+ protected TemporalAnnotation getResourceTemporal() {
+ return (TemporalAnnotation) this.resourcePersistentAttribute.getAnnotation(getAnnotationName());
+ }
+
+ protected void initialize(JavaResourcePersistentAttribute jrpa) {
+ this.resourcePersistentAttribute = jrpa;
+ this.temporalType = this.temporalType(getResourceTemporal());
+ }
+
+ public void update(JavaResourcePersistentAttribute jrpa) {
+ this.resourcePersistentAttribute = jrpa;
+ this.setTemporalType_(this.temporalType(getResourceTemporal()));
+ }
+
+ protected TemporalType temporalType(TemporalAnnotation resourceTemporal) {
+ return resourceTemporal == null ? null : TemporalType.fromJavaResourceModel(resourceTemporal.getValue());
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getResourceTemporal().getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVersionMapping.java
index 3511581930..64bcf577fa 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVersionMapping.java
@@ -13,9 +13,9 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.TemporalType;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.java.JavaColumn;
+import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaVersionMapping;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
@@ -33,8 +33,10 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class GenericJavaVersionMapping extends AbstractJavaAttributeMapping<VersionAnnotation> implements JavaVersionMapping
{
protected final JavaColumn column;
+
+ protected JavaConverter defaultConverter;
- protected TemporalType temporal;
+ protected JavaConverter specifiedConverter;
public GenericJavaVersionMapping(JavaPersistentAttribute parent) {
super(parent);
@@ -46,16 +48,13 @@ public class GenericJavaVersionMapping extends AbstractJavaAttributeMapping<Vers
}
@Override
- public void initialize(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- super.initialize(resourcePersistentAttribute);
+ public void initialize(JavaResourcePersistentAttribute jrpa) {
+ super.initialize(jrpa);
this.column.initialize(this.getResourceColumn());
- this.temporal = this.temporal(this.getResourceTemporal());
- }
-
- protected TemporalAnnotation getResourceTemporal() {
- return (TemporalAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ this.defaultConverter = new GenericJavaNullConverter(this);
+ this.specifiedConverter = this.buildSpecifiedConverter(this.specifiedConverterType(jrpa));
}
-
+
public ColumnAnnotation getResourceColumn() {
return (ColumnAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
@@ -91,27 +90,75 @@ public class GenericJavaVersionMapping extends AbstractJavaAttributeMapping<Vers
public JavaColumn getColumn() {
return this.column;
}
-
- public TemporalType getTemporal() {
- return this.temporal;
+
+ public JavaConverter getConverter() {
+ return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
}
-
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- this.getResourceTemporal().setValue(TemporalType.toJavaResourceModel(newTemporal));
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+
+ public JavaConverter getDefaultConverter() {
+ return this.defaultConverter;
+ }
+
+ public JavaConverter getSpecifiedConverter() {
+ return this.specifiedConverter;
+ }
+
+ protected String getSpecifedConverterType() {
+ if (this.specifiedConverter == null) {
+ return Converter.NO_CONVERTER;
+ }
+ return this.specifiedConverter.getType();
+ }
+
+ public void setSpecifiedConverter(String converterType) {
+ if (getSpecifedConverterType() == converterType) {
+ return;
+ }
+ JavaConverter oldConverter = this.specifiedConverter;
+ JavaConverter newConverter = buildSpecifiedConverter(converterType);
+ this.specifiedConverter = null;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.specifiedConverter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
+ protected void setSpecifiedConverter(JavaConverter newConverter) {
+ JavaConverter oldConverter = this.specifiedConverter;
+ this.specifiedConverter = newConverter;
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
}
+
@Override
- public void update(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- super.update(resourcePersistentAttribute);
+ public void update(JavaResourcePersistentAttribute jrpa) {
+ super.update(jrpa);
this.column.update(this.getResourceColumn());
- this.setTemporal(this.temporal(this.getResourceTemporal()));
+ if (specifiedConverterType(jrpa) == getSpecifedConverterType()) {
+ getSpecifiedConverter().update(jrpa);
+ }
+ else {
+ JavaConverter javaConverter = buildSpecifiedConverter(specifiedConverterType(jrpa));
+ setSpecifiedConverter(javaConverter);
+ }
}
- protected TemporalType temporal(TemporalAnnotation temporal) {
- return TemporalType.fromJavaResourceModel(temporal.getValue());
+ protected JavaConverter buildSpecifiedConverter(String converterType) {
+ if (converterType == Converter.TEMPORAL_CONVERTER) {
+ return new GenericJavaTemporalConverter(this, this.resourcePersistentAttribute);
+ }
+ return null;
+ }
+
+ protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) {
+ if (jrpa.getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+ return null;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java
index ec1153a0bc..5d2939b7cb 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java
@@ -100,20 +100,20 @@ public abstract class AbstractOrmAttributeMapping<T extends XmlAttributeMapping>
setName(oldMapping.getName());
}
- public void initializeFromXmlColumnMapping(OrmColumnMapping oldMapping) {
+ public void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
initializeFromOrmAttributeMapping((OrmAttributeMapping) oldMapping);
}
- public void initializeFromXmlNonOwningMapping(NonOwningMapping oldMapping) {
+ public void initializeFromOrmNonOwningMapping(NonOwningMapping oldMapping) {
initializeFromOrmAttributeMapping((OrmAttributeMapping) oldMapping);
}
public void initializeFromOrmBasicMapping(OrmBasicMapping oldMapping) {
- initializeFromXmlColumnMapping(oldMapping);
+ initializeFromOrmColumnMapping(oldMapping);
}
public void initializeFromOrmIdMapping(OrmIdMapping oldMapping) {
- initializeFromXmlColumnMapping(oldMapping);
+ initializeFromOrmColumnMapping(oldMapping);
}
public void initializeFromOrmTransientMapping(OrmTransientMapping oldMapping) {
@@ -133,38 +133,38 @@ public abstract class AbstractOrmAttributeMapping<T extends XmlAttributeMapping>
}
public void initializeFromOrmVersionMapping(OrmVersionMapping oldMapping) {
- initializeFromXmlColumnMapping(oldMapping);
+ initializeFromOrmColumnMapping(oldMapping);
}
- public void initializeFromXmlRelationshipMapping(OrmRelationshipMapping oldMapping) {
+ public void initializeFromOrmRelationshipMapping(OrmRelationshipMapping oldMapping) {
initializeFromOrmAttributeMapping(oldMapping);
}
- public void initializeFromXmlMulitRelationshipMapping(OrmMultiRelationshipMapping oldMapping) {
- initializeFromXmlRelationshipMapping(oldMapping);
+ public void initializeFromOrmMulitRelationshipMapping(OrmMultiRelationshipMapping oldMapping) {
+ initializeFromOrmRelationshipMapping(oldMapping);
}
- public void initializeFromXmlSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
- initializeFromXmlRelationshipMapping(oldMapping);
+ public void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
+ initializeFromOrmRelationshipMapping(oldMapping);
}
public void initializeFromOrmOneToManyMapping(OrmOneToManyMapping oldMapping) {
- initializeFromXmlNonOwningMapping(oldMapping);
- initializeFromXmlMulitRelationshipMapping(oldMapping);
+ initializeFromOrmNonOwningMapping(oldMapping);
+ initializeFromOrmMulitRelationshipMapping(oldMapping);
}
public void initializeFromOrmManyToOneMapping(OrmManyToOneMapping oldMapping) {
- initializeFromXmlSingleRelationshipMapping(oldMapping);
+ initializeFromOrmSingleRelationshipMapping(oldMapping);
}
public void initializeFromOrmOneToOneMapping(OrmOneToOneMapping oldMapping) {
- initializeFromXmlNonOwningMapping(oldMapping);
- initializeFromXmlSingleRelationshipMapping(oldMapping);
+ initializeFromOrmNonOwningMapping(oldMapping);
+ initializeFromOrmSingleRelationshipMapping(oldMapping);
}
public void initializeFromOrmManyToManyMapping(OrmManyToManyMapping oldMapping) {
- initializeFromXmlNonOwningMapping(oldMapping);
- initializeFromXmlMulitRelationshipMapping(oldMapping);
+ initializeFromOrmNonOwningMapping(oldMapping);
+ initializeFromOrmMulitRelationshipMapping(oldMapping);
}
public String getPrimaryKeyColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
index 11837f00f0..336d88df89 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
@@ -53,8 +53,8 @@ public abstract class AbstractOrmMultiRelationshipMapping<T extends XmlMultiRela
}
@Override
- public void initializeFromXmlMulitRelationshipMapping(OrmMultiRelationshipMapping oldMapping) {
- super.initializeFromXmlMulitRelationshipMapping(oldMapping);
+ public void initializeFromOrmMulitRelationshipMapping(OrmMultiRelationshipMapping oldMapping) {
+ super.initializeFromOrmMulitRelationshipMapping(oldMapping);
getJoinTable().initializeFrom(oldMapping.getJoinTable());
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java
index 7406f6f2c4..af629eef87 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java
@@ -113,8 +113,8 @@ public abstract class AbstractOrmRelationshipMapping<T extends XmlRelationshipMa
@Override
- public void initializeFromXmlRelationshipMapping(OrmRelationshipMapping oldMapping) {
- super.initializeFromXmlRelationshipMapping(oldMapping);
+ public void initializeFromOrmRelationshipMapping(OrmRelationshipMapping oldMapping) {
+ super.initializeFromOrmRelationshipMapping(oldMapping);
setSpecifiedTargetEntity(oldMapping.getSpecifiedTargetEntity());
setSpecifiedFetch(oldMapping.getSpecifiedFetch());
getCascade().initializeFrom(oldMapping.getCascade());
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
index 2939478347..07f1c4e525 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
@@ -54,8 +54,8 @@ public abstract class AbstractOrmSingleRelationshipMapping<T extends XmlSingleRe
}
@Override
- public void initializeFromXmlSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
- super.initializeFromXmlSingleRelationshipMapping(oldMapping);
+ public void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
+ super.initializeFromOrmSingleRelationshipMapping(oldMapping);
int index = 0;
for (JoinColumn joinColumn : CollectionTools.iterable(oldMapping.specifiedJoinColumns())) {
OrmJoinColumn newJoinColumn = addSpecifiedJoinColumn(index++);
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmBasicMapping.java
index 70bf244cbd..61c9c109be 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmBasicMapping.java
@@ -12,16 +12,15 @@ package org.eclipse.jpt.core.internal.context.orm;
import java.util.List;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.EnumType;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.Fetchable;
import org.eclipse.jpt.core.context.Nullable;
-import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
import org.eclipse.jpt.core.context.orm.OrmColumn;
import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
+import org.eclipse.jpt.core.context.orm.OrmConverter;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -42,11 +41,9 @@ public class GenericOrmBasicMapping extends AbstractOrmAttributeMapping<XmlBasic
protected Boolean specifiedOptional;
- protected EnumType specifiedEnumerated;
-
- protected TemporalType temporal;
+ protected OrmConverter defaultConverter;
- protected boolean lob;
+ protected OrmConverter specifiedConverter;
public GenericOrmBasicMapping(OrmPersistentAttribute parent) {
super(parent);
@@ -102,65 +99,48 @@ public class GenericOrmBasicMapping extends AbstractOrmAttributeMapping<XmlBasic
this.specifiedOptional = newSpecifiedOptional;
firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
}
-
- public boolean isLob() {
- return this.lob;
- }
-
- public void setLob(boolean newLob) {
- boolean oldLob = this.lob;
- this.lob = newLob;
- this.getAttributeMapping().setLob(newLob);
- firePropertyChanged(BasicMapping.LOB_PROPERTY, oldLob, newLob);
- }
- protected void setLob_(boolean newLob) {
- boolean oldLob = this.lob;
- this.lob = newLob;
- firePropertyChanged(BasicMapping.LOB_PROPERTY, oldLob, newLob);
- }
-
- public TemporalType getTemporal() {
- return this.temporal;
- }
-
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- this.getAttributeMapping().setTemporal(TemporalType.toOrmResourceModel(newTemporal));
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
- }
-
- protected void setTemporal_(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ public OrmConverter getConverter() {
+ return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
}
- public EnumType getEnumerated() {
- return (this.getSpecifiedEnumerated() == null) ? this.getDefaultEnumerated() : this.getSpecifiedEnumerated();
+ public OrmConverter getDefaultConverter() {
+ return this.defaultConverter;
}
- public EnumType getDefaultEnumerated() {
- return BasicMapping.DEFAULT_ENUMERATED;
+ public OrmConverter getSpecifiedConverter() {
+ return this.specifiedConverter;
}
- public EnumType getSpecifiedEnumerated() {
- return this.specifiedEnumerated;
+ protected String getSpecifedConverterType() {
+ if (this.specifiedConverter == null) {
+ return Converter.NO_CONVERTER;
+ }
+ return this.specifiedConverter.getType();
}
- public void setSpecifiedEnumerated(EnumType newSpecifiedEnumerated) {
- EnumType oldEnumerated = this.specifiedEnumerated;
- this.specifiedEnumerated = newSpecifiedEnumerated;
- this.getAttributeMapping().setEnumerated(EnumType.toOrmResourceModel(newSpecifiedEnumerated));
- firePropertyChanged(BasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated);
+ public void setSpecifiedConverter(String converterType) {
+ if (getSpecifedConverterType() == converterType) {
+ return;
+ }
+ OrmConverter oldConverter = this.specifiedConverter;
+ OrmConverter newConverter = buildSpecifiedConverter(converterType);
+ this.specifiedConverter = null;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.specifiedConverter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
}
- protected void setSpecifiedEnumerated_(EnumType newSpecifiedEnumerated) {
- EnumType oldEnumerated = this.specifiedEnumerated;
- this.specifiedEnumerated = newSpecifiedEnumerated;
- firePropertyChanged(BasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated);
- }
+ protected void setSpecifiedConverter(OrmConverter newConverter) {
+ OrmConverter oldConverter = this.specifiedConverter;
+ this.specifiedConverter = newConverter;
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
public String getKey() {
return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
@@ -172,9 +152,8 @@ public class GenericOrmBasicMapping extends AbstractOrmAttributeMapping<XmlBasic
@Override
- public void initializeFromXmlColumnMapping(OrmColumnMapping oldMapping) {
- super.initializeFromXmlColumnMapping(oldMapping);
- setTemporal(oldMapping.getTemporal());
+ public void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
+ super.initializeFromOrmColumnMapping(oldMapping);
getColumn().initializeFrom(oldMapping.getColumn());
}
@@ -208,10 +187,9 @@ public class GenericOrmBasicMapping extends AbstractOrmAttributeMapping<XmlBasic
super.initialize(basic);
this.specifiedFetch = this.specifiedFetch(basic);
this.specifiedOptional = this.specifiedOptional(basic);
- this.specifiedEnumerated = this.specifiedEnumerated(basic);
- this.temporal = this.specifiedTemporal(basic);
- this.lob = specifiedLob(basic);
this.column.initialize(basic.getColumn());
+ this.defaultConverter = new GenericOrmNullConverter(this);
+ this.specifiedConverter = this.buildSpecifiedConverter(this.specifiedConverterType(basic));
}
@Override
@@ -219,10 +197,13 @@ public class GenericOrmBasicMapping extends AbstractOrmAttributeMapping<XmlBasic
super.update(basic);
this.setSpecifiedFetch_(this.specifiedFetch(basic));
this.setSpecifiedOptional_(this.specifiedOptional(basic));
- this.setSpecifiedEnumerated_(this.specifiedEnumerated(basic));
- this.setTemporal_(this.specifiedTemporal(basic));
- this.setLob_(this.specifiedLob(basic));
this.column.update(basic.getColumn());
+ if (specifiedConverterType(basic) == getSpecifedConverterType()) {
+ getSpecifiedConverter().update(basic);
+ }
+ else {
+ setSpecifiedConverter(buildSpecifiedConverter(specifiedConverterType(basic)));
+ }
}
protected Boolean specifiedOptional(XmlBasic basic) {
@@ -233,16 +214,31 @@ public class GenericOrmBasicMapping extends AbstractOrmAttributeMapping<XmlBasic
return FetchType.fromOrmResourceModel(basic.getFetch());
}
- protected EnumType specifiedEnumerated(XmlBasic basic) {
- return EnumType.fromOrmResourceModel(basic.getEnumerated());
+ protected OrmConverter buildSpecifiedConverter(String converterType) {
+ if (converterType == Converter.ENUMERATED_CONVERTER) {
+ return new GenericOrmEnumeratedConverter(this, this.attributeMapping);
+ }
+ else if (converterType == Converter.TEMPORAL_CONVERTER) {
+ return new GenericOrmTemporalConverter(this, this.attributeMapping);
+ }
+ else if (converterType == Converter.LOB_CONVERTER) {
+ return new GenericOrmLobConverter(this, this.attributeMapping);
+ }
+ return null;
}
- protected TemporalType specifiedTemporal(XmlBasic basic) {
- return TemporalType.fromOrmResourceModel(basic.getTemporal());
- }
-
- protected boolean specifiedLob(XmlBasic basic) {
- return basic.isLob();
+ protected String specifiedConverterType(XmlBasic xmlBasic) {
+ if (xmlBasic.getEnumerated() != null) {
+ return Converter.ENUMERATED_CONVERTER;
+ }
+ else if (xmlBasic.getTemporal() != null) {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+ else if (xmlBasic.isLob()) {
+ return Converter.LOB_CONVERTER;
+ }
+
+ return null;
}
public XmlBasic addToResourceModel(AbstractXmlTypeMapping typeMapping) {
@@ -259,7 +255,7 @@ public class GenericOrmBasicMapping extends AbstractOrmAttributeMapping<XmlBasic
}
}
- //***************** IXmlColumn.Owner implementation ****************
+ //***************** XmlColumn.Owner implementation ****************
public XmlColumn getResourceColumn() {
return this.getAttributeMapping().getColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEnumeratedConverter.java
new file mode 100644
index 0000000000..b6a977db73
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEnumeratedConverter.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.EnumType;
+import org.eclipse.jpt.core.context.EnumeratedConverter;
+import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.core.context.orm.OrmConverter;
+import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.jpt.core.resource.orm.XmlBasic;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class GenericOrmEnumeratedConverter extends AbstractOrmJpaContextNode
+ implements EnumeratedConverter, OrmConverter
+{
+ private EnumType specifiedEnumType;
+
+ private XmlConvertibleMapping resourceConvertableMapping;
+
+ public GenericOrmEnumeratedConverter(OrmAttributeMapping parent, XmlBasic resourceBasic) {
+ super(parent);
+ this.initialize(resourceBasic);
+ }
+
+ @Override
+ public OrmAttributeMapping getParent() {
+ return (OrmAttributeMapping) super.getParent();
+ }
+
+ public String getType() {
+ return Converter.ENUMERATED_CONVERTER;
+ }
+
+ public EnumType getEnumType() {
+ return getSpecifiedEnumType() == null ? getDefaultEnumType() : getSpecifiedEnumType();
+ }
+
+ public EnumType getDefaultEnumType() {
+ //there is no default enumType in xml, if you specify the enumerated element, you must
+ //specify either ORDINAL or STRING
+ return null;
+ }
+
+ public EnumType getSpecifiedEnumType() {
+ return this.specifiedEnumType;
+ }
+
+ public void setSpecifiedEnumType(EnumType newSpecifiedEnumType) {
+ EnumType oldSpecifiedEnumType = this.specifiedEnumType;
+ this.specifiedEnumType = newSpecifiedEnumType;
+ this.resourceConvertableMapping.setEnumerated(EnumType.toOrmResourceModel(newSpecifiedEnumType));
+ firePropertyChanged(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY, oldSpecifiedEnumType, newSpecifiedEnumType);
+ }
+
+ protected void setSpecifiedEnumType_(EnumType newSpecifiedEnumType) {
+ EnumType oldSpecifiedEnumType = this.specifiedEnumType;
+ this.specifiedEnumType = newSpecifiedEnumType;
+ firePropertyChanged(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY, oldSpecifiedEnumType, newSpecifiedEnumType);
+ }
+
+ protected void initialize(XmlConvertibleMapping resourceConvertableMapping) {
+ this.resourceConvertableMapping = resourceConvertableMapping;
+ this.specifiedEnumType = this.specifiedEnumType(this.resourceConvertableMapping);
+ }
+
+ public void update(XmlConvertibleMapping resourceConvertableMapping) {
+ this.resourceConvertableMapping = resourceConvertableMapping;
+ this.setSpecifiedEnumType_(this.specifiedEnumType(this.resourceConvertableMapping));
+ }
+
+ protected EnumType specifiedEnumType(XmlConvertibleMapping resourceConvertableMapping) {
+ return EnumType.fromOrmResourceModel(resourceConvertableMapping.getEnumerated());
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.resourceConvertableMapping.getEnumeratedTextRange();
+ }
+
+ public void addToResourceModel() {
+ this.resourceConvertableMapping.setEnumerated(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL);
+ }
+
+ public void removeFromResourceModel() {
+ this.resourceConvertableMapping.setEnumerated(null);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdMapping.java
index dca060697a..146e9d093c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdMapping.java
@@ -12,12 +12,12 @@ package org.eclipse.jpt.core.internal.context.orm;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.ColumnMapping;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.core.context.orm.OrmColumn;
import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
+import org.eclipse.jpt.core.context.orm.OrmConverter;
import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
import org.eclipse.jpt.core.context.orm.OrmGenerator;
import org.eclipse.jpt.core.context.orm.OrmIdMapping;
@@ -48,7 +48,8 @@ public class GenericOrmIdMapping extends AbstractOrmAttributeMapping<XmlId>
protected OrmGeneratedValue generatedValue;
- protected TemporalType temporal;
+ protected OrmConverter defaultConverter;
+ protected OrmConverter specifiedConverter;
protected OrmTableGenerator tableGenerator;
protected OrmSequenceGenerator sequenceGenerator;
@@ -73,9 +74,8 @@ public class GenericOrmIdMapping extends AbstractOrmAttributeMapping<XmlId>
}
@Override
- public void initializeFromXmlColumnMapping(OrmColumnMapping oldMapping) {
- super.initializeFromXmlColumnMapping(oldMapping);
- setTemporal(oldMapping.getTemporal());
+ public void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
+ super.initializeFromOrmColumnMapping(oldMapping);
getColumn().initializeFrom(oldMapping.getColumn());
}
@@ -83,22 +83,47 @@ public class GenericOrmIdMapping extends AbstractOrmAttributeMapping<XmlId>
public OrmColumn getColumn() {
return this.column;
}
-
- public TemporalType getTemporal() {
- return this.temporal;
+
+ public OrmConverter getConverter() {
+ return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
}
-
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- this.getAttributeMapping().setTemporal(TemporalType.toOrmResourceModel(newTemporal));
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+
+ public OrmConverter getDefaultConverter() {
+ return this.defaultConverter;
+ }
+
+ public OrmConverter getSpecifiedConverter() {
+ return this.specifiedConverter;
+ }
+
+ protected String getSpecifedConverterType() {
+ if (this.specifiedConverter == null) {
+ return Converter.NO_CONVERTER;
+ }
+ return this.specifiedConverter.getType();
}
- protected void setTemporal_(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ public void setSpecifiedConverter(String converterType) {
+ if (getSpecifedConverterType() == converterType) {
+ return;
+ }
+ OrmConverter oldConverter = this.specifiedConverter;
+ OrmConverter newConverter = buildSpecifiedConverter(converterType);
+ this.specifiedConverter = null;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.specifiedConverter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
+ protected void setSpecifiedConverter(OrmConverter newConverter) {
+ OrmConverter oldConverter = this.specifiedConverter;
+ this.specifiedConverter = newConverter;
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
}
public OrmGeneratedValue addGeneratedValue() {
@@ -245,16 +270,13 @@ public class GenericOrmIdMapping extends AbstractOrmAttributeMapping<XmlId>
@Override
public void initialize(XmlId id) {
super.initialize(id);
- this.temporal = this.specifiedTemporal(id);
this.column.initialize(id.getColumn());
this.initializeSequenceGenerator(id);
this.initializeTableGenerator(id);
this.initializeGeneratedValue(id);
this.updatePersistenceUnitGenerators();
- }
-
- protected TemporalType specifiedTemporal(XmlId id) {
- return TemporalType.fromOrmResourceModel(id.getTemporal());
+ this.defaultConverter = new GenericOrmNullConverter(this);
+ this.specifiedConverter = this.buildSpecifiedConverter(this.specifiedConverterType(id));
}
protected void initializeSequenceGenerator(XmlId id) {
@@ -289,12 +311,17 @@ public class GenericOrmIdMapping extends AbstractOrmAttributeMapping<XmlId>
@Override
public void update(XmlId id) {
super.update(id);
- this.setTemporal_(this.specifiedTemporal(id));
this.column.update(id.getColumn());
this.updateSequenceGenerator(id);
this.updateTableGenerator(id);
this.updateGeneratedValue(id);
this.updatePersistenceUnitGenerators();
+ if (specifiedConverterType(id) == getSpecifedConverterType()) {
+ getSpecifiedConverter().update(id);
+ }
+ else {
+ setSpecifiedConverter(buildSpecifiedConverter(specifiedConverterType(id)));
+ }
}
protected void updateSequenceGenerator(XmlId id) {
@@ -354,8 +381,23 @@ public class GenericOrmIdMapping extends AbstractOrmAttributeMapping<XmlId>
getPersistenceUnit().addGenerator(getSequenceGenerator());
}
}
+
+ protected OrmConverter buildSpecifiedConverter(String converterType) {
+ if (converterType == Converter.TEMPORAL_CONVERTER) {
+ return new GenericOrmTemporalConverter(this, this.attributeMapping);
+ }
+ return null;
+ }
+
+ protected String specifiedConverterType(XmlId xmlId) {
+ if (xmlId.getTemporal() != null) {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+
+ return null;
+ }
- //***************** IXmlColumn.Owner implementation ****************
+ //***************** XmlColumn.Owner implementation ****************
public XmlColumn getResourceColumn() {
return this.getAttributeMapping().getColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmLobConverter.java
new file mode 100644
index 0000000000..088bc8a29a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmLobConverter.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.LobConverter;
+import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.core.context.orm.OrmConverter;
+import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.jpt.core.resource.orm.XmlBasic;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class GenericOrmLobConverter extends AbstractOrmJpaContextNode
+ implements LobConverter, OrmConverter
+{
+ private XmlConvertibleMapping resourceConvertableMapping;
+
+ public GenericOrmLobConverter(OrmAttributeMapping parent, XmlBasic resourceBasic) {
+ super(parent);
+ this.initialize(resourceBasic);
+ }
+
+ @Override
+ public OrmAttributeMapping getParent() {
+ return (OrmAttributeMapping) super.getParent();
+ }
+
+ public String getType() {
+ return Converter.LOB_CONVERTER;
+ }
+
+ public void initialize(XmlConvertibleMapping resourceConvertableMapping) {
+ this.resourceConvertableMapping = resourceConvertableMapping;
+ }
+
+ public void update(XmlConvertibleMapping resourceConvertableMapping) {
+ this.resourceConvertableMapping = resourceConvertableMapping;
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.resourceConvertableMapping.getLobTextRange();
+ }
+
+ public void addToResourceModel() {
+ this.resourceConvertableMapping.setLob(true);
+ }
+
+ public void removeFromResourceModel() {
+ this.resourceConvertableMapping.setLob(false);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyMapping.java
index c7341a8f49..29bad6eaef 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyMapping.java
@@ -36,8 +36,8 @@ public class GenericOrmManyToManyMapping extends AbstractOrmMultiRelationshipMap
}
@Override
- public void initializeFromXmlNonOwningMapping(NonOwningMapping oldMapping) {
- super.initializeFromXmlNonOwningMapping(oldMapping);
+ public void initializeFromOrmNonOwningMapping(NonOwningMapping oldMapping) {
+ super.initializeFromOrmNonOwningMapping(oldMapping);
setMappedBy(oldMapping.getMappedBy());
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmNullConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmNullConverter.java
new file mode 100644
index 0000000000..37e5fe3393
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmNullConverter.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.core.context.orm.OrmConverter;
+import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class GenericOrmNullConverter extends AbstractOrmJpaContextNode
+ implements OrmConverter
+{
+
+ public GenericOrmNullConverter(OrmAttributeMapping parent) {
+ super(parent);
+ }
+
+ @Override
+ public OrmAttributeMapping getParent() {
+ return (OrmAttributeMapping) super.getParent();
+ }
+
+ public String getType() {
+ return Converter.NO_CONVERTER;
+ }
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+
+ public void update(XmlConvertibleMapping resourceConvertableMapping) {
+ // do nothing, null implementation
+ }
+
+ public void addToResourceModel() {
+ // do nothing, null implementation
+ }
+
+ public void removeFromResourceModel() {
+ // do nothing, null implementation
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyMapping.java
index 430dd74a1a..b00e521583 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyMapping.java
@@ -37,8 +37,8 @@ public class GenericOrmOneToManyMapping extends AbstractOrmMultiRelationshipMapp
}
@Override
- public void initializeFromXmlNonOwningMapping(NonOwningMapping oldMapping) {
- super.initializeFromXmlNonOwningMapping(oldMapping);
+ public void initializeFromOrmNonOwningMapping(NonOwningMapping oldMapping) {
+ super.initializeFromOrmNonOwningMapping(oldMapping);
setMappedBy(oldMapping.getMappedBy());
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneMapping.java
index 52dae1e553..11edaefcd8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneMapping.java
@@ -55,8 +55,8 @@ public class GenericOrmOneToOneMapping extends AbstractOrmSingleRelationshipMapp
}
@Override
- public void initializeFromXmlNonOwningMapping(NonOwningMapping oldMapping) {
- super.initializeFromXmlNonOwningMapping(oldMapping);
+ public void initializeFromOrmNonOwningMapping(NonOwningMapping oldMapping) {
+ super.initializeFromOrmNonOwningMapping(oldMapping);
setMappedBy(oldMapping.getMappedBy());
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmTemporalConverter.java
new file mode 100644
index 0000000000..74d0f1a150
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmTemporalConverter.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.TemporalConverter;
+import org.eclipse.jpt.core.context.TemporalType;
+import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.core.context.orm.OrmConverter;
+import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class GenericOrmTemporalConverter extends AbstractOrmJpaContextNode
+ implements TemporalConverter, OrmConverter
+{
+ private TemporalType temporalType;
+
+ private XmlConvertibleMapping resourceConvertableMapping;
+
+ public GenericOrmTemporalConverter(OrmAttributeMapping parent, XmlConvertibleMapping resourceConvertableMapping) {
+ super(parent);
+ this.initialize(resourceConvertableMapping);
+ }
+
+ @Override
+ public OrmAttributeMapping getParent() {
+ return (OrmAttributeMapping) super.getParent();
+ }
+
+ public String getType() {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+
+ public TemporalType getTemporalType() {
+ return this.temporalType;
+ }
+
+ public void setTemporalType(TemporalType newTemporalType) {
+ TemporalType oldTemporalType = this.temporalType;
+ this.temporalType = newTemporalType;
+ this.resourceConvertableMapping.setTemporal(TemporalType.toOrmResourceModel(newTemporalType));
+ firePropertyChanged(TEMPORAL_TYPE_PROPERTY, oldTemporalType, newTemporalType);
+ }
+
+ protected void setTemporalType_(TemporalType newTemporalType) {
+ TemporalType oldTemporalType = this.temporalType;
+ this.temporalType = newTemporalType;
+ firePropertyChanged(TEMPORAL_TYPE_PROPERTY, oldTemporalType, newTemporalType);
+ }
+
+
+ protected void initialize(XmlConvertibleMapping resourceConvertableMapping) {
+ this.resourceConvertableMapping = resourceConvertableMapping;
+ this.temporalType = this.temporalType(this.resourceConvertableMapping);
+ }
+
+ public void update(XmlConvertibleMapping resourceConvertableMapping) {
+ this.resourceConvertableMapping = resourceConvertableMapping;
+ this.setTemporalType_(this.temporalType(this.resourceConvertableMapping));
+ }
+
+ protected TemporalType temporalType(XmlConvertibleMapping resourceConvertableMapping) {
+ return TemporalType.fromOrmResourceModel(resourceConvertableMapping.getTemporal());
+ }
+
+
+ public TextRange getValidationTextRange() {
+ return this.resourceConvertableMapping.getTemporalTextRange();
+ }
+
+ public void addToResourceModel() {
+ this.resourceConvertableMapping.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE);
+ }
+
+ public void removeFromResourceModel() {
+ this.resourceConvertableMapping.setTemporal(null);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVersionMapping.java
index e460bc1547..c7e4f6407a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVersionMapping.java
@@ -11,11 +11,11 @@ package org.eclipse.jpt.core.internal.context.orm;
import java.util.List;
import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.TemporalType;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.core.context.orm.OrmColumn;
import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
+import org.eclipse.jpt.core.context.orm.OrmConverter;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
@@ -33,7 +33,8 @@ public class GenericOrmVersionMapping extends AbstractOrmAttributeMapping<XmlVer
{
protected final OrmColumn column;
- protected TemporalType temporal;
+ protected OrmConverter defaultConverter;
+ protected OrmConverter specifiedConverter;
public GenericOrmVersionMapping(OrmPersistentAttribute parent) {
super(parent);
@@ -53,9 +54,8 @@ public class GenericOrmVersionMapping extends AbstractOrmAttributeMapping<XmlVer
}
@Override
- public void initializeFromXmlColumnMapping(OrmColumnMapping oldMapping) {
- super.initializeFromXmlColumnMapping(oldMapping);
- setTemporal(oldMapping.getTemporal());
+ public void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
+ super.initializeFromOrmColumnMapping(oldMapping);
getColumn().initializeFrom(oldMapping.getColumn());
}
@@ -63,22 +63,47 @@ public class GenericOrmVersionMapping extends AbstractOrmAttributeMapping<XmlVer
return this.column;
}
- public TemporalType getTemporal() {
- return this.temporal;
+ public OrmConverter getConverter() {
+ return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
}
-
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- this.getAttributeMapping().setTemporal(TemporalType.toOrmResourceModel(newTemporal));
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+
+ public OrmConverter getDefaultConverter() {
+ return this.defaultConverter;
}
- protected void setTemporal_(TemporalType newTemporal) {
- TemporalType oldTemporal = this.temporal;
- this.temporal = newTemporal;
- firePropertyChanged(ColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ public OrmConverter getSpecifiedConverter() {
+ return this.specifiedConverter;
+ }
+
+ protected String getSpecifedConverterType() {
+ if (this.specifiedConverter == null) {
+ return Converter.NO_CONVERTER;
+ }
+ return this.specifiedConverter.getType();
+ }
+
+ public void setSpecifiedConverter(String converterType) {
+ if (getSpecifedConverterType() == converterType) {
+ return;
+ }
+ OrmConverter oldConverter = this.specifiedConverter;
+ OrmConverter newConverter = buildSpecifiedConverter(converterType);
+ this.specifiedConverter = null;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.specifiedConverter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
}
+
+ protected void setSpecifiedConverter(OrmConverter newConverter) {
+ OrmConverter oldConverter = this.specifiedConverter;
+ this.specifiedConverter = newConverter;
+ firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
public XmlVersion addToResourceModel(AbstractXmlTypeMapping typeMapping) {
XmlVersion version = OrmFactory.eINSTANCE.createXmlVersionImpl();
@@ -109,22 +134,39 @@ public class GenericOrmVersionMapping extends AbstractOrmAttributeMapping<XmlVer
@Override
public void initialize(XmlVersion version) {
super.initialize(version);
- this.temporal = this.specifiedTemporal(version);
this.column.initialize(version.getColumn());
+ this.defaultConverter = new GenericOrmNullConverter(this);
+ this.specifiedConverter = this.buildSpecifiedConverter(this.specifiedConverterType(version));
}
@Override
public void update(XmlVersion version) {
super.update(version);
- this.setTemporal_(this.specifiedTemporal(version));
this.column.update(version.getColumn());
+ if (specifiedConverterType(version) == getSpecifedConverterType()) {
+ getSpecifiedConverter().update(version);
+ }
+ else {
+ setSpecifiedConverter(buildSpecifiedConverter(specifiedConverterType(version)));
+ }
}
- protected TemporalType specifiedTemporal(XmlVersion version) {
- return TemporalType.fromOrmResourceModel(version.getTemporal());
+ protected OrmConverter buildSpecifiedConverter(String converterType) {
+ if (converterType == Converter.TEMPORAL_CONVERTER) {
+ return new GenericOrmTemporalConverter(this, this.attributeMapping);
+ }
+ return null;
+ }
+
+ protected String specifiedConverterType(XmlVersion resourceVersion) {
+ if (resourceVersion.getTemporal() != null) {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+
+ return null;
}
- //***************** IXmlColumn.Owner implementation ****************
+ //***************** XmlColumn.Owner implementation ****************
public XmlColumn getResourceColumn() {
return this.getAttributeMapping().getColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java
index 9ac0ae3828..e35e486fc8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java
@@ -9,6 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.orm;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.EnumeratedConverter;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.java.JavaBasicMapping;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
@@ -80,7 +83,7 @@ public class VirtualXmlBasic extends AbstractJpaEObject implements XmlBasic
if (this.metadataComplete) {
return false;
}
- return this.javaBasicMapping.isLob();
+ return this.javaBasicMapping.getConverter().getType() == Converter.LOB_CONVERTER;
}
public void setLob(boolean newLob) {
@@ -91,7 +94,11 @@ public class VirtualXmlBasic extends AbstractJpaEObject implements XmlBasic
if (this.metadataComplete) {
return null;
}
- return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(this.javaBasicMapping.getTemporal());
+ if (this.javaBasicMapping.getConverter().getType() == Converter.TEMPORAL_CONVERTER) {
+ org.eclipse.jpt.core.context.TemporalType javaTemporalType = ((TemporalConverter) this.javaBasicMapping.getConverter()).getTemporalType();
+ return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(javaTemporalType);
+ }
+ return null;
}
public void setTemporal(TemporalType newTemporal){
@@ -99,10 +106,20 @@ public class VirtualXmlBasic extends AbstractJpaEObject implements XmlBasic
}
public EnumType getEnumerated() {
+ if (this.javaBasicMapping.getConverter().getType() != Converter.ENUMERATED_CONVERTER) {
+ return null;
+ }
+ org.eclipse.jpt.core.context.EnumType javaEnumeratedType;
if (this.metadataComplete) {
- return org.eclipse.jpt.core.context.EnumType.toOrmResourceModel(this.javaBasicMapping.getDefaultEnumerated());
+ if (this.javaBasicMapping.getDefaultConverter().getType() != Converter.ENUMERATED_CONVERTER) {
+ return null;
+ }
+ javaEnumeratedType = ((EnumeratedConverter) this.javaBasicMapping.getDefaultConverter()).getSpecifiedEnumType();
}
- return org.eclipse.jpt.core.context.EnumType.toOrmResourceModel(this.javaBasicMapping.getEnumerated());
+ else {
+ javaEnumeratedType = ((EnumeratedConverter) this.javaBasicMapping.getConverter()).getEnumType();
+ }
+ return org.eclipse.jpt.core.context.EnumType.toOrmResourceModel(javaEnumeratedType);
}
public void setEnumerated(EnumType newEnumerated) {
@@ -118,4 +135,16 @@ public class VirtualXmlBasic extends AbstractJpaEObject implements XmlBasic
public TextRange getNameTextRange() {
return null;
}
+
+ public TextRange getEnumeratedTextRange() {
+ return null;
+ }
+
+ public TextRange getLobTextRange() {
+ return null;
+ }
+
+ public TextRange getTemporalTextRange() {
+ return null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java
index 308ce8b5e7..c69fbaa807 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java
@@ -9,9 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.orm;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.java.JavaIdMapping;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
+import org.eclipse.jpt.core.resource.orm.EnumType;
import org.eclipse.jpt.core.resource.orm.TemporalType;
import org.eclipse.jpt.core.resource.orm.XmlColumn;
import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
@@ -70,7 +73,11 @@ public class VirtualXmlId extends AbstractJpaEObject implements XmlId
if (this.metadataComplete) {
return null;
}
- return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(this.javaIdMapping.getTemporal());
+ if (this.javaIdMapping.getConverter().getType() == Converter.TEMPORAL_CONVERTER) {
+ org.eclipse.jpt.core.context.TemporalType javaTemporalType = ((TemporalConverter) this.javaIdMapping.getConverter()).getTemporalType();
+ return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(javaTemporalType);
+ }
+ return null;
}
public void setTemporal(TemporalType newTemporal){
@@ -120,7 +127,23 @@ public class VirtualXmlId extends AbstractJpaEObject implements XmlId
throw new UnsupportedOperationException("cannot set values on a virtual mapping");
}
-
+ public EnumType getEnumerated() {
+ throw new UnsupportedOperationException("enumerated not supported on id mappings");
+ }
+
+ public void setEnumerated(EnumType value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public boolean isLob() {
+ throw new UnsupportedOperationException("lob not supported on id mappings");
+ }
+
+ public void setLob(boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
public void update(JavaIdMapping javaIdMapping) {
this.javaIdMapping = javaIdMapping;
this.column.update(javaIdMapping.getColumn());
@@ -132,5 +155,17 @@ public class VirtualXmlId extends AbstractJpaEObject implements XmlId
public TextRange getNameTextRange() {
return null;
}
+
+ public TextRange getEnumeratedTextRange() {
+ return null;
+ }
+
+ public TextRange getLobTextRange() {
+ return null;
+ }
+
+ public TextRange getTemporalTextRange() {
+ return null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java
index c402e38e7e..90addc3faa 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java
@@ -9,9 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.orm;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.java.JavaVersionMapping;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
+import org.eclipse.jpt.core.resource.orm.EnumType;
import org.eclipse.jpt.core.resource.orm.TemporalType;
import org.eclipse.jpt.core.resource.orm.XmlColumn;
import org.eclipse.jpt.core.resource.orm.XmlVersion;
@@ -56,12 +59,33 @@ public class VirtualXmlVersion extends AbstractJpaEObject implements XmlVersion
if (this.metadataComplete) {
return null;
}
- return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(this.javaVersionMapping.getTemporal());
+ if (this.javaVersionMapping.getConverter().getType() == Converter.TEMPORAL_CONVERTER) {
+ org.eclipse.jpt.core.context.TemporalType javaTemporalType = ((TemporalConverter) this.javaVersionMapping.getConverter()).getTemporalType();
+ return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(javaTemporalType);
+ }
+ return null;
}
public void setTemporal(TemporalType newTemporal){
throw new UnsupportedOperationException("cannot set values on a virtual mapping");
}
+
+ public EnumType getEnumerated() {
+ throw new UnsupportedOperationException("enumerated not supported on version mappings");
+ }
+
+ public void setEnumerated(EnumType value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public boolean isLob() {
+ throw new UnsupportedOperationException("lob not supported on version mappings");
+ }
+
+ public void setLob(boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
public void update(JavaVersionMapping javaVersionMapping) {
this.javaVersionMapping = javaVersionMapping;
@@ -72,5 +96,17 @@ public class VirtualXmlVersion extends AbstractJpaEObject implements XmlVersion
public TextRange getNameTextRange() {
return null;
}
+
+ public TextRange getEnumeratedTextRange() {
+ return null;
+ }
+
+ public TextRange getLobTextRange() {
+ return null;
+ }
+
+ public TextRange getTemporalTextRange() {
+ return null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java
index 9caf0c0544..957ea97bdc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java
@@ -78,7 +78,7 @@ public class EnumeratedImpl extends AbstractResourceAnnotation<Attribute> implem
// ********** static methods **********
private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ENUMERATED__VALUE);
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ENUMERATED__VALUE, false);
}
public static class EnumeratedAnnotationDefinition implements AnnotationDefinition
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java
index 0a5bc088aa..5b870a3cbe 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java
@@ -67,14 +67,14 @@ public class BasicTranslator extends Translator
}
private Translator createLobTranslator() {
- return new EmptyTagBooleanTranslator(LOB, ORM_PKG.getXmlBasic_Lob());
+ return new EmptyTagBooleanTranslator(LOB, ORM_PKG.getXmlConvertibleMapping_Lob());
}
private Translator createTemporalTranslator() {
- return new Translator(TEMPORAL, ORM_PKG.getXmlBasic_Temporal());
+ return new Translator(TEMPORAL, ORM_PKG.getXmlConvertibleMapping_Temporal());
}
private Translator createEnumeratedTranslator() {
- return new Translator(ENUMERATED, ORM_PKG.getXmlBasic_Enumerated());
+ return new Translator(ENUMERATED, ORM_PKG.getXmlConvertibleMapping_Enumerated());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java
index db7e3bba39..0455a4af1e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java
@@ -60,7 +60,7 @@ public class IdTranslator extends Translator
}
private Translator createTemporalTranslator() {
- return new Translator(TEMPORAL, ORM_PKG.getXmlId_Temporal());
+ return new Translator(TEMPORAL, ORM_PKG.getXmlConvertibleMapping_Temporal());
}
private Translator createTableGeneratorTranslator() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java
index b257fac57b..420eec1fe3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java
@@ -54,6 +54,6 @@ public class VersionTranslator extends Translator
}
private Translator createTemporalTranslator() {
- return new Translator(TEMPORAL, ORM_PKG.getXmlVersion_Temporal());
+ return new Translator(TEMPORAL, ORM_PKG.getXmlConvertibleMapping_Temporal());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
index b0d5c74a39..d0c5cbed90 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
@@ -1398,13 +1398,13 @@ public class OrmPackage extends EPackageImpl
public static final int XML_ID__COLUMN = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
/**
- * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ID__GENERATED_VALUE = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+ public static final int XML_ID__LOB = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
/**
* The feature id for the '<em><b>Temporal</b></em>' attribute.
@@ -1416,13 +1416,31 @@ public class OrmPackage extends EPackageImpl
public static final int XML_ID__TEMPORAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
/**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ID__ENUMERATED = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ID__GENERATED_VALUE = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
* The feature id for the '<em><b>Table Generator</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ID__TABLE_GENERATOR = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+ public static final int XML_ID__TABLE_GENERATOR = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
/**
* The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
@@ -1431,7 +1449,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_ID__SEQUENCE_GENERATOR = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+ public static final int XML_ID__SEQUENCE_GENERATOR = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
/**
* The number of structural features of the '<em>Xml Id</em>' class.
@@ -1440,7 +1458,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_ID_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+ public static final int XML_ID_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlIdImpl <em>Xml Id Impl</em>}' class.
@@ -1471,13 +1489,13 @@ public class OrmPackage extends EPackageImpl
public static final int XML_ID_IMPL__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
/**
- * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ID_IMPL__GENERATED_VALUE = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+ public static final int XML_ID_IMPL__LOB = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
/**
* The feature id for the '<em><b>Temporal</b></em>' attribute.
@@ -1489,13 +1507,31 @@ public class OrmPackage extends EPackageImpl
public static final int XML_ID_IMPL__TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
/**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ID_IMPL__ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ID_IMPL__GENERATED_VALUE = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
* The feature id for the '<em><b>Table Generator</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ID_IMPL__TABLE_GENERATOR = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+ public static final int XML_ID_IMPL__TABLE_GENERATOR = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
/**
* The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
@@ -1504,7 +1540,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_ID_IMPL__SEQUENCE_GENERATOR = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+ public static final int XML_ID_IMPL__SEQUENCE_GENERATOR = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
/**
* The number of structural features of the '<em>Xml Id Impl</em>' class.
@@ -1513,7 +1549,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_ID_IMPL_FEATURE_COUNT = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+ public static final int XML_ID_IMPL_FEATURE_COUNT = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.BaseXmlEmbedded <em>Base Xml Embedded</em>}' class.
@@ -1634,7 +1670,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBasic()
* @generated
*/
- public static final int XML_BASIC = 22;
+ public static final int XML_BASIC = 23;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlBasicImpl <em>Xml Basic Impl</em>}' class.
@@ -1644,7 +1680,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBasicImpl()
* @generated
*/
- public static final int XML_BASIC_IMPL = 23;
+ public static final int XML_BASIC_IMPL = 24;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlVersion <em>Xml Version</em>}' class.
@@ -1654,7 +1690,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlVersion()
* @generated
*/
- public static final int XML_VERSION = 24;
+ public static final int XML_VERSION = 25;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlVersionImpl <em>Xml Version Impl</em>}' class.
@@ -1664,7 +1700,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlVersionImpl()
* @generated
*/
- public static final int XML_VERSION_IMPL = 25;
+ public static final int XML_VERSION_IMPL = 26;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlManyToOne <em>Xml Many To One</em>}' class.
@@ -1674,7 +1710,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlManyToOne()
* @generated
*/
- public static final int XML_MANY_TO_ONE = 26;
+ public static final int XML_MANY_TO_ONE = 27;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlManyToOneImpl <em>Xml Many To One Impl</em>}' class.
@@ -1684,7 +1720,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlManyToOneImpl()
* @generated
*/
- public static final int XML_MANY_TO_ONE_IMPL = 27;
+ public static final int XML_MANY_TO_ONE_IMPL = 28;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlOneToMany <em>Xml One To Many</em>}' class.
@@ -1694,7 +1730,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlOneToMany()
* @generated
*/
- public static final int XML_ONE_TO_MANY = 28;
+ public static final int XML_ONE_TO_MANY = 29;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlOneToManyImpl <em>Xml One To Many Impl</em>}' class.
@@ -1704,7 +1740,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlOneToManyImpl()
* @generated
*/
- public static final int XML_ONE_TO_MANY_IMPL = 29;
+ public static final int XML_ONE_TO_MANY_IMPL = 30;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlOneToOne <em>Xml One To One</em>}' class.
@@ -1714,7 +1750,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlOneToOne()
* @generated
*/
- public static final int XML_ONE_TO_ONE = 30;
+ public static final int XML_ONE_TO_ONE = 31;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlOneToOneImpl <em>Xml One To One Impl</em>}' class.
@@ -1724,7 +1760,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlOneToOneImpl()
* @generated
*/
- public static final int XML_ONE_TO_ONE_IMPL = 31;
+ public static final int XML_ONE_TO_ONE_IMPL = 32;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlManyToMany <em>Xml Many To Many</em>}' class.
@@ -1734,7 +1770,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlManyToMany()
* @generated
*/
- public static final int XML_MANY_TO_MANY = 32;
+ public static final int XML_MANY_TO_MANY = 33;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlManyToManyImpl <em>Xml Many To Many Impl</em>}' class.
@@ -1744,7 +1780,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlManyToManyImpl()
* @generated
*/
- public static final int XML_MANY_TO_MANY_IMPL = 33;
+ public static final int XML_MANY_TO_MANY_IMPL = 34;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlEmbedded <em>Xml Embedded</em>}' class.
@@ -1821,6 +1857,52 @@ public class OrmPackage extends EPackageImpl
public static final int XML_EMBEDDED_IMPL_FEATURE_COUNT = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
/**
+ * The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping <em>Xml Convertible Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping()
+ * @generated
+ */
+ public static final int XML_CONVERTIBLE_MAPPING = 22;
+
+ /**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CONVERTIBLE_MAPPING__LOB = 0;
+
+ /**
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CONVERTIBLE_MAPPING__TEMPORAL = 1;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CONVERTIBLE_MAPPING__ENUMERATED = 2;
+
+ /**
+ * The number of structural features of the '<em>Xml Convertible Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CONVERTIBLE_MAPPING_FEATURE_COUNT = 3;
+
+ /**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1839,49 +1921,49 @@ public class OrmPackage extends EPackageImpl
public static final int XML_BASIC__COLUMN = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
/**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC__FETCH = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+ public static final int XML_BASIC__LOB = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
/**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC__OPTIONAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+ public static final int XML_BASIC__TEMPORAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
/**
- * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC__LOB = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+ public static final int XML_BASIC__ENUMERATED = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
/**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC__TEMPORAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+ public static final int XML_BASIC__FETCH = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
/**
- * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC__ENUMERATED = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+ public static final int XML_BASIC__OPTIONAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
/**
* The number of structural features of the '<em>Xml Basic</em>' class.
@@ -1911,49 +1993,49 @@ public class OrmPackage extends EPackageImpl
public static final int XML_BASIC_IMPL__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
/**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC_IMPL__FETCH = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+ public static final int XML_BASIC_IMPL__LOB = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
/**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC_IMPL__OPTIONAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+ public static final int XML_BASIC_IMPL__TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
/**
- * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC_IMPL__LOB = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+ public static final int XML_BASIC_IMPL__ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
/**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC_IMPL__TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+ public static final int XML_BASIC_IMPL__FETCH = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
/**
- * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_BASIC_IMPL__ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+ public static final int XML_BASIC_IMPL__OPTIONAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
/**
* The number of structural features of the '<em>Xml Basic Impl</em>' class.
@@ -1983,13 +2065,31 @@ public class OrmPackage extends EPackageImpl
public static final int XML_VERSION__COLUMN = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
/**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_VERSION__LOB = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
* The feature id for the '<em><b>Temporal</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_VERSION__TEMPORAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+ public static final int XML_VERSION__TEMPORAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_VERSION__ENUMERATED = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
/**
* The number of structural features of the '<em>Xml Version</em>' class.
@@ -1998,7 +2098,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_VERSION_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+ public static final int XML_VERSION_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -2019,13 +2119,31 @@ public class OrmPackage extends EPackageImpl
public static final int XML_VERSION_IMPL__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
/**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_VERSION_IMPL__LOB = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
* The feature id for the '<em><b>Temporal</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_VERSION_IMPL__TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+ public static final int XML_VERSION_IMPL__TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_VERSION_IMPL__ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
/**
* The number of structural features of the '<em>Xml Version Impl</em>' class.
@@ -2034,7 +2152,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_VERSION_IMPL_FEATURE_COUNT = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+ public static final int XML_VERSION_IMPL_FEATURE_COUNT = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -2710,7 +2828,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTransient()
* @generated
*/
- public static final int XML_TRANSIENT = 34;
+ public static final int XML_TRANSIENT = 35;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -2738,7 +2856,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTransientImpl()
* @generated
*/
- public static final int XML_TRANSIENT_IMPL = 35;
+ public static final int XML_TRANSIENT_IMPL = 36;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -2766,7 +2884,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlAssociationOverride()
* @generated
*/
- public static final int XML_ASSOCIATION_OVERRIDE = 36;
+ public static final int XML_ASSOCIATION_OVERRIDE = 37;
/**
* The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
@@ -2803,7 +2921,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlAssociationOverrideImpl()
* @generated
*/
- public static final int XML_ASSOCIATION_OVERRIDE_IMPL = 37;
+ public static final int XML_ASSOCIATION_OVERRIDE_IMPL = 38;
/**
* The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
@@ -2840,7 +2958,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlAttributeOverride()
* @generated
*/
- public static final int XML_ATTRIBUTE_OVERRIDE = 38;
+ public static final int XML_ATTRIBUTE_OVERRIDE = 39;
/**
* The feature id for the '<em><b>Column</b></em>' containment reference.
@@ -2877,7 +2995,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlAttributeOverrideImpl()
* @generated
*/
- public static final int XML_ATTRIBUTE_OVERRIDE_IMPL = 39;
+ public static final int XML_ATTRIBUTE_OVERRIDE_IMPL = 40;
/**
* The feature id for the '<em><b>Column</b></em>' containment reference.
@@ -2914,7 +3032,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getCascadeType()
* @generated
*/
- public static final int CASCADE_TYPE = 40;
+ public static final int CASCADE_TYPE = 41;
/**
* The feature id for the '<em><b>Cascade All</b></em>' attribute.
@@ -2978,7 +3096,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getCascadeTypeImpl()
* @generated
*/
- public static final int CASCADE_TYPE_IMPL = 41;
+ public static final int CASCADE_TYPE_IMPL = 42;
/**
* The feature id for the '<em><b>Cascade All</b></em>' attribute.
@@ -3042,7 +3160,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlNamedColumn()
* @generated
*/
- public static final int XML_NAMED_COLUMN = 42;
+ public static final int XML_NAMED_COLUMN = 43;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -3079,7 +3197,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getAbstractXmlNamedColumn()
* @generated
*/
- public static final int ABSTRACT_XML_NAMED_COLUMN = 43;
+ public static final int ABSTRACT_XML_NAMED_COLUMN = 44;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -3116,7 +3234,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlAbstractColumn()
* @generated
*/
- public static final int XML_ABSTRACT_COLUMN = 44;
+ public static final int XML_ABSTRACT_COLUMN = 45;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -3198,7 +3316,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getAbstractXmlAbstractColumn()
* @generated
*/
- public static final int ABSTRACT_XML_ABSTRACT_COLUMN = 45;
+ public static final int ABSTRACT_XML_ABSTRACT_COLUMN = 46;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -3280,7 +3398,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlColumn()
* @generated
*/
- public static final int XML_COLUMN = 46;
+ public static final int XML_COLUMN = 47;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -3389,7 +3507,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlColumnImpl()
* @generated
*/
- public static final int XML_COLUMN_IMPL = 47;
+ public static final int XML_COLUMN_IMPL = 48;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -3498,7 +3616,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getColumnResult()
* @generated
*/
- public static final int COLUMN_RESULT = 48;
+ public static final int COLUMN_RESULT = 49;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -3526,7 +3644,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn()
* @generated
*/
- public static final int XML_DISCRIMINATOR_COLUMN = 49;
+ public static final int XML_DISCRIMINATOR_COLUMN = 50;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -3581,7 +3699,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEntityListeners()
* @generated
*/
- public static final int ENTITY_LISTENERS = 50;
+ public static final int ENTITY_LISTENERS = 51;
/**
* The feature id for the '<em><b>Entity Listeners</b></em>' containment reference list.
@@ -3609,7 +3727,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEntityListener()
* @generated
*/
- public static final int ENTITY_LISTENER = 51;
+ public static final int ENTITY_LISTENER = 52;
/**
* The feature id for the '<em><b>Class Name</b></em>' attribute.
@@ -3700,7 +3818,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEntityResult()
* @generated
*/
- public static final int ENTITY_RESULT = 52;
+ public static final int ENTITY_RESULT = 53;
/**
* The feature id for the '<em><b>Discriminator Column</b></em>' attribute.
@@ -3746,7 +3864,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getFieldResult()
* @generated
*/
- public static final int FIELD_RESULT = 54;
+ public static final int FIELD_RESULT = 55;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.Inheritance <em>Inheritance</em>}' class.
@@ -3756,7 +3874,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getInheritance()
* @generated
*/
- public static final int INHERITANCE = 58;
+ public static final int INHERITANCE = 59;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.Lob <em>Lob</em>}' class.
@@ -3766,7 +3884,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getLob()
* @generated
*/
- public static final int LOB = 63;
+ public static final int LOB = 64;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.MapKey <em>Map Key</em>}' class.
@@ -3776,7 +3894,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getMapKey()
* @generated
*/
- public static final int MAP_KEY = 64;
+ public static final int MAP_KEY = 65;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.EventMethod <em>Event Method</em>}' class.
@@ -3786,7 +3904,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEventMethod()
* @generated
*/
- public static final int EVENT_METHOD = 53;
+ public static final int EVENT_METHOD = 54;
/**
* The feature id for the '<em><b>Method Name</b></em>' attribute.
@@ -3841,7 +3959,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlGeneratedValue()
* @generated
*/
- public static final int XML_GENERATED_VALUE = 55;
+ public static final int XML_GENERATED_VALUE = 56;
/**
* The feature id for the '<em><b>Generator</b></em>' attribute.
@@ -3878,7 +3996,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlGeneratedValueImpl()
* @generated
*/
- public static final int XML_GENERATED_VALUE_IMPL = 56;
+ public static final int XML_GENERATED_VALUE_IMPL = 57;
/**
* The feature id for the '<em><b>Generator</b></em>' attribute.
@@ -3915,7 +4033,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlIdClass()
* @generated
*/
- public static final int XML_ID_CLASS = 57;
+ public static final int XML_ID_CLASS = 58;
/**
* The feature id for the '<em><b>Class Name</b></em>' attribute.
@@ -3961,7 +4079,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlJoinColumn()
* @generated
*/
- public static final int XML_JOIN_COLUMN = 59;
+ public static final int XML_JOIN_COLUMN = 60;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -4052,7 +4170,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlJoinColumnImpl()
* @generated
*/
- public static final int XML_JOIN_COLUMN_IMPL = 60;
+ public static final int XML_JOIN_COLUMN_IMPL = 61;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -4143,7 +4261,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBaseTable()
* @generated
*/
- public static final int XML_BASE_TABLE = 80;
+ public static final int XML_BASE_TABLE = 81;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4198,7 +4316,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlJoinTable()
* @generated
*/
- public static final int XML_JOIN_TABLE = 61;
+ public static final int XML_JOIN_TABLE = 62;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4271,7 +4389,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getAbstractXmlBaseTable()
* @generated
*/
- public static final int ABSTRACT_XML_BASE_TABLE = 79;
+ public static final int ABSTRACT_XML_BASE_TABLE = 80;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4326,7 +4444,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlJoinTableImpl()
* @generated
*/
- public static final int XML_JOIN_TABLE_IMPL = 62;
+ public static final int XML_JOIN_TABLE_IMPL = 63;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4426,7 +4544,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getMapKeyImpl()
* @generated
*/
- public static final int MAP_KEY_IMPL = 65;
+ public static final int MAP_KEY_IMPL = 66;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4454,7 +4572,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlQuery()
* @generated
*/
- public static final int XML_QUERY = 66;
+ public static final int XML_QUERY = 67;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4500,7 +4618,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlNamedNativeQuery()
* @generated
*/
- public static final int XML_NAMED_NATIVE_QUERY = 67;
+ public static final int XML_NAMED_NATIVE_QUERY = 68;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4564,7 +4682,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlNamedQuery()
* @generated
*/
- public static final int XML_NAMED_QUERY = 68;
+ public static final int XML_NAMED_QUERY = 69;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4610,7 +4728,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getPostLoad()
* @generated
*/
- public static final int POST_LOAD = 69;
+ public static final int POST_LOAD = 70;
/**
* The feature id for the '<em><b>Method Name</b></em>' attribute.
@@ -4638,7 +4756,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getPostPersist()
* @generated
*/
- public static final int POST_PERSIST = 70;
+ public static final int POST_PERSIST = 71;
/**
* The feature id for the '<em><b>Method Name</b></em>' attribute.
@@ -4666,7 +4784,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getPostRemove()
* @generated
*/
- public static final int POST_REMOVE = 71;
+ public static final int POST_REMOVE = 72;
/**
* The feature id for the '<em><b>Method Name</b></em>' attribute.
@@ -4694,7 +4812,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getPostUpdate()
* @generated
*/
- public static final int POST_UPDATE = 72;
+ public static final int POST_UPDATE = 73;
/**
* The feature id for the '<em><b>Method Name</b></em>' attribute.
@@ -4722,7 +4840,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getPrePersist()
* @generated
*/
- public static final int PRE_PERSIST = 73;
+ public static final int PRE_PERSIST = 74;
/**
* The feature id for the '<em><b>Method Name</b></em>' attribute.
@@ -4750,7 +4868,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getPreRemove()
* @generated
*/
- public static final int PRE_REMOVE = 74;
+ public static final int PRE_REMOVE = 75;
/**
* The feature id for the '<em><b>Method Name</b></em>' attribute.
@@ -4778,7 +4896,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getPreUpdate()
* @generated
*/
- public static final int PRE_UPDATE = 75;
+ public static final int PRE_UPDATE = 76;
/**
* The feature id for the '<em><b>Method Name</b></em>' attribute.
@@ -4806,7 +4924,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumn()
* @generated
*/
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN = 76;
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN = 77;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -4852,7 +4970,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnImpl()
* @generated
*/
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN_IMPL = 77;
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_IMPL = 78;
/**
* The feature id for the '<em><b>Column Definition</b></em>' attribute.
@@ -4898,7 +5016,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlQueryHint()
* @generated
*/
- public static final int XML_QUERY_HINT = 78;
+ public static final int XML_QUERY_HINT = 79;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4935,7 +5053,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTable()
* @generated
*/
- public static final int XML_TABLE = 81;
+ public static final int XML_TABLE = 82;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4990,7 +5108,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlSecondaryTable()
* @generated
*/
- public static final int XML_SECONDARY_TABLE = 82;
+ public static final int XML_SECONDARY_TABLE = 83;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5054,7 +5172,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlSecondaryTableImpl()
* @generated
*/
- public static final int XML_SECONDARY_TABLE_IMPL = 83;
+ public static final int XML_SECONDARY_TABLE_IMPL = 84;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5118,7 +5236,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlGenerator()
* @generated
*/
- public static final int XML_GENERATOR = 84;
+ public static final int XML_GENERATOR = 85;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5164,7 +5282,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlSequenceGenerator()
* @generated
*/
- public static final int XML_SEQUENCE_GENERATOR = 85;
+ public static final int XML_SEQUENCE_GENERATOR = 86;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5219,7 +5337,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlSequenceGeneratorImpl()
* @generated
*/
- public static final int XML_SEQUENCE_GENERATOR_IMPL = 86;
+ public static final int XML_SEQUENCE_GENERATOR_IMPL = 87;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5274,7 +5392,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getSqlResultSetMapping()
* @generated
*/
- public static final int SQL_RESULT_SET_MAPPING = 87;
+ public static final int SQL_RESULT_SET_MAPPING = 88;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5320,7 +5438,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTableGenerator()
* @generated
*/
- public static final int XML_TABLE_GENERATOR = 88;
+ public static final int XML_TABLE_GENERATOR = 89;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5429,7 +5547,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTableGeneratorImpl()
* @generated
*/
- public static final int XML_TABLE_GENERATOR_IMPL = 89;
+ public static final int XML_TABLE_GENERATOR_IMPL = 90;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5538,7 +5656,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlUniqueConstraint()
* @generated
*/
- public static final int XML_UNIQUE_CONSTRAINT = 90;
+ public static final int XML_UNIQUE_CONSTRAINT = 91;
/**
* The feature id for the '<em><b>Column Names</b></em>' attribute list.
@@ -5566,7 +5684,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlUniqueConstraintImpl()
* @generated
*/
- public static final int XML_UNIQUE_CONSTRAINT_IMPL = 91;
+ public static final int XML_UNIQUE_CONSTRAINT_IMPL = 92;
/**
* The feature id for the '<em><b>Column Names</b></em>' attribute list.
@@ -5594,7 +5712,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getAccessType()
* @generated
*/
- public static final int ACCESS_TYPE = 92;
+ public static final int ACCESS_TYPE = 93;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.DiscriminatorType <em>Discriminator Type</em>}' enum.
@@ -5604,7 +5722,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getDiscriminatorType()
* @generated
*/
- public static final int DISCRIMINATOR_TYPE = 93;
+ public static final int DISCRIMINATOR_TYPE = 94;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.EnumType <em>Enum Type</em>}' enum.
@@ -5614,7 +5732,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEnumType()
* @generated
*/
- public static final int ENUM_TYPE = 94;
+ public static final int ENUM_TYPE = 95;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.FetchType <em>Fetch Type</em>}' enum.
@@ -5624,7 +5742,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getFetchType()
* @generated
*/
- public static final int FETCH_TYPE = 95;
+ public static final int FETCH_TYPE = 96;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.GenerationType <em>Generation Type</em>}' enum.
@@ -5634,7 +5752,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getGenerationType()
* @generated
*/
- public static final int GENERATION_TYPE = 96;
+ public static final int GENERATION_TYPE = 97;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.InheritanceType <em>Inheritance Type</em>}' enum.
@@ -5644,7 +5762,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getInheritanceType()
* @generated
*/
- public static final int INHERITANCE_TYPE = 97;
+ public static final int INHERITANCE_TYPE = 98;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.TemporalType <em>Temporal Type</em>}' enum.
@@ -5654,7 +5772,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getTemporalType()
* @generated
*/
- public static final int TEMPORAL_TYPE = 98;
+ public static final int TEMPORAL_TYPE = 99;
/**
* The meta object id for the '<em>Discriminator Value</em>' data type.
@@ -5664,7 +5782,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getDiscriminatorValue()
* @generated
*/
- public static final int DISCRIMINATOR_VALUE = 99;
+ public static final int DISCRIMINATOR_VALUE = 100;
/**
* The meta object id for the '<em>Enumerated</em>' data type.
@@ -5674,7 +5792,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEnumerated()
* @generated
*/
- public static final int ENUMERATED = 100;
+ public static final int ENUMERATED = 101;
/**
* The meta object id for the '<em>Order By</em>' data type.
@@ -5684,7 +5802,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getOrderBy()
* @generated
*/
- public static final int ORDER_BY = 101;
+ public static final int ORDER_BY = 102;
/**
* The meta object id for the '<em>Version Type</em>' data type.
@@ -5694,7 +5812,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getVersionType()
* @generated
*/
- public static final int VERSION_TYPE = 102;
+ public static final int VERSION_TYPE = 103;
/**
* <!-- begin-user-doc -->
@@ -5939,6 +6057,13 @@ public class OrmPackage extends EPackageImpl
* <!-- end-user-doc -->
* @generated
*/
+ private EClass xmlConvertibleMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
private EClass xmlTransientEClass = null;
/**
@@ -7989,21 +8114,6 @@ public class OrmPackage extends EPackageImpl
/**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.resource.orm.XmlId#getTemporal <em>Temporal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Temporal</em>'.
- * @see org.eclipse.jpt.core.resource.orm.XmlId#getTemporal()
- * @see #getXmlId()
- * @generated
- */
- public EAttribute getXmlId_Temporal()
- {
- return (EAttribute)xmlIdEClass.getEStructuralFeatures().get(1);
- }
-
-
- /**
* Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.resource.orm.XmlId#getTableGenerator <em>Table Generator</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -8014,7 +8124,7 @@ public class OrmPackage extends EPackageImpl
*/
public EReference getXmlId_TableGenerator()
{
- return (EReference)xmlIdEClass.getEStructuralFeatures().get(2);
+ return (EReference)xmlIdEClass.getEStructuralFeatures().get(1);
}
@@ -8029,7 +8139,7 @@ public class OrmPackage extends EPackageImpl
*/
public EReference getXmlId_SequenceGenerator()
{
- return (EReference)xmlIdEClass.getEStructuralFeatures().get(3);
+ return (EReference)xmlIdEClass.getEStructuralFeatures().get(2);
}
@@ -8149,51 +8259,6 @@ public class OrmPackage extends EPackageImpl
/**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.resource.orm.XmlBasic#isLob <em>Lob</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Lob</em>'.
- * @see org.eclipse.jpt.core.resource.orm.XmlBasic#isLob()
- * @see #getXmlBasic()
- * @generated
- */
- public EAttribute getXmlBasic_Lob()
- {
- return (EAttribute)xmlBasicEClass.getEStructuralFeatures().get(2);
- }
-
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.resource.orm.XmlBasic#getTemporal <em>Temporal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Temporal</em>'.
- * @see org.eclipse.jpt.core.resource.orm.XmlBasic#getTemporal()
- * @see #getXmlBasic()
- * @generated
- */
- public EAttribute getXmlBasic_Temporal()
- {
- return (EAttribute)xmlBasicEClass.getEStructuralFeatures().get(3);
- }
-
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.resource.orm.XmlBasic#getEnumerated <em>Enumerated</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Enumerated</em>'.
- * @see org.eclipse.jpt.core.resource.orm.XmlBasic#getEnumerated()
- * @see #getXmlBasic()
- * @generated
- */
- public EAttribute getXmlBasic_Enumerated()
- {
- return (EAttribute)xmlBasicEClass.getEStructuralFeatures().get(4);
- }
-
-
- /**
* Returns the meta object for class '{@link org.eclipse.jpt.core.resource.orm.XmlBasicImpl <em>Xml Basic Impl</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -8222,21 +8287,6 @@ public class OrmPackage extends EPackageImpl
/**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.resource.orm.XmlVersion#getTemporal <em>Temporal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Temporal</em>'.
- * @see org.eclipse.jpt.core.resource.orm.XmlVersion#getTemporal()
- * @see #getXmlVersion()
- * @generated
- */
- public EAttribute getXmlVersion_Temporal()
- {
- return (EAttribute)xmlVersionEClass.getEStructuralFeatures().get(0);
- }
-
-
- /**
* Returns the meta object for class '{@link org.eclipse.jpt.core.resource.orm.XmlVersionImpl <em>Xml Version Impl</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -8436,6 +8486,65 @@ public class OrmPackage extends EPackageImpl
/**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping <em>Xml Convertible Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Convertible Mapping</em>'.
+ * @see org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping
+ * @generated
+ */
+ public EClass getXmlConvertibleMapping()
+ {
+ return xmlConvertibleMappingEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#isLob <em>Lob</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Lob</em>'.
+ * @see org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#isLob()
+ * @see #getXmlConvertibleMapping()
+ * @generated
+ */
+ public EAttribute getXmlConvertibleMapping_Lob()
+ {
+ return (EAttribute)xmlConvertibleMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#getTemporal <em>Temporal</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Temporal</em>'.
+ * @see org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#getTemporal()
+ * @see #getXmlConvertibleMapping()
+ * @generated
+ */
+ public EAttribute getXmlConvertibleMapping_Temporal()
+ {
+ return (EAttribute)xmlConvertibleMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#getEnumerated <em>Enumerated</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Enumerated</em>'.
+ * @see org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#getEnumerated()
+ * @see #getXmlConvertibleMapping()
+ * @generated
+ */
+ public EAttribute getXmlConvertibleMapping_Enumerated()
+ {
+ return (EAttribute)xmlConvertibleMappingEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
* Returns the meta object for class '{@link org.eclipse.jpt.core.resource.orm.XmlTransient <em>Xml Transient</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -10595,7 +10704,6 @@ public class OrmPackage extends EPackageImpl
xmlIdEClass = createEClass(XML_ID);
createEReference(xmlIdEClass, XML_ID__GENERATED_VALUE);
- createEAttribute(xmlIdEClass, XML_ID__TEMPORAL);
createEReference(xmlIdEClass, XML_ID__TABLE_GENERATOR);
createEReference(xmlIdEClass, XML_ID__SEQUENCE_GENERATOR);
@@ -10612,17 +10720,18 @@ public class OrmPackage extends EPackageImpl
xmlEmbeddedImplEClass = createEClass(XML_EMBEDDED_IMPL);
+ xmlConvertibleMappingEClass = createEClass(XML_CONVERTIBLE_MAPPING);
+ createEAttribute(xmlConvertibleMappingEClass, XML_CONVERTIBLE_MAPPING__LOB);
+ createEAttribute(xmlConvertibleMappingEClass, XML_CONVERTIBLE_MAPPING__TEMPORAL);
+ createEAttribute(xmlConvertibleMappingEClass, XML_CONVERTIBLE_MAPPING__ENUMERATED);
+
xmlBasicEClass = createEClass(XML_BASIC);
createEAttribute(xmlBasicEClass, XML_BASIC__FETCH);
createEAttribute(xmlBasicEClass, XML_BASIC__OPTIONAL);
- createEAttribute(xmlBasicEClass, XML_BASIC__LOB);
- createEAttribute(xmlBasicEClass, XML_BASIC__TEMPORAL);
- createEAttribute(xmlBasicEClass, XML_BASIC__ENUMERATED);
xmlBasicImplEClass = createEClass(XML_BASIC_IMPL);
xmlVersionEClass = createEClass(XML_VERSION);
- createEAttribute(xmlVersionEClass, XML_VERSION__TEMPORAL);
xmlVersionImplEClass = createEClass(XML_VERSION_IMPL);
@@ -10892,6 +11001,7 @@ public class OrmPackage extends EPackageImpl
xmlSingleRelationshipMappingEClass.getESuperTypes().add(this.getXmlRelationshipMapping());
xmlIdEClass.getESuperTypes().add(this.getXmlAttributeMapping());
xmlIdEClass.getESuperTypes().add(this.getColumnMapping());
+ xmlIdEClass.getESuperTypes().add(this.getXmlConvertibleMapping());
xmlIdImplEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
xmlIdImplEClass.getESuperTypes().add(this.getXmlId());
baseXmlEmbeddedEClass.getESuperTypes().add(this.getXmlAttributeMapping());
@@ -10904,10 +11014,12 @@ public class OrmPackage extends EPackageImpl
xmlEmbeddedImplEClass.getESuperTypes().add(this.getXmlEmbedded());
xmlBasicEClass.getESuperTypes().add(this.getXmlAttributeMapping());
xmlBasicEClass.getESuperTypes().add(this.getColumnMapping());
+ xmlBasicEClass.getESuperTypes().add(this.getXmlConvertibleMapping());
xmlBasicImplEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
xmlBasicImplEClass.getESuperTypes().add(this.getXmlBasic());
xmlVersionEClass.getESuperTypes().add(this.getXmlAttributeMapping());
xmlVersionEClass.getESuperTypes().add(this.getColumnMapping());
+ xmlVersionEClass.getESuperTypes().add(this.getXmlConvertibleMapping());
xmlVersionImplEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
xmlVersionImplEClass.getESuperTypes().add(this.getXmlVersion());
xmlManyToOneEClass.getESuperTypes().add(this.getXmlSingleRelationshipMapping());
@@ -11084,7 +11196,6 @@ public class OrmPackage extends EPackageImpl
initEClass(xmlIdEClass, XmlId.class, "XmlId", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getXmlId_GeneratedValue(), this.getXmlGeneratedValue(), null, "generatedValue", null, 0, 1, XmlId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlId_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, XmlId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getXmlId_TableGenerator(), this.getXmlTableGenerator(), null, "tableGenerator", null, 0, 1, XmlId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getXmlId_SequenceGenerator(), this.getXmlSequenceGenerator(), null, "sequenceGenerator", null, 0, 1, XmlId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@@ -11101,17 +11212,18 @@ public class OrmPackage extends EPackageImpl
initEClass(xmlEmbeddedImplEClass, XmlEmbeddedImpl.class, "XmlEmbeddedImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEClass(xmlConvertibleMappingEClass, XmlConvertibleMapping.class, "XmlConvertibleMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlConvertibleMapping_Lob(), theXMLTypePackage.getBoolean(), "lob", null, 0, 1, XmlConvertibleMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlConvertibleMapping_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, XmlConvertibleMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlConvertibleMapping_Enumerated(), this.getEnumType(), "enumerated", null, 0, 1, XmlConvertibleMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
initEClass(xmlBasicEClass, XmlBasic.class, "XmlBasic", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getXmlBasic_Fetch(), this.getFetchType(), "fetch", "LAZY", 0, 1, XmlBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getXmlBasic_Optional(), theXMLTypePackage.getBooleanObject(), "optional", null, 0, 1, XmlBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlBasic_Lob(), theXMLTypePackage.getBoolean(), "lob", null, 0, 1, XmlBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlBasic_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, XmlBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlBasic_Enumerated(), this.getEnumType(), "enumerated", null, 0, 1, XmlBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(xmlBasicImplEClass, XmlBasicImpl.class, "XmlBasicImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(xmlVersionEClass, XmlVersion.class, "XmlVersion", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlVersion_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, XmlVersion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(xmlVersionImplEClass, XmlVersionImpl.class, "XmlVersionImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -12222,14 +12334,6 @@ public class OrmPackage extends EPackageImpl
public static final EReference XML_ID__GENERATED_VALUE = eINSTANCE.getXmlId_GeneratedValue();
/**
- * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_ID__TEMPORAL = eINSTANCE.getXmlId_Temporal();
-
- /**
* The meta object literal for the '<em><b>Table Generator</b></em>' containment reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -12320,30 +12424,6 @@ public class OrmPackage extends EPackageImpl
public static final EAttribute XML_BASIC__OPTIONAL = eINSTANCE.getXmlBasic_Optional();
/**
- * The meta object literal for the '<em><b>Lob</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_BASIC__LOB = eINSTANCE.getXmlBasic_Lob();
-
- /**
- * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_BASIC__TEMPORAL = eINSTANCE.getXmlBasic_Temporal();
-
- /**
- * The meta object literal for the '<em><b>Enumerated</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_BASIC__ENUMERATED = eINSTANCE.getXmlBasic_Enumerated();
-
- /**
* The meta object literal for the '{@link org.eclipse.jpt.core.resource.orm.XmlBasicImpl <em>Xml Basic Impl</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -12364,14 +12444,6 @@ public class OrmPackage extends EPackageImpl
public static final EClass XML_VERSION = eINSTANCE.getXmlVersion();
/**
- * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_VERSION__TEMPORAL = eINSTANCE.getXmlVersion_Temporal();
-
- /**
* The meta object literal for the '{@link org.eclipse.jpt.core.resource.orm.XmlVersionImpl <em>Xml Version Impl</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -12506,6 +12578,40 @@ public class OrmPackage extends EPackageImpl
public static final EClass XML_EMBEDDED_IMPL = eINSTANCE.getXmlEmbeddedImpl();
/**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping <em>Xml Convertible Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping()
+ * @generated
+ */
+ public static final EClass XML_CONVERTIBLE_MAPPING = eINSTANCE.getXmlConvertibleMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Lob</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_CONVERTIBLE_MAPPING__LOB = eINSTANCE.getXmlConvertibleMapping_Lob();
+
+ /**
+ * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_CONVERTIBLE_MAPPING__TEMPORAL = eINSTANCE.getXmlConvertibleMapping_Temporal();
+
+ /**
+ * The meta object literal for the '<em><b>Enumerated</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_CONVERTIBLE_MAPPING__ENUMERATED = eINSTANCE.getXmlConvertibleMapping_Enumerated();
+
+ /**
* The meta object literal for the '{@link org.eclipse.jpt.core.resource.orm.XmlTransient <em>Xml Transient</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasic.java
index 65138e3be7..9548b73181 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasic.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasic.java
@@ -26,9 +26,6 @@ package org.eclipse.jpt.core.resource.orm;
* <ul>
* <li>{@link org.eclipse.jpt.core.resource.orm.XmlBasic#getFetch <em>Fetch</em>}</li>
* <li>{@link org.eclipse.jpt.core.resource.orm.XmlBasic#getOptional <em>Optional</em>}</li>
- * <li>{@link org.eclipse.jpt.core.resource.orm.XmlBasic#isLob <em>Lob</em>}</li>
- * <li>{@link org.eclipse.jpt.core.resource.orm.XmlBasic#getTemporal <em>Temporal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.resource.orm.XmlBasic#getEnumerated <em>Enumerated</em>}</li>
* </ul>
* </p>
*
@@ -36,7 +33,7 @@ package org.eclipse.jpt.core.resource.orm;
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface XmlBasic extends XmlAttributeMapping, ColumnMapping
+public interface XmlBasic extends XmlAttributeMapping, ColumnMapping, XmlConvertibleMapping
{
/**
* Returns the value of the '<em><b>Fetch</b></em>' attribute.
@@ -94,88 +91,4 @@ public interface XmlBasic extends XmlAttributeMapping, ColumnMapping
*/
void setOptional(Boolean value);
- /**
- * Returns the value of the '<em><b>Lob</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Lob</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Lob</em>' attribute.
- * @see #setLob(boolean)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBasic_Lob()
- * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
- * @generated
- */
- boolean isLob();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlBasic#isLob <em>Lob</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Lob</em>' attribute.
- * @see #isLob()
- * @generated
- */
- void setLob(boolean value);
-
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.resource.orm.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBasic_Temporal()
- * @model
- * @generated
- */
- TemporalType getTemporal();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlBasic#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.resource.orm.TemporalType
- * @see #getTemporal()
- * @generated
- */
- void setTemporal(TemporalType value);
-
- /**
- * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.EnumType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Enumerated</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Enumerated</em>' attribute.
- * @see org.eclipse.jpt.core.resource.orm.EnumType
- * @see #setEnumerated(EnumType)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBasic_Enumerated()
- * @model
- * @generated
- */
- EnumType getEnumerated();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlBasic#getEnumerated <em>Enumerated</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Enumerated</em>' attribute.
- * @see org.eclipse.jpt.core.resource.orm.EnumType
- * @see #getEnumerated()
- * @generated
- */
- void setEnumerated(EnumType value);
-
} // Basic
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasicImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasicImpl.java
index 2d45014b20..096d5576a3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasicImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlBasicImpl.java
@@ -12,8 +12,11 @@ package org.eclipse.jpt.core.resource.orm;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.orm.translators.OrmXmlMapper;
+import org.eclipse.jpt.core.utility.TextRange;
/**
* <!-- begin-user-doc -->
@@ -44,92 +47,92 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
protected XmlColumn column;
/**
- * changed this to null and removed the generated flag so emf won't generate over it
- * we don't want a default for enums, just null if the tag does not exist
- */
- protected static final FetchType FETCH_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
+ * The default value of the '{@link #isLob() <em>Lob</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getFetch()
+ * @see #isLob()
* @generated
* @ordered
*/
- protected FetchType fetch = FETCH_EDEFAULT;
+ protected static final boolean LOB_EDEFAULT = false;
/**
- * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
+ * The cached value of the '{@link #isLob() <em>Lob</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getOptional()
+ * @see #isLob()
* @generated
* @ordered
*/
- protected static final Boolean OPTIONAL_EDEFAULT = null;
+ protected boolean lob = LOB_EDEFAULT;
/**
- * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
*/
- protected Boolean optional = OPTIONAL_EDEFAULT;
+ protected static final TemporalType TEMPORAL_EDEFAULT = null;
/**
- * The default value of the '{@link #isLob() <em>Lob</em>}' attribute.
+ * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #isLob()
+ * @see #getTemporal()
* @generated
* @ordered
*/
- protected static final boolean LOB_EDEFAULT = false;
+ protected TemporalType temporal = TEMPORAL_EDEFAULT;
/**
- * The cached value of the '{@link #isLob() <em>Lob</em>}' attribute.
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final EnumType ENUMERATED_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #isLob()
+ * @see #getEnumerated()
* @generated
* @ordered
*/
- protected boolean lob = LOB_EDEFAULT;
+ protected EnumType enumerated = ENUMERATED_EDEFAULT;
/**
* changed this to null and removed the generated flag so emf won't generate over it
* we don't want a default for enums, just null if the tag does not exist
*/
- protected static final TemporalType TEMPORAL_EDEFAULT = null;
+ protected static final FetchType FETCH_EDEFAULT = null;
/**
- * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
+ * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getTemporal()
+ * @see #getFetch()
* @generated
* @ordered
*/
- protected TemporalType temporal = TEMPORAL_EDEFAULT;
+ protected FetchType fetch = FETCH_EDEFAULT;
/**
- * changed this to null and removed the generated flag so emf won't generate over it
- * we don't want a default for enums, just null if the tag does not exist
+ * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOptional()
+ * @generated
+ * @ordered
*/
- protected static final EnumType ENUMERATED_EDEFAULT = null;
+ protected static final Boolean OPTIONAL_EDEFAULT = null;
/**
- * The cached value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
+ * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getEnumerated()
+ * @see #getOptional()
* @generated
* @ordered
*/
- protected EnumType enumerated = ENUMERATED_EDEFAULT;
+ protected Boolean optional = OPTIONAL_EDEFAULT;
/**
* <!-- begin-user-doc -->
@@ -296,7 +299,7 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
* <!-- end-user-doc -->
* @return the value of the '<em>Lob</em>' attribute.
* @see #setLob(boolean)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBasic_Lob()
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Lob()
* @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
* @generated
*/
@@ -333,7 +336,7 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
* @return the value of the '<em>Temporal</em>' attribute.
* @see org.eclipse.jpt.core.resource.orm.TemporalType
* @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBasic_Temporal()
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
* @model
* @generated
*/
@@ -371,7 +374,7 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
* @return the value of the '<em>Enumerated</em>' attribute.
* @see org.eclipse.jpt.core.resource.orm.EnumType
* @see #setEnumerated(EnumType)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBasic_Enumerated()
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
* @model
* @generated
*/
@@ -425,16 +428,16 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
{
case OrmPackage.XML_BASIC_IMPL__COLUMN:
return getColumn();
- case OrmPackage.XML_BASIC_IMPL__FETCH:
- return getFetch();
- case OrmPackage.XML_BASIC_IMPL__OPTIONAL:
- return getOptional();
case OrmPackage.XML_BASIC_IMPL__LOB:
return isLob() ? Boolean.TRUE : Boolean.FALSE;
case OrmPackage.XML_BASIC_IMPL__TEMPORAL:
return getTemporal();
case OrmPackage.XML_BASIC_IMPL__ENUMERATED:
return getEnumerated();
+ case OrmPackage.XML_BASIC_IMPL__FETCH:
+ return getFetch();
+ case OrmPackage.XML_BASIC_IMPL__OPTIONAL:
+ return getOptional();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -452,12 +455,6 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
case OrmPackage.XML_BASIC_IMPL__COLUMN:
setColumn((XmlColumn)newValue);
return;
- case OrmPackage.XML_BASIC_IMPL__FETCH:
- setFetch((FetchType)newValue);
- return;
- case OrmPackage.XML_BASIC_IMPL__OPTIONAL:
- setOptional((Boolean)newValue);
- return;
case OrmPackage.XML_BASIC_IMPL__LOB:
setLob(((Boolean)newValue).booleanValue());
return;
@@ -467,6 +464,12 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
case OrmPackage.XML_BASIC_IMPL__ENUMERATED:
setEnumerated((EnumType)newValue);
return;
+ case OrmPackage.XML_BASIC_IMPL__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.XML_BASIC_IMPL__OPTIONAL:
+ setOptional((Boolean)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -484,12 +487,6 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
case OrmPackage.XML_BASIC_IMPL__COLUMN:
setColumn((XmlColumn)null);
return;
- case OrmPackage.XML_BASIC_IMPL__FETCH:
- setFetch(FETCH_EDEFAULT);
- return;
- case OrmPackage.XML_BASIC_IMPL__OPTIONAL:
- setOptional(OPTIONAL_EDEFAULT);
- return;
case OrmPackage.XML_BASIC_IMPL__LOB:
setLob(LOB_EDEFAULT);
return;
@@ -499,6 +496,12 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
case OrmPackage.XML_BASIC_IMPL__ENUMERATED:
setEnumerated(ENUMERATED_EDEFAULT);
return;
+ case OrmPackage.XML_BASIC_IMPL__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.XML_BASIC_IMPL__OPTIONAL:
+ setOptional(OPTIONAL_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -515,16 +518,16 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
{
case OrmPackage.XML_BASIC_IMPL__COLUMN:
return column != null;
- case OrmPackage.XML_BASIC_IMPL__FETCH:
- return fetch != FETCH_EDEFAULT;
- case OrmPackage.XML_BASIC_IMPL__OPTIONAL:
- return OPTIONAL_EDEFAULT == null ? optional != null : !OPTIONAL_EDEFAULT.equals(optional);
case OrmPackage.XML_BASIC_IMPL__LOB:
return lob != LOB_EDEFAULT;
case OrmPackage.XML_BASIC_IMPL__TEMPORAL:
return temporal != TEMPORAL_EDEFAULT;
case OrmPackage.XML_BASIC_IMPL__ENUMERATED:
return enumerated != ENUMERATED_EDEFAULT;
+ case OrmPackage.XML_BASIC_IMPL__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.XML_BASIC_IMPL__OPTIONAL:
+ return OPTIONAL_EDEFAULT == null ? optional != null : !OPTIONAL_EDEFAULT.equals(optional);
}
return super.eIsSet(featureID);
}
@@ -545,15 +548,22 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
default: return -1;
}
}
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_BASIC_IMPL__LOB: return OrmPackage.XML_CONVERTIBLE_MAPPING__LOB;
+ case OrmPackage.XML_BASIC_IMPL__TEMPORAL: return OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL;
+ case OrmPackage.XML_BASIC_IMPL__ENUMERATED: return OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED;
+ default: return -1;
+ }
+ }
if (baseClass == XmlBasic.class)
{
switch (derivedFeatureID)
{
case OrmPackage.XML_BASIC_IMPL__FETCH: return OrmPackage.XML_BASIC__FETCH;
case OrmPackage.XML_BASIC_IMPL__OPTIONAL: return OrmPackage.XML_BASIC__OPTIONAL;
- case OrmPackage.XML_BASIC_IMPL__LOB: return OrmPackage.XML_BASIC__LOB;
- case OrmPackage.XML_BASIC_IMPL__TEMPORAL: return OrmPackage.XML_BASIC__TEMPORAL;
- case OrmPackage.XML_BASIC_IMPL__ENUMERATED: return OrmPackage.XML_BASIC__ENUMERATED;
default: return -1;
}
}
@@ -576,15 +586,22 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
default: return -1;
}
}
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__LOB: return OrmPackage.XML_BASIC_IMPL__LOB;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL: return OrmPackage.XML_BASIC_IMPL__TEMPORAL;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED: return OrmPackage.XML_BASIC_IMPL__ENUMERATED;
+ default: return -1;
+ }
+ }
if (baseClass == XmlBasic.class)
{
switch (baseFeatureID)
{
case OrmPackage.XML_BASIC__FETCH: return OrmPackage.XML_BASIC_IMPL__FETCH;
case OrmPackage.XML_BASIC__OPTIONAL: return OrmPackage.XML_BASIC_IMPL__OPTIONAL;
- case OrmPackage.XML_BASIC__LOB: return OrmPackage.XML_BASIC_IMPL__LOB;
- case OrmPackage.XML_BASIC__TEMPORAL: return OrmPackage.XML_BASIC_IMPL__TEMPORAL;
- case OrmPackage.XML_BASIC__ENUMERATED: return OrmPackage.XML_BASIC_IMPL__ENUMERATED;
default: return -1;
}
}
@@ -602,18 +619,29 @@ public class XmlBasicImpl extends AbstractXmlAttributeMapping implements XmlBasi
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
- result.append(" (fetch: ");
- result.append(fetch);
- result.append(", optional: ");
- result.append(optional);
- result.append(", lob: ");
+ result.append(" (lob: ");
result.append(lob);
result.append(", temporal: ");
result.append(temporal);
result.append(", enumerated: ");
result.append(enumerated);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(", optional: ");
+ result.append(optional);
result.append(')');
return result.toString();
}
+
+ public TextRange getEnumeratedTextRange() {
+ return getAttributeTextRange(OrmXmlMapper.ENUMERATED);
+ }
+ public TextRange getLobTextRange() {
+ return getAttributeTextRange(OrmXmlMapper.LOB);
+ }
+
+ public TextRange getTemporalTextRange() {
+ return getAttributeTextRange(OrmXmlMapper.TEMPORAL);
+ }
} // BasicImpl
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlConvertibleMapping.java
new file mode 100644
index 0000000000..a2e27fb7a1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlConvertibleMapping.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * 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.core.resource.orm;
+
+import org.eclipse.jpt.core.resource.common.JpaEObject;
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Convertible Mapping</b></em>'.
+ *
+ * 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.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#isLob <em>Lob</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#getTemporal <em>Temporal</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#getEnumerated <em>Enumerated</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlConvertibleMapping extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Lob</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Lob</em>' attribute.
+ * @see #setLob(boolean)
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Lob()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isLob();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#isLob <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Lob</em>' attribute.
+ * @see #isLob()
+ * @generated
+ */
+ void setLob(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
+ * @model
+ * @generated
+ */
+ TemporalType getTemporal();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#getTemporal <em>Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.resource.orm.TemporalType
+ * @see #getTemporal()
+ * @generated
+ */
+ void setTemporal(TemporalType value);
+
+ /**
+ * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.EnumType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Enumerated</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.core.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
+ * @model
+ * @generated
+ */
+ EnumType getEnumerated();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping#getEnumerated <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.core.resource.orm.EnumType
+ * @see #getEnumerated()
+ * @generated
+ */
+ void setEnumerated(EnumType value);
+
+ /**
+ * Return the {@link TextRange} for the enumerated element. If the enumerated element
+ * does not exist return the {@link TextRange} for the basic element.
+ */
+ TextRange getEnumeratedTextRange();
+
+ /**
+ * Return the {@link TextRange} for the temporal element. If the temporal element
+ * does not exist return the {@link TextRange} for the basic element.
+ */
+ TextRange getTemporalTextRange();
+
+ /**
+ * Return the {@link TextRange} for the lob element. If the lob element
+ * does not exist return the {@link TextRange} for the basic element.
+ */
+ TextRange getLobTextRange();
+
+} // ConvertableMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlId.java
index c56d38c1d9..f9e0c3ad51 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlId.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlId.java
@@ -25,7 +25,6 @@ package org.eclipse.jpt.core.resource.orm;
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.jpt.core.resource.orm.XmlId#getGeneratedValue <em>Generated Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.resource.orm.XmlId#getTemporal <em>Temporal</em>}</li>
* <li>{@link org.eclipse.jpt.core.resource.orm.XmlId#getTableGenerator <em>Table Generator</em>}</li>
* <li>{@link org.eclipse.jpt.core.resource.orm.XmlId#getSequenceGenerator <em>Sequence Generator</em>}</li>
* </ul>
@@ -35,7 +34,7 @@ package org.eclipse.jpt.core.resource.orm;
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface XmlId extends XmlAttributeMapping, ColumnMapping
+public interface XmlId extends XmlAttributeMapping, ColumnMapping, XmlConvertibleMapping
{
/**
* Returns the value of the '<em><b>Generated Value</b></em>' containment reference.
@@ -64,35 +63,6 @@ public interface XmlId extends XmlAttributeMapping, ColumnMapping
void setGeneratedValue(XmlGeneratedValue value);
/**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.resource.orm.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlId_Temporal()
- * @model
- * @generated
- */
- TemporalType getTemporal();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlId#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.resource.orm.TemporalType
- * @see #getTemporal()
- * @generated
- */
- void setTemporal(TemporalType value);
-
- /**
* Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlIdImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlIdImpl.java
index 1f675e59ab..e99a3e006b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlIdImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlIdImpl.java
@@ -14,6 +14,8 @@ import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.orm.translators.OrmXmlMapper;
+import org.eclipse.jpt.core.utility.TextRange;
/**
* <!-- begin-user-doc -->
@@ -44,14 +46,24 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
protected XmlColumn column;
/**
- * The cached value of the '{@link #getGeneratedValue() <em>Generated Value</em>}' containment reference.
+ * The default value of the '{@link #isLob() <em>Lob</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getGeneratedValue()
+ * @see #isLob()
* @generated
* @ordered
*/
- protected XmlGeneratedValue generatedValue;
+ protected static final boolean LOB_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isLob() <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isLob()
+ * @generated
+ * @ordered
+ */
+ protected boolean lob = LOB_EDEFAULT;
/**
* changed this to null and removed the generated flag so emf won't generate over it
@@ -70,6 +82,36 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
protected TemporalType temporal = TEMPORAL_EDEFAULT;
/**
+ * The default value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEnumerated()
+ * @generated
+ * @ordered
+ */
+ protected static final EnumType ENUMERATED_EDEFAULT = EnumType.ORDINAL;
+
+ /**
+ * The cached value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEnumerated()
+ * @generated
+ * @ordered
+ */
+ protected EnumType enumerated = ENUMERATED_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getGeneratedValue() <em>Generated Value</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getGeneratedValue()
+ * @generated
+ * @ordered
+ */
+ protected XmlGeneratedValue generatedValue;
+
+ /**
* The cached value of the '{@link #getTableGenerator() <em>Table Generator</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -171,6 +213,41 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
}
/**
+ * Returns the value of the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Lob</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Lob</em>' attribute.
+ * @see #setLob(boolean)
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Lob()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isLob()
+ {
+ return lob;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlIdImpl#isLob <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Lob</em>' attribute.
+ * @see #isLob()
+ * @generated
+ */
+ public void setLob(boolean newLob)
+ {
+ boolean oldLob = lob;
+ lob = newLob;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID_IMPL__LOB, oldLob, lob));
+ }
+
+ /**
* Returns the value of the '<em><b>Generated Value</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
@@ -242,7 +319,7 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
* @return the value of the '<em>Temporal</em>' attribute.
* @see org.eclipse.jpt.core.resource.orm.TemporalType
* @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlId_Temporal()
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
* @model
* @generated
*/
@@ -269,6 +346,44 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
}
/**
+ * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.EnumType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Enumerated</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.core.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getEnumerated()
+ {
+ return enumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlIdImpl#getEnumerated <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.core.resource.orm.EnumType
+ * @see #getEnumerated()
+ * @generated
+ */
+ public void setEnumerated(EnumType newEnumerated)
+ {
+ EnumType oldEnumerated = enumerated;
+ enumerated = newEnumerated == null ? ENUMERATED_EDEFAULT : newEnumerated;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID_IMPL__ENUMERATED, oldEnumerated, enumerated));
+ }
+
+ /**
* Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
@@ -422,10 +537,14 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
{
case OrmPackage.XML_ID_IMPL__COLUMN:
return getColumn();
- case OrmPackage.XML_ID_IMPL__GENERATED_VALUE:
- return getGeneratedValue();
+ case OrmPackage.XML_ID_IMPL__LOB:
+ return isLob() ? Boolean.TRUE : Boolean.FALSE;
case OrmPackage.XML_ID_IMPL__TEMPORAL:
return getTemporal();
+ case OrmPackage.XML_ID_IMPL__ENUMERATED:
+ return getEnumerated();
+ case OrmPackage.XML_ID_IMPL__GENERATED_VALUE:
+ return getGeneratedValue();
case OrmPackage.XML_ID_IMPL__TABLE_GENERATOR:
return getTableGenerator();
case OrmPackage.XML_ID_IMPL__SEQUENCE_GENERATOR:
@@ -447,12 +566,18 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
case OrmPackage.XML_ID_IMPL__COLUMN:
setColumn((XmlColumn)newValue);
return;
- case OrmPackage.XML_ID_IMPL__GENERATED_VALUE:
- setGeneratedValue((XmlGeneratedValue)newValue);
+ case OrmPackage.XML_ID_IMPL__LOB:
+ setLob(((Boolean)newValue).booleanValue());
return;
case OrmPackage.XML_ID_IMPL__TEMPORAL:
setTemporal((TemporalType)newValue);
return;
+ case OrmPackage.XML_ID_IMPL__ENUMERATED:
+ setEnumerated((EnumType)newValue);
+ return;
+ case OrmPackage.XML_ID_IMPL__GENERATED_VALUE:
+ setGeneratedValue((XmlGeneratedValue)newValue);
+ return;
case OrmPackage.XML_ID_IMPL__TABLE_GENERATOR:
setTableGenerator((XmlTableGenerator)newValue);
return;
@@ -476,12 +601,18 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
case OrmPackage.XML_ID_IMPL__COLUMN:
setColumn((XmlColumn)null);
return;
- case OrmPackage.XML_ID_IMPL__GENERATED_VALUE:
- setGeneratedValue((XmlGeneratedValue)null);
+ case OrmPackage.XML_ID_IMPL__LOB:
+ setLob(LOB_EDEFAULT);
return;
case OrmPackage.XML_ID_IMPL__TEMPORAL:
setTemporal(TEMPORAL_EDEFAULT);
return;
+ case OrmPackage.XML_ID_IMPL__ENUMERATED:
+ setEnumerated(ENUMERATED_EDEFAULT);
+ return;
+ case OrmPackage.XML_ID_IMPL__GENERATED_VALUE:
+ setGeneratedValue((XmlGeneratedValue)null);
+ return;
case OrmPackage.XML_ID_IMPL__TABLE_GENERATOR:
setTableGenerator((XmlTableGenerator)null);
return;
@@ -504,10 +635,14 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
{
case OrmPackage.XML_ID_IMPL__COLUMN:
return column != null;
- case OrmPackage.XML_ID_IMPL__GENERATED_VALUE:
- return generatedValue != null;
+ case OrmPackage.XML_ID_IMPL__LOB:
+ return lob != LOB_EDEFAULT;
case OrmPackage.XML_ID_IMPL__TEMPORAL:
return temporal != TEMPORAL_EDEFAULT;
+ case OrmPackage.XML_ID_IMPL__ENUMERATED:
+ return enumerated != ENUMERATED_EDEFAULT;
+ case OrmPackage.XML_ID_IMPL__GENERATED_VALUE:
+ return generatedValue != null;
case OrmPackage.XML_ID_IMPL__TABLE_GENERATOR:
return tableGenerator != null;
case OrmPackage.XML_ID_IMPL__SEQUENCE_GENERATOR:
@@ -532,12 +667,21 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
default: return -1;
}
}
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ID_IMPL__LOB: return OrmPackage.XML_CONVERTIBLE_MAPPING__LOB;
+ case OrmPackage.XML_ID_IMPL__TEMPORAL: return OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL;
+ case OrmPackage.XML_ID_IMPL__ENUMERATED: return OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED;
+ default: return -1;
+ }
+ }
if (baseClass == XmlId.class)
{
switch (derivedFeatureID)
{
case OrmPackage.XML_ID_IMPL__GENERATED_VALUE: return OrmPackage.XML_ID__GENERATED_VALUE;
- case OrmPackage.XML_ID_IMPL__TEMPORAL: return OrmPackage.XML_ID__TEMPORAL;
case OrmPackage.XML_ID_IMPL__TABLE_GENERATOR: return OrmPackage.XML_ID__TABLE_GENERATOR;
case OrmPackage.XML_ID_IMPL__SEQUENCE_GENERATOR: return OrmPackage.XML_ID__SEQUENCE_GENERATOR;
default: return -1;
@@ -562,12 +706,21 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
default: return -1;
}
}
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__LOB: return OrmPackage.XML_ID_IMPL__LOB;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL: return OrmPackage.XML_ID_IMPL__TEMPORAL;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED: return OrmPackage.XML_ID_IMPL__ENUMERATED;
+ default: return -1;
+ }
+ }
if (baseClass == XmlId.class)
{
switch (baseFeatureID)
{
case OrmPackage.XML_ID__GENERATED_VALUE: return OrmPackage.XML_ID_IMPL__GENERATED_VALUE;
- case OrmPackage.XML_ID__TEMPORAL: return OrmPackage.XML_ID_IMPL__TEMPORAL;
case OrmPackage.XML_ID__TABLE_GENERATOR: return OrmPackage.XML_ID_IMPL__TABLE_GENERATOR;
case OrmPackage.XML_ID__SEQUENCE_GENERATOR: return OrmPackage.XML_ID_IMPL__SEQUENCE_GENERATOR;
default: return -1;
@@ -587,10 +740,26 @@ public class XmlIdImpl extends AbstractXmlAttributeMapping implements XmlId
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
- result.append(" (temporal: ");
+ result.append(" (lob: ");
+ result.append(lob);
+ result.append(", temporal: ");
result.append(temporal);
+ result.append(", enumerated: ");
+ result.append(enumerated);
result.append(')');
return result.toString();
}
+ public TextRange getEnumeratedTextRange() {
+ return getAttributeTextRange(OrmXmlMapper.ENUMERATED);
+ }
+
+ public TextRange getLobTextRange() {
+ throw new UnsupportedOperationException("lob not supported by id mappings");
+ }
+
+ public TextRange getTemporalTextRange() {
+ throw new UnsupportedOperationException("temporal not supported by id mappings");
+ }
+
} // Id
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersion.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersion.java
index c1e5ed9ac2..f3b06bb5b4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersion.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersion.java
@@ -21,46 +21,12 @@ package org.eclipse.jpt.core.resource.orm;
* will almost certainly be broken (repeatedly) as the API evolves.
* <!-- end-user-doc -->
*
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.resource.orm.XmlVersion#getTemporal <em>Temporal</em>}</li>
- * </ul>
- * </p>
*
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlVersion()
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface XmlVersion extends XmlAttributeMapping, ColumnMapping
+public interface XmlVersion extends XmlAttributeMapping, ColumnMapping, XmlConvertibleMapping
{
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.resource.orm.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlVersion_Temporal()
- * @model
- * @generated
- */
- TemporalType getTemporal();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlVersion#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.resource.orm.TemporalType
- * @see #getTemporal()
- * @generated
- */
- void setTemporal(TemporalType value);
} // Version
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersionImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersionImpl.java
index e5638836bc..d39835b709 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersionImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlVersionImpl.java
@@ -14,6 +14,8 @@ import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.orm.translators.OrmXmlMapper;
+import org.eclipse.jpt.core.utility.TextRange;
/**
* <!-- begin-user-doc -->
@@ -44,6 +46,26 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
protected XmlColumn column;
/**
+ * The default value of the '{@link #isLob() <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isLob()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean LOB_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isLob() <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isLob()
+ * @generated
+ * @ordered
+ */
+ protected boolean lob = LOB_EDEFAULT;
+
+ /**
* changed this to null and removed the generated flag so emf won't generate over it
* we don't want a default for enums, just null if the tag does not exist
*/
@@ -60,6 +82,26 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
protected TemporalType temporal = TEMPORAL_EDEFAULT;
/**
+ * The default value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEnumerated()
+ * @generated
+ * @ordered
+ */
+ protected static final EnumType ENUMERATED_EDEFAULT = EnumType.ORDINAL;
+
+ /**
+ * The cached value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEnumerated()
+ * @generated
+ * @ordered
+ */
+ protected EnumType enumerated = ENUMERATED_EDEFAULT;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -141,6 +183,41 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
}
/**
+ * Returns the value of the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Lob</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Lob</em>' attribute.
+ * @see #setLob(boolean)
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Lob()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isLob()
+ {
+ return lob;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlVersionImpl#isLob <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Lob</em>' attribute.
+ * @see #isLob()
+ * @generated
+ */
+ public void setLob(boolean newLob)
+ {
+ boolean oldLob = lob;
+ lob = newLob;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_VERSION_IMPL__LOB, oldLob, lob));
+ }
+
+ /**
* Returns the value of the '<em><b>Temporal</b></em>' attribute.
* The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.TemporalType}.
* <!-- begin-user-doc -->
@@ -152,7 +229,7 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
* @return the value of the '<em>Temporal</em>' attribute.
* @see org.eclipse.jpt.core.resource.orm.TemporalType
* @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlVersion_Temporal()
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
* @model
* @generated
*/
@@ -179,6 +256,44 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
}
/**
+ * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.EnumType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Enumerated</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.core.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getEnumerated()
+ {
+ return enumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlVersionImpl#getEnumerated <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.core.resource.orm.EnumType
+ * @see #getEnumerated()
+ * @generated
+ */
+ public void setEnumerated(EnumType newEnumerated)
+ {
+ EnumType oldEnumerated = enumerated;
+ enumerated = newEnumerated == null ? ENUMERATED_EDEFAULT : newEnumerated;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_VERSION_IMPL__ENUMERATED, oldEnumerated, enumerated));
+ }
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -206,8 +321,12 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
{
case OrmPackage.XML_VERSION_IMPL__COLUMN:
return getColumn();
+ case OrmPackage.XML_VERSION_IMPL__LOB:
+ return isLob() ? Boolean.TRUE : Boolean.FALSE;
case OrmPackage.XML_VERSION_IMPL__TEMPORAL:
return getTemporal();
+ case OrmPackage.XML_VERSION_IMPL__ENUMERATED:
+ return getEnumerated();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -225,9 +344,15 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
case OrmPackage.XML_VERSION_IMPL__COLUMN:
setColumn((XmlColumn)newValue);
return;
+ case OrmPackage.XML_VERSION_IMPL__LOB:
+ setLob(((Boolean)newValue).booleanValue());
+ return;
case OrmPackage.XML_VERSION_IMPL__TEMPORAL:
setTemporal((TemporalType)newValue);
return;
+ case OrmPackage.XML_VERSION_IMPL__ENUMERATED:
+ setEnumerated((EnumType)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -245,9 +370,15 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
case OrmPackage.XML_VERSION_IMPL__COLUMN:
setColumn((XmlColumn)null);
return;
+ case OrmPackage.XML_VERSION_IMPL__LOB:
+ setLob(LOB_EDEFAULT);
+ return;
case OrmPackage.XML_VERSION_IMPL__TEMPORAL:
setTemporal(TEMPORAL_EDEFAULT);
return;
+ case OrmPackage.XML_VERSION_IMPL__ENUMERATED:
+ setEnumerated(ENUMERATED_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -264,8 +395,12 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
{
case OrmPackage.XML_VERSION_IMPL__COLUMN:
return column != null;
+ case OrmPackage.XML_VERSION_IMPL__LOB:
+ return lob != LOB_EDEFAULT;
case OrmPackage.XML_VERSION_IMPL__TEMPORAL:
return temporal != TEMPORAL_EDEFAULT;
+ case OrmPackage.XML_VERSION_IMPL__ENUMERATED:
+ return enumerated != ENUMERATED_EDEFAULT;
}
return super.eIsSet(featureID);
}
@@ -286,11 +421,20 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
default: return -1;
}
}
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_VERSION_IMPL__LOB: return OrmPackage.XML_CONVERTIBLE_MAPPING__LOB;
+ case OrmPackage.XML_VERSION_IMPL__TEMPORAL: return OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL;
+ case OrmPackage.XML_VERSION_IMPL__ENUMERATED: return OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED;
+ default: return -1;
+ }
+ }
if (baseClass == XmlVersion.class)
{
switch (derivedFeatureID)
{
- case OrmPackage.XML_VERSION_IMPL__TEMPORAL: return OrmPackage.XML_VERSION__TEMPORAL;
default: return -1;
}
}
@@ -313,11 +457,20 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
default: return -1;
}
}
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__LOB: return OrmPackage.XML_VERSION_IMPL__LOB;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL: return OrmPackage.XML_VERSION_IMPL__TEMPORAL;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED: return OrmPackage.XML_VERSION_IMPL__ENUMERATED;
+ default: return -1;
+ }
+ }
if (baseClass == XmlVersion.class)
{
switch (baseFeatureID)
{
- case OrmPackage.XML_VERSION__TEMPORAL: return OrmPackage.XML_VERSION_IMPL__TEMPORAL;
default: return -1;
}
}
@@ -335,10 +488,26 @@ public class XmlVersionImpl extends AbstractXmlAttributeMapping implements XmlVe
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
- result.append(" (temporal: ");
+ result.append(" (lob: ");
+ result.append(lob);
+ result.append(", temporal: ");
result.append(temporal);
+ result.append(", enumerated: ");
+ result.append(enumerated);
result.append(')');
return result.toString();
}
+ public TextRange getEnumeratedTextRange() {
+ return getAttributeTextRange(OrmXmlMapper.ENUMERATED);
+ }
+
+ public TextRange getLobTextRange() {
+ throw new UnsupportedOperationException("lob not supported by version mappings");
+ }
+
+ public TextRange getTemporalTextRange() {
+ throw new UnsupportedOperationException("temporal not supported by version mappings");
+ }
+
} // Version
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
index b110153f84..2ed044fe1a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
@@ -50,6 +50,11 @@ BasicGeneralSection_optionalLabelDefault=Optional ({0})
BasicGeneralSection_lobLabel=Lob
BasicGeneralSection_temporalLabel=Temporal:
BasicGeneralSection_enumeratedLabel=Enumerated:
+BasicMappingComposite_conversion=Conversion
+BasicMappingComposite_noConverter=No converter
+BasicMappingComposite_lobConverter=Lob
+BasicMappingComposite_temporalConverter=Temporal
+BasicMappingComposite_enumeratedConverter=Enumerated
DefaultBasicMappingUiProvider_Default=Default ({0})
DefaultEmbeddedMappingUiProvider_Default=Default ({0})
@@ -199,6 +204,9 @@ IdMappingComposite_pk_generation=PK Generation
IdMappingComposite_primaryKeyGeneration=Primary Key Generation
IdMappingComposite_tableGenerator=Table Generator
IdMappingComposite_sequenceGenerator=Sequence Generator
+IdMappingComposite_conversion=Conversion
+IdMappingComposite_noConverter=No converter
+IdMappingComposite_temporalConverter=Temporal
GeneratedValueComposite_generatedValue=Generated Value
GeneratedValueComposite_generatorName=Generator Name:
@@ -300,3 +308,8 @@ QueryHintsComposite_valueColumn=Value
OrmSecondaryTablesComposite_defineInXml=Define in XML
NullAttributeMappingUiProvider_label=Unmapped
+
+VersionMappingComposite_conversion=Conversion
+VersionMappingComposite_noConverter=No converter
+VersionMappingComposite_temporalConverter=Temporal
+
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
index d34e55a369..d6bd9ac3c8 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
@@ -30,6 +30,11 @@ public class JptUiMappingsMessages {
public static String BasicGeneralSection_optionalLabel;
public static String BasicGeneralSection_optionalLabelDefault;
public static String BasicGeneralSection_temporalLabel;
+ public static String BasicMappingComposite_conversion;
+ public static String BasicMappingComposite_noConverter;
+ public static String BasicMappingComposite_lobConverter;
+ public static String BasicMappingComposite_temporalConverter;
+ public static String BasicMappingComposite_enumeratedConverter;
public static String Boolean_False;
public static String Boolean_True;
public static String CascadeComposite_all;
@@ -90,6 +95,9 @@ public class JptUiMappingsMessages {
public static String IdMappingComposite_primaryKeyGeneration;
public static String IdMappingComposite_sequenceGenerator;
public static String IdMappingComposite_tableGenerator;
+ public static String IdMappingComposite_conversion;
+ public static String IdMappingComposite_noConverter;
+ public static String IdMappingComposite_temporalConverter;
public static String AbstractInheritanceComposite_char;
public static String InheritanceComposite_detailsGroupBox;
public static String InheritanceComposite_discriminatorColumnGroupBox;
@@ -264,6 +272,9 @@ public class JptUiMappingsMessages {
public static String TemporalTypeComposite_date;
public static String TemporalTypeComposite_time;
public static String TemporalTypeComposite_timestamp;
+ public static String VersionMappingComposite_conversion;
+ public static String VersionMappingComposite_noConverter;
+ public static String VersionMappingComposite_temporalConverter;
private static final String BUNDLE_NAME = "jpt_ui_mappings"; //$NON-NLS-1$
private static final Class<?> BUNDLE_CLASS = JptUiMappingsMessages.class;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java
index 82c37cff28..c317e86f43 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java
@@ -11,11 +11,20 @@ package org.eclipse.jpt.ui.internal.mappings.details;
import org.eclipse.jpt.core.context.BasicMapping;
import org.eclipse.jpt.core.context.Column;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.EnumeratedConverter;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
/**
@@ -83,42 +92,176 @@ public class BasicMappingComposite extends FormPane<BasicMapping>
super(subjectHolder, parent, widgetFactory);
}
- private PropertyValueModel<Column> buildColumnHolder() {
- return new TransformationPropertyValueModel<BasicMapping, Column>(getSubjectHolder()) {
- @Override
- protected Column transform_(BasicMapping value) {
- return value.getColumn();
- }
- };
- }
-
- /*
- * (non-Javadoc)
- */
@Override
protected void initializeLayout(Composite container) {
-
+ initializeGeneralPane(container);
+ initializeConversionPane(container);
+ }
+
+ private void initializeGeneralPane(Composite container) {
int groupBoxMargin = getGroupBoxMargin();
- // Column widgets
new ColumnComposite(this, buildColumnHolder(), container);
// Align the widgets under the ColumnComposite
container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
- // Fetch Type widgets
new FetchTypeComposite(this, container);
+ new OptionalComposite(this, addSubPane(container, 4));
- // Temporal Type widgets
- new TemporalTypeComposite(this, container);
+ }
+ private void initializeConversionPane(Composite container) {
- // Enumerated widgets
- new EnumTypeComposite(this, container);
+ container = addCollapsableSection(
+ container,
+ JptUiMappingsMessages.BasicMappingComposite_conversion
+ );
+ ((GridLayout) container.getLayout()).numColumns = 2;
- // Optional widgets
- new OptionalComposite(this, addSubPane(container, 4));
+ // No converter
+ Button noConverterButton = addRadioButton(
+ container,
+ JptUiMappingsMessages.BasicMappingComposite_noConverter,
+ buildNoConverterHolder(),
+ null);
+ ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2;
+
+ // Lob
+ Button lobButton = addRadioButton(
+ container,
+ JptUiMappingsMessages.BasicMappingComposite_lobConverter,
+ buildLobConverterHolder(),
+ null);
+ ((GridData) lobButton.getLayoutData()).horizontalSpan = 2;
+
+ PropertyValueModel<Converter> specifiedConverterHolder = buildSpecifiedConverterHolder();
+ // Temporal
+ addRadioButton(
+ container,
+ JptUiMappingsMessages.BasicMappingComposite_temporalConverter,
+ buildTemporalBooleanHolder(),
+ null);
+ registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(specifiedConverterHolder), container, getWidgetFactory()));
+
+
+ // Enumerated
+ addRadioButton(
+ container,
+ JptUiMappingsMessages.BasicMappingComposite_enumeratedConverter,
+ buildEnumeratedBooleanHolder(),
+ null);
+ registerSubPane(new EnumTypeComposite(buildEnumeratedConverterHolder(specifiedConverterHolder), container, getWidgetFactory()));
+ }
- // Lob check box
- new LobComposite(this, container);
+ private PropertyValueModel<Column> buildColumnHolder() {
+ return new TransformationPropertyValueModel<BasicMapping, Column>(getSubjectHolder()) {
+ @Override
+ protected Column transform_(BasicMapping value) {
+ return value.getColumn();
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildNoConverterHolder() {
+ return new PropertyAspectAdapter<BasicMapping, Boolean>(getSubjectHolder(), BasicMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.getSpecifiedConverter() == null);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setSpecifiedConverter(Converter.NO_CONVERTER);
+ }
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildLobConverterHolder() {
+ return new PropertyAspectAdapter<BasicMapping, Boolean>(getSubjectHolder(), BasicMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ Converter converter = this.subject.getSpecifiedConverter();
+ if (converter == null) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(converter.getType() == Converter.LOB_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setSpecifiedConverter(Converter.LOB_CONVERTER);
+ }
+ }
+ };
+ }
+
+ private PropertyValueModel<Converter> buildSpecifiedConverterHolder() {
+ return new PropertyAspectAdapter<BasicMapping, Converter>(getSubjectHolder(), BasicMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Converter buildValue_() {
+ return this.subject.getSpecifiedConverter();
+ }
+ };
+ }
+
+ private PropertyValueModel<TemporalConverter> buildTemporalConverterHolder(PropertyValueModel<Converter> converterHolder) {
+ return new TransformationPropertyValueModel<Converter, TemporalConverter>(converterHolder) {
+ @Override
+ protected TemporalConverter transform_(Converter converter) {
+ return (converter != null && converter.getType() == Converter.TEMPORAL_CONVERTER) ? (TemporalConverter) converter : null;
+ }
+ };
+ }
+
+ private PropertyValueModel<EnumeratedConverter> buildEnumeratedConverterHolder(PropertyValueModel<Converter> converterHolder) {
+ return new TransformationPropertyValueModel<Converter, EnumeratedConverter>(converterHolder) {
+ @Override
+ protected EnumeratedConverter transform_(Converter converter) {
+ return (converter != null && converter.getType() == Converter.ENUMERATED_CONVERTER) ? (EnumeratedConverter) converter : null;
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildTemporalBooleanHolder() {
+ return new PropertyAspectAdapter<BasicMapping, Boolean>(getSubjectHolder(), BasicMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ Converter converter = this.subject.getSpecifiedConverter();
+ if (converter == null) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(converter.getType() == Converter.TEMPORAL_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ }
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildEnumeratedBooleanHolder() {
+ return new PropertyAspectAdapter<BasicMapping, Boolean>(getSubjectHolder(), BasicMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ Converter converter = this.subject.getSpecifiedConverter();
+ if (converter == null) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(converter.getType() == Converter.ENUMERATED_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setSpecifiedConverter(Converter.ENUMERATED_CONVERTER);
+ }
+ }
+ };
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java
index 794f48aad7..74c16c0320 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java
@@ -9,12 +9,15 @@
package org.eclipse.jpt.ui.internal.mappings.details;
import java.util.Collection;
-import org.eclipse.jpt.core.context.BasicMapping;
import org.eclipse.jpt.core.context.EnumType;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
+import org.eclipse.jpt.core.context.EnumeratedConverter;
+import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.jpt.ui.internal.util.PaneEnabler;
import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
+import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
/**
@@ -32,29 +35,29 @@ import org.eclipse.swt.widgets.Composite;
* @version 2.0
* @since 1.0
*/
-public class EnumTypeComposite extends FormPane<BasicMapping>
+public class EnumTypeComposite extends FormPane<EnumeratedConverter>
{
/**
- * Creates a new <code>FetchTypeComposite</code>.
+ * Creates a new <code>EnumTypeComposite</code>.
*
* @param parentPane The parent container of this one
* @param parent The parent container
*/
- public EnumTypeComposite(FormPane<? extends BasicMapping> parentPane,
- Composite parent) {
+ public EnumTypeComposite(PropertyValueModel<? extends EnumeratedConverter> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory) {
- super(parentPane, parent);
+ super(subjectHolder, parent, widgetFactory);
}
- private EnumFormComboViewer<BasicMapping, EnumType> addEnumTypeCombo(Composite container) {
+ private EnumFormComboViewer<EnumeratedConverter, EnumType> addEnumTypeCombo(Composite container) {
- return new EnumFormComboViewer<BasicMapping, EnumType>(this, container) {
+ return new EnumFormComboViewer<EnumeratedConverter, EnumType>(this, container) {
@Override
protected void addPropertyNames(Collection<String> propertyNames) {
super.addPropertyNames(propertyNames);
- propertyNames.add(BasicMapping.DEFAULT_ENUMERATED_PROPERTY);
- propertyNames.add(BasicMapping.SPECIFIED_ENUMERATED_PROPERTY);
+ propertyNames.add(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY);
}
@Override
@@ -64,7 +67,7 @@ public class EnumTypeComposite extends FormPane<BasicMapping>
@Override
protected EnumType getDefaultValue() {
- return getSubject().getDefaultEnumerated();
+ return getSubject().getDefaultEnumType();
}
@Override
@@ -78,27 +81,34 @@ public class EnumTypeComposite extends FormPane<BasicMapping>
@Override
protected EnumType getValue() {
- return getSubject().getSpecifiedEnumerated();
+ return getSubject().getSpecifiedEnumType();
}
@Override
protected void setValue(EnumType value) {
- getSubject().setSpecifiedEnumerated(value);
+ getSubject().setSpecifiedEnumType(value);
}
};
}
- /*
- * (non-Javadoc)
- */
@Override
protected void initializeLayout(Composite container) {
-
- addLabeledComposite(
- container,
- JptUiMappingsMessages.BasicGeneralSection_enumeratedLabel,
- addEnumTypeCombo(container),
- JpaHelpContextIds.MAPPING_ENUMERATED
- );
+ //JpaHelpContextIds.MAPPING_ENUMERATED
+ addEnumTypeCombo(container);
+
+ new PaneEnabler(buildBooleanHolder(), this);
+ }
+
+
+ protected PropertyValueModel<Boolean> buildBooleanHolder() {
+ return new TransformationPropertyValueModel<EnumeratedConverter, Boolean>(getSubjectHolder()) {
+ @Override
+ protected Boolean transform(EnumeratedConverter value) {
+ if (getSubject() != null && getSubject().getParent().getPersistentAttribute().isVirtual()) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(value != null);
+ }
+ };
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java
index dc3ec6a641..77e7782477 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java
@@ -10,12 +10,20 @@
package org.eclipse.jpt.ui.internal.mappings.details;
import org.eclipse.jpt.core.context.Column;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.IdMapping;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
/**
@@ -74,25 +82,98 @@ public class IdMappingComposite extends FormPane<IdMapping>
};
}
- private Composite addPane(Composite container, int groupBoxMargin) {
- return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
- }
-
- /*
- * (non-Javadoc)
- */
@Override
protected void initializeLayout(Composite container) {
-
- int groupBoxMargin = getGroupBoxMargin();
-
+
// Column widgets
new ColumnComposite(this, buildColumnHolder(), container);
- // Temporal Type widgets
- new TemporalTypeComposite(this, addPane(container, groupBoxMargin));
+ initializeConversionPane(container);
// Generation pane
new GenerationComposite(this, addSubPane(container, 10));
}
+
+
+ private void initializeConversionPane(Composite container) {
+
+ container = addCollapsableSection(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_conversion
+ );
+ ((GridLayout) container.getLayout()).numColumns = 2;
+
+ // No converter
+ Button noConverterButton = addRadioButton(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_noConverter,
+ buildNoConverterHolder(),
+ null);
+ ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2;
+
+ PropertyValueModel<Converter> specifiedConverterHolder = buildSpecifiedConverterHolder();
+ // Temporal
+ addRadioButton(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_temporalConverter,
+ buildTemporalBooleanHolder(),
+ null);
+ registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(specifiedConverterHolder), container, getWidgetFactory()));
+ }
+
+
+ private WritablePropertyValueModel<Boolean> buildNoConverterHolder() {
+ return new PropertyAspectAdapter<IdMapping, Boolean>(getSubjectHolder(), IdMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.getSpecifiedConverter() == null);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setSpecifiedConverter(Converter.NO_CONVERTER);
+ }
+ }
+ };
+ }
+
+
+ private WritablePropertyValueModel<Boolean> buildTemporalBooleanHolder() {
+ return new PropertyAspectAdapter<IdMapping, Boolean>(getSubjectHolder(), IdMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ Converter converter = this.subject.getSpecifiedConverter();
+ if (converter == null) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(converter.getType() == Converter.TEMPORAL_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ }
+ }
+ };
+ }
+
+ private PropertyValueModel<Converter> buildSpecifiedConverterHolder() {
+ return new PropertyAspectAdapter<IdMapping, Converter>(getSubjectHolder(), IdMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Converter buildValue_() {
+ return this.subject.getSpecifiedConverter();
+ }
+ };
+ }
+
+ private PropertyValueModel<TemporalConverter> buildTemporalConverterHolder(PropertyValueModel<Converter> converterHolder) {
+ return new TransformationPropertyValueModel<Converter, TemporalConverter>(converterHolder) {
+ @Override
+ protected TemporalConverter transform_(Converter converter) {
+ return (converter != null && converter.getType() == Converter.TEMPORAL_CONVERTER) ? (TemporalConverter) converter : null;
+ }
+ };
+ }
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobComposite.java
deleted file mode 100644
index 5d386be24c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobComposite.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 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.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.FormPane;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This composite simply shows the Lob check box.
- *
- * @see BasicMapping
- *
- * @version 2.0
- * @since 1.0
- */
-public class LobComposite extends FormPane<BasicMapping>
-{
- /**
- * Creates a new <code>LobComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public LobComposite(FormPane<? extends BasicMapping> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private PropertyAspectAdapter<BasicMapping, Boolean> buildLobHolder() {
-
- return new PropertyAspectAdapter<BasicMapping, Boolean>(getSubjectHolder(), BasicMapping.LOB_PROPERTY) {
-
- @Override
- protected Boolean buildValue_() {
- return subject.isLob();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- subject.setLob(value);
- }
- };
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- addCheckBox(
- container,
- JptUiMappingsMessages.BasicGeneralSection_lobLabel,
- buildLobHolder(),
- JpaHelpContextIds.MAPPING_LOB
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java
index 261e3524fb..89f3504ad6 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java
@@ -89,7 +89,7 @@ public class ManyToManyMappingComposite extends FormPane<ManyToManyMapping>
};
}
- private PropertyValueModel<JoinTable> buildJointTableHolder() {
+ private PropertyValueModel<JoinTable> buildJoinTableHolder() {
return new TransformationPropertyValueModel<ManyToManyMapping, JoinTable>(getSubjectHolder()) {
@Override
protected JoinTable transform_(ManyToManyMapping value) {
@@ -131,7 +131,7 @@ public class ManyToManyMappingComposite extends FormPane<ManyToManyMapping>
new JoinTableComposite(
this,
- buildJointTableHolder(),
+ buildJoinTableHolder(),
container
);
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java
index e11fc82065..71cc7d0b20 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java
@@ -12,20 +12,22 @@ import java.text.Collator;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import org.eclipse.jpt.core.context.ColumnMapping;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.util.ControlEnabler;
import org.eclipse.jpt.ui.internal.util.SWTUtil;
import org.eclipse.jpt.ui.internal.widgets.FormPane;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.StringConverter;
-import org.eclipse.jpt.utility.internal.model.value.ExtendedListValueModelWrapper;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.SimpleListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.utility.model.value.ListValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Composite;
/**
@@ -46,7 +48,7 @@ import org.eclipse.swt.widgets.Composite;
* @version 2.0
* @since 1.0
*/
-public class TemporalTypeComposite extends FormPane<ColumnMapping> {
+public class TemporalTypeComposite extends FormPane<TemporalConverter> {
/**
* Creates a new <code>TemporalTypeComposite</code>.
@@ -54,16 +56,50 @@ public class TemporalTypeComposite extends FormPane<ColumnMapping> {
* @param parentPane The parent container of this one
* @param parent The parent container
*/
- public TemporalTypeComposite(FormPane<? extends ColumnMapping> parentPane,
- Composite parent) {
+ public TemporalTypeComposite(PropertyValueModel<? extends TemporalConverter> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory) {
- super(parentPane, parent);
+ super(subjectHolder, parent, widgetFactory);
}
- private ListValueModel<TemporalType> buildSortedTemporalTypeListHolder() {
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ CCombo combo = addCCombo(
+ container,
+ buildTemporalTypeListHolder(),
+ buildTemporalTypeHolder(),
+ buildTemporalTypeConverter()
+ );
+
+ new ControlEnabler(buildBooleanHolder(), combo);
+ }
+
+ private WritablePropertyValueModel<TemporalType> buildTemporalTypeHolder() {
+ return new PropertyAspectAdapter<TemporalConverter, TemporalType>(getSubjectHolder(), TemporalConverter.TEMPORAL_TYPE_PROPERTY) {
+ @Override
+ protected TemporalType buildValue_() {
+ return subject.getTemporalType();
+ }
+
+ @Override
+ protected void setValue_(TemporalType value) {
+ subject.setTemporalType(value);
+ }
+ };
+ }
+
+ private ListValueModel<TemporalType> buildTemporalTypeListHolder() {
+ return new SimpleListValueModel<TemporalType>(
+ buildSortedTemporalTypeList()
+ );
+ }
+
+ private List<TemporalType> buildSortedTemporalTypeList() {
List<TemporalType> types = CollectionTools.list(TemporalType.values());
Collections.sort(types, buildTemporalTypeComparator());
- return new SimpleListValueModel<TemporalType>(types);
+ return types;
}
private Comparator<TemporalType> buildTemporalTypeComparator() {
@@ -80,34 +116,13 @@ public class TemporalTypeComposite extends FormPane<ColumnMapping> {
return new StringConverter<TemporalType>() {
public String convertToString(TemporalType value) {
if (value == null) {
- return JptUiMessages.EnumComboViewer_default;
+ return null;
}
return displayString(value);
}
};
}
- private WritablePropertyValueModel<TemporalType> buildTemporalTypeHolder() {
- return new PropertyAspectAdapter<ColumnMapping, TemporalType>(getSubjectHolder(), ColumnMapping.TEMPORAL_PROPERTY) {
- @Override
- protected TemporalType buildValue_() {
- return subject.getTemporal();
- }
-
- @Override
- protected void setValue_(TemporalType value) {
- subject.setTemporal(value);
- }
- };
- }
-
- private ListValueModel<TemporalType> buildTemporalTypeListHolder() {
- return new ExtendedListValueModelWrapper<TemporalType>(
- (TemporalType) null,
- buildSortedTemporalTypeListHolder()
- );
- }
-
private String displayString(TemporalType temporalType) {
return SWTUtil.buildDisplayString(
JptUiMappingsMessages.class,
@@ -115,20 +130,17 @@ public class TemporalTypeComposite extends FormPane<ColumnMapping> {
temporalType.name()
);
}
-
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- addLabeledCCombo(
- container,
- JptUiMappingsMessages.BasicGeneralSection_temporalLabel,
- buildTemporalTypeListHolder(),
- buildTemporalTypeHolder(),
- buildTemporalTypeConverter(),
- JpaHelpContextIds.MAPPING_TEMPORAL
- );
+
+ protected PropertyValueModel<Boolean> buildBooleanHolder() {
+ return new TransformationPropertyValueModel<TemporalConverter, Boolean>(getSubjectHolder()) {
+ @Override
+ protected Boolean transform(TemporalConverter value) {
+ if (getSubject() != null && getSubject().getParent().getPersistentAttribute().isVirtual()) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(value != null);
+ }
+ };
}
+
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java
index be3a77cb8e..5307d9c5d8 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java
@@ -10,12 +10,20 @@
package org.eclipse.jpt.ui.internal.mappings.details;
import org.eclipse.jpt.core.context.Column;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.VersionMapping;
import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
/**
@@ -68,21 +76,95 @@ public class VersionMappingComposite extends FormPane<VersionMapping>
};
}
- /*
- * (non-Javadoc)
- */
@Override
protected void initializeLayout(Composite container) {
- int groupBoxMargin = getGroupBoxMargin();
-
// Column widgets
new ColumnComposite(this, buildColumnHolder(), container);
- // Temporal Type widgets
- new TemporalTypeComposite(
- this,
- addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin)
+ initializeConversionPane(container);
+ }
+
+ private void initializeConversionPane(Composite container) {
+
+ container = addCollapsableSection(
+ container,
+ JptUiMappingsMessages.VersionMappingComposite_conversion
);
+ ((GridLayout) container.getLayout()).numColumns = 2;
+
+ // No converter
+ Button noConverterButton = addRadioButton(
+ container,
+ JptUiMappingsMessages.VersionMappingComposite_noConverter,
+ buildNoConverterHolder(),
+ null);
+ ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2;
+
+ PropertyValueModel<Converter> specifiedConverterHolder = buildSpecifiedConverterHolder();
+ // Temporal
+ addRadioButton(
+ container,
+ JptUiMappingsMessages.VersionMappingComposite_temporalConverter,
+ buildTemporalBooleanHolder(),
+ null);
+ registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(specifiedConverterHolder), container, getWidgetFactory()));
+ }
+
+
+ private WritablePropertyValueModel<Boolean> buildNoConverterHolder() {
+ return new PropertyAspectAdapter<VersionMapping, Boolean>(getSubjectHolder(), VersionMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.getSpecifiedConverter() == null);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setSpecifiedConverter(Converter.NO_CONVERTER);
+ }
+ }
+ };
+ }
+
+
+ private WritablePropertyValueModel<Boolean> buildTemporalBooleanHolder() {
+ return new PropertyAspectAdapter<VersionMapping, Boolean>(getSubjectHolder(), VersionMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ Converter converter = this.subject.getSpecifiedConverter();
+ if (converter == null) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(converter.getType() == Converter.TEMPORAL_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ }
+ }
+ };
+ }
+
+ private PropertyValueModel<Converter> buildSpecifiedConverterHolder() {
+ return new PropertyAspectAdapter<VersionMapping, Converter>(getSubjectHolder(), VersionMapping.SPECIFIED_CONVERTER_PROPERTY) {
+ @Override
+ protected Converter buildValue_() {
+ return this.subject.getSpecifiedConverter();
+ }
+ };
+ }
+
+ private PropertyValueModel<TemporalConverter> buildTemporalConverterHolder(PropertyValueModel<Converter> converterHolder) {
+ return new TransformationPropertyValueModel<Converter, TemporalConverter>(converterHolder) {
+ @Override
+ protected TemporalConverter transform_(Converter converter) {
+ return (converter != null && converter.getType() == Converter.TEMPORAL_CONVERTER) ? (TemporalConverter) converter : null;
+ }
+ };
}
+
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java
index 6b4d572e07..39cc6ee371 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java
@@ -195,9 +195,7 @@ abstract class EnumComboViewer<T extends Model, V> extends Pane<T>
String displayString = displayString(defaultValue);
return NLS.bind(JptUiMessages.EnumComboViewer_defaultWithDefault, displayString);
}
- else {
- return JptUiMessages.EnumComboViewer_default;
- }
+ return null; //I would rather display nothing than Default()
}
return displayString((V) value);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
index c6a09ffd45..01f2358ea8 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
@@ -16,9 +16,11 @@ import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.AccessType;
import org.eclipse.jpt.core.context.BasicMapping;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.core.context.EmbeddedMapping;
import org.eclipse.jpt.core.context.EnumType;
+import org.eclipse.jpt.core.context.EnumeratedConverter;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.IdMapping;
import org.eclipse.jpt.core.context.ManyToManyMapping;
@@ -26,6 +28,7 @@ import org.eclipse.jpt.core.context.ManyToOneMapping;
import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.core.context.OneToOneMapping;
import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.core.context.VersionMapping;
@@ -316,15 +319,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
attributeResource.setMappingAnnotation(null);
assertNotSame(basicMapping, persistentAttribute.getMapping());
@@ -346,23 +349,22 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.ENUMERATED_CONVERTER);
+ ((EnumeratedConverter) basicMapping.getSpecifiedConverter()).setSpecifiedEnumType(EnumType.STRING);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal());
- assertTrue(((BasicMapping) persistentAttribute.getMapping()).isLob());
- assertEquals(EnumType.ORDINAL, ((BasicMapping) persistentAttribute.getMapping()).getEnumerated());
+ assertEquals(EnumType.STRING, ((EnumeratedConverter) ((BasicMapping) persistentAttribute.getMapping()).getSpecifiedConverter()).getEnumType());
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
@@ -378,21 +380,22 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((IdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((IdMapping) persistentAttribute.getMapping()).getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ((IdMapping) persistentAttribute.getMapping()).getSpecifiedConverter()).getTemporalType());
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME));
assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
@@ -407,19 +410,20 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((VersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((VersionMapping) persistentAttribute.getMapping()).getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ((VersionMapping) persistentAttribute.getMapping()).getSpecifiedConverter()).getTemporalType());
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME));
assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
@@ -434,18 +438,18 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
@@ -460,18 +464,18 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
@@ -486,18 +490,18 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME));
assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
@@ -512,11 +516,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -524,8 +530,6 @@ public class JavaBasicMappingTests extends ContextModelTestCase
persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
//TODO assertEquals(FetchType.EAGER, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
// assertEquals(Boolean.FALSE, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
@@ -542,11 +546,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -554,8 +560,6 @@ public class JavaBasicMappingTests extends ContextModelTestCase
persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
//TODO assertEquals(FetchType.EAGER, ((IOneToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
// assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
@@ -570,11 +574,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -582,8 +588,6 @@ public class JavaBasicMappingTests extends ContextModelTestCase
persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
//TODO assertEquals(FetchType.EAGER, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
// assertEquals(Boolean.FALSE, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
@@ -600,11 +604,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setLob(true);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -612,8 +618,6 @@ public class JavaBasicMappingTests extends ContextModelTestCase
persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
- JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
//TODO assertEquals(FetchType.EAGER, ((IManyToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
// assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME));
@@ -768,7 +772,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertFalse(basicMapping.isLob());
+ assertFalse(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
}
public void testIsLob2() throws Exception {
@@ -778,7 +782,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertTrue(basicMapping.isLob());
+ assertTrue(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
}
public void testSetLob() throws Exception {
@@ -788,13 +792,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- basicMapping.setLob(true);
+ basicMapping.setSpecifiedConverter(Converter.LOB_CONVERTER);
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
assertNotNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- basicMapping.setLob(false);
+ basicMapping.setSpecifiedConverter(null);
assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
}
@@ -805,35 +809,35 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertFalse(basicMapping.isLob());
+ assertFalse(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- assertTrue(basicMapping.isLob());
+ assertTrue(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
attributeResource.removeAnnotation(LobAnnotation.ANNOTATION_NAME);
- assertFalse(basicMapping.isLob());
+ assertFalse(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER);
}
- public void testDefaultBasicGetDefaultEnumerated() throws Exception {
+ public void testDefaultBasicGetDefaultConverter() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertEquals(EnumType.ORDINAL, basicMapping.getDefaultEnumerated());
+ assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
}
- public void testSpecifiedBasicGetDefaultEnumerated() throws Exception {
+ public void testSpecifiedBasicGetDefaultConverter() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(EnumType.ORDINAL, basicMapping.getDefaultEnumerated());
+ assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
}
public void testGetEnumerated() throws Exception {
@@ -843,30 +847,25 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(EnumType.ORDINAL, basicMapping.getEnumerated());
-
- basicMapping.setSpecifiedEnumerated(EnumType.STRING);
- assertEquals(EnumType.STRING, basicMapping.getEnumerated());
- }
+ assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
- public void testGetSpecifiedEnumerated() throws Exception {
- createTestEntityWithBasicMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
+ EnumeratedAnnotation enumeratedAnnotation = (EnumeratedAnnotation) attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ assertEquals(EnumType.ORDINAL, ((EnumeratedConverter) basicMapping.getConverter()).getDefaultEnumType());
- PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
- BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(basicMapping.getSpecifiedEnumerated());
+ enumeratedAnnotation.setValue(org.eclipse.jpt.core.resource.java.EnumType.STRING);
+ assertEquals(EnumType.STRING, ((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
}
- public void testGetSpecifiedEnumerated2() throws Exception {
+ public void testGetSpecifiedEnumerated() throws Exception {
createTestEntityWithEnumerated();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertEquals(EnumType.STRING, basicMapping.getSpecifiedEnumerated());
+ assertEquals(EnumType.STRING, ((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
}
public void testSetSpecifiedEnumerated() throws Exception {
@@ -875,28 +874,36 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(basicMapping.getSpecifiedEnumerated());
+ assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
- basicMapping.setSpecifiedEnumerated(EnumType.STRING);
+ basicMapping.setSpecifiedConverter(Converter.ENUMERATED_CONVERTER);
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ assertNotNull(enumerated);
+ assertEquals(null, enumerated.getValue());
+
+ ((EnumeratedConverter) basicMapping.getConverter()).setSpecifiedEnumType(EnumType.STRING);
assertEquals(org.eclipse.jpt.core.resource.java.EnumType.STRING, enumerated.getValue());
- basicMapping.setSpecifiedEnumerated(null);
+ ((EnumeratedConverter) basicMapping.getConverter()).setSpecifiedEnumType(null);
+ assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(enumerated.getValue());
+
+ basicMapping.setSpecifiedConverter(Converter.NO_CONVERTER);
assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
- public void testGetSpecifieEnumeratedUpdatesFromResourceModelChange() throws Exception {
+ public void testGetSpecifiedEnumeratedUpdatesFromResourceModelChange() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(basicMapping.getSpecifiedEnumerated());
+ assertTrue(basicMapping.getConverter().getType() == Converter.NO_CONVERTER);
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
@@ -904,24 +911,27 @@ public class JavaBasicMappingTests extends ContextModelTestCase
EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
enumerated.setValue(org.eclipse.jpt.core.resource.java.EnumType.STRING);
- assertEquals(EnumType.STRING, basicMapping.getSpecifiedEnumerated());
+ assertEquals(EnumType.STRING, ((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
enumerated.setValue(null);
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
- assertNull(basicMapping.getSpecifiedEnumerated());
+ assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
assertFalse(basicMapping.isDefault());
assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
}
-
public void testGetTemporal() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
+ attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(basicMapping.getTemporal());
+ assertEquals(Converter.TEMPORAL_CONVERTER, basicMapping.getConverter().getType());
}
public void testGetTemporal2() throws Exception {
@@ -931,7 +941,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- assertEquals(TemporalType.TIMESTAMP, basicMapping.getTemporal());
+ assertEquals(Converter.TEMPORAL_CONVERTER, basicMapping.getConverter().getType());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) basicMapping.getConverter()).getTemporalType());
}
public void testSetTemporal() throws Exception {
@@ -940,9 +951,10 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(basicMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
- basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -950,7 +962,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
- basicMapping.setTemporal(null);
+ basicMapping.setSpecifiedConverter(null);
assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
}
@@ -961,7 +973,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(basicMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
@@ -969,11 +981,12 @@ public class JavaBasicMappingTests extends ContextModelTestCase
TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE);
- assertEquals(TemporalType.DATE, basicMapping.getTemporal());
+ assertEquals(Converter.TEMPORAL_CONVERTER, basicMapping.getConverter().getType());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) basicMapping.getConverter()).getTemporalType());
attributeResource.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- assertNull(basicMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType());
assertFalse(basicMapping.isDefault());
assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java
index 66f07ed125..19d2dcd9d8 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java
@@ -13,6 +13,7 @@ import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.core.context.EmbeddedMapping;
import org.eclipse.jpt.core.context.IdMapping;
@@ -21,6 +22,7 @@ import org.eclipse.jpt.core.context.ManyToOneMapping;
import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.core.context.OneToOneMapping;
import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.core.context.VersionMapping;
@@ -142,7 +144,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -150,7 +153,7 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ((BasicMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -171,7 +174,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -179,7 +183,7 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ((BasicMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -199,7 +203,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -207,7 +212,7 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((VersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((VersionMapping) persistentAttribute.getMapping()).getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ((VersionMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -228,7 +233,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -256,7 +262,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -284,7 +291,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -312,7 +320,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -340,7 +349,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -368,7 +378,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -396,7 +407,8 @@ public class JavaIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
idMapping.addGeneratedValue();
idMapping.addTableGenerator();
idMapping.addSequenceGenerator();
@@ -415,25 +427,15 @@ public class JavaIdMappingTests extends ContextModelTestCase
assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
-
- public void testGetTemporal() throws Exception {
- createTestEntityWithIdMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
- IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(idMapping.getTemporal());
- }
- public void testGetTemporal2() throws Exception {
+ public void testGetTemporal() throws Exception {
createTestEntityWithTemporal();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(TemporalType.TIMESTAMP, idMapping.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) idMapping.getConverter()).getTemporalType());
}
public void testSetTemporal() throws Exception {
@@ -442,9 +444,10 @@ public class JavaIdMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(idMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getConverter()).setTemporalType(TemporalType.TIME);
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -452,7 +455,7 @@ public class JavaIdMappingTests extends ContextModelTestCase
assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
- idMapping.setTemporal(null);
+ idMapping.setSpecifiedConverter(null);
assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
}
@@ -463,7 +466,7 @@ public class JavaIdMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(idMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
@@ -471,11 +474,11 @@ public class JavaIdMappingTests extends ContextModelTestCase
TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE);
- assertEquals(TemporalType.DATE, idMapping.getTemporal());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) idMapping.getConverter()).getTemporalType());
attributeResource.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- assertNull(idMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType());
assertFalse(idMapping.isDefault());
assertSame(idMapping, persistentAttribute.getSpecifiedMapping());
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java
index 4debeb7fa9..a68ac137c5 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java
@@ -13,6 +13,7 @@ import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.core.context.EmbeddedMapping;
import org.eclipse.jpt.core.context.IdMapping;
@@ -21,6 +22,7 @@ import org.eclipse.jpt.core.context.ManyToOneMapping;
import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.core.context.OneToOneMapping;
import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.core.context.VersionMapping;
@@ -111,12 +113,13 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ((BasicMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -134,12 +137,13 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ((BasicMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -156,12 +160,13 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((IdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
- assertEquals(TemporalType.TIME, ((IdMapping) persistentAttribute.getMapping()).getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ((IdMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -179,7 +184,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
@@ -201,7 +207,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
@@ -223,7 +230,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
@@ -245,7 +253,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
@@ -267,7 +276,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
@@ -289,7 +299,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
@@ -311,7 +322,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
@@ -325,24 +337,15 @@ public class JavaVersionMappingTests extends ContextModelTestCase
assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
}
- public void testGetTemporal() throws Exception {
- createTestEntityWithVersionMapping();
- addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
-
- PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
- VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
-
- assertNull(versionMapping.getTemporal());
- }
- public void testGetTemporal2() throws Exception {
+ public void testGetTemporal() throws Exception {
createTestEntityWithTemporal();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
- assertEquals(TemporalType.TIMESTAMP, versionMapping.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) versionMapping.getConverter()).getTemporalType());
}
public void testSetTemporal() throws Exception {
@@ -351,9 +354,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(versionMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getConverter()).setTemporalType(TemporalType.TIME);
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next();
@@ -361,7 +365,7 @@ public class JavaVersionMappingTests extends ContextModelTestCase
assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue());
- versionMapping.setTemporal(null);
+ versionMapping.setSpecifiedConverter(null);
assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
}
@@ -372,7 +376,7 @@ public class JavaVersionMappingTests extends ContextModelTestCase
PersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping();
- assertNull(versionMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
JavaResourcePersistentType typeResource = jpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
@@ -380,11 +384,11 @@ public class JavaVersionMappingTests extends ContextModelTestCase
TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE);
- assertEquals(TemporalType.DATE, versionMapping.getTemporal());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) versionMapping.getConverter()).getTemporalType());
attributeResource.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- assertNull(versionMapping.getTemporal());
+ assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType());
assertFalse(versionMapping.isDefault());
assertSame(versionMapping, persistentAttribute.getSpecifiedMapping());
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
index 5869f60a59..86abc798a8 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
@@ -14,15 +14,18 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.core.context.EmbeddedMapping;
import org.eclipse.jpt.core.context.EnumType;
+import org.eclipse.jpt.core.context.EnumeratedConverter;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.IdMapping;
import org.eclipse.jpt.core.context.ManyToManyMapping;
import org.eclipse.jpt.core.context.ManyToOneMapping;
import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.core.context.OneToOneMapping;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.core.context.VersionMapping;
@@ -212,21 +215,21 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
- assertNull(ormBasicMapping.getSpecifiedEnumerated());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertNull(basicResource.getEnumerated());
//set enumerated in the resource model, verify context model updated
basicResource.setEnumerated(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL);
- assertEquals(EnumType.ORDINAL, ormBasicMapping.getSpecifiedEnumerated());
+ assertEquals(EnumType.ORDINAL, ((EnumeratedConverter) ormBasicMapping.getConverter()).getSpecifiedEnumType());
assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated());
basicResource.setEnumerated(org.eclipse.jpt.core.resource.orm.EnumType.STRING);
- assertEquals(EnumType.STRING, ormBasicMapping.getSpecifiedEnumerated());
+ assertEquals(EnumType.STRING, ((EnumeratedConverter) ormBasicMapping.getConverter()).getSpecifiedEnumType());
assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.STRING, basicResource.getEnumerated());
//set enumerated to null in the resource model
basicResource.setEnumerated(null);
- assertNull(ormBasicMapping.getSpecifiedEnumerated());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertNull(basicResource.getEnumerated());
}
@@ -236,22 +239,23 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
- assertNull(ormBasicMapping.getSpecifiedEnumerated());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertNull(basicResource.getEnumerated());
//set enumerated in the context model, verify resource model updated
- ormBasicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ ormBasicMapping.setSpecifiedConverter(Converter.ENUMERATED_CONVERTER);
+ ((EnumeratedConverter) ormBasicMapping.getConverter()).setSpecifiedEnumType(EnumType.ORDINAL);
assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated());
- assertEquals(EnumType.ORDINAL, ormBasicMapping.getSpecifiedEnumerated());
+ assertEquals(EnumType.ORDINAL, ((EnumeratedConverter) ormBasicMapping.getConverter()).getSpecifiedEnumType());
- ormBasicMapping.setSpecifiedEnumerated(EnumType.STRING);
+ ((EnumeratedConverter) ormBasicMapping.getConverter()).setSpecifiedEnumType(EnumType.STRING);
assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.STRING, basicResource.getEnumerated());
- assertEquals(EnumType.STRING, ormBasicMapping.getSpecifiedEnumerated());
+ assertEquals(EnumType.STRING, ((EnumeratedConverter) ormBasicMapping.getConverter()).getSpecifiedEnumType());
//set enumerated to null in the context model
- ormBasicMapping.setSpecifiedEnumerated(null);
+ ormBasicMapping.setSpecifiedConverter(null);
assertNull(basicResource.getEnumerated());
- assertNull(ormBasicMapping.getSpecifiedEnumerated());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
}
public void testUpdateSpecifiedOptional() throws Exception {
@@ -308,17 +312,17 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
- assertFalse(ormBasicMapping.isLob());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertFalse(basicResource.isLob());
//set lob in the resource model, verify context model updated
basicResource.setLob(true);
- assertTrue(ormBasicMapping.isLob());
+ assertEquals(Converter.LOB_CONVERTER, ormBasicMapping.getConverter().getType());
assertTrue(basicResource.isLob());
//set lob to null in the resource model
basicResource.setLob(false);
- assertFalse(ormBasicMapping.isLob());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertFalse(basicResource.isLob());
}
@@ -328,18 +332,18 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
- assertFalse(ormBasicMapping.isLob());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertFalse(basicResource.isLob());
//set lob in the context model, verify resource model updated
- ormBasicMapping.setLob(true);
+ ormBasicMapping.setSpecifiedConverter(Converter.LOB_CONVERTER);
assertTrue(basicResource.isLob());
- assertTrue(ormBasicMapping.isLob());
+ assertEquals(Converter.LOB_CONVERTER, ormBasicMapping.getConverter().getType());
//set lob to false in the context model
- ormBasicMapping.setLob(false);
+ ormBasicMapping.setSpecifiedConverter(null);
assertFalse(basicResource.isLob());
- assertFalse(ormBasicMapping.isLob());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
}
public void testUpdateTemporal() throws Exception {
@@ -348,25 +352,25 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
- assertNull(ormBasicMapping.getTemporal());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertNull(basicResource.getTemporal());
//set temporal in the resource model, verify context model updated
basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE);
- assertEquals(TemporalType.DATE, ormBasicMapping.getTemporal());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) ormBasicMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, basicResource.getTemporal());
basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME);
- assertEquals(TemporalType.TIME, ormBasicMapping.getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ormBasicMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, basicResource.getTemporal());
basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP);
- assertEquals(TemporalType.TIMESTAMP, ormBasicMapping.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormBasicMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal());
//set temporal to null in the resource model
basicResource.setTemporal(null);
- assertNull(ormBasicMapping.getTemporal());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertNull(basicResource.getTemporal());
}
@@ -376,26 +380,27 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
- assertNull(ormBasicMapping.getTemporal());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertNull(basicResource.getTemporal());
//set temporal in the context model, verify resource model updated
- ormBasicMapping.setTemporal(TemporalType.DATE);
+ ormBasicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.DATE);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, basicResource.getTemporal());
- assertEquals(TemporalType.DATE, ormBasicMapping.getTemporal());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).getTemporalType());
- ormBasicMapping.setTemporal(TemporalType.TIME);
+ ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, basicResource.getTemporal());
- assertEquals(TemporalType.TIME, ormBasicMapping.getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).getTemporalType());
- ormBasicMapping.setTemporal(TemporalType.TIMESTAMP);
+ ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIMESTAMP);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal());
- assertEquals(TemporalType.TIMESTAMP, ormBasicMapping.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormBasicMapping.getSpecifiedConverter()).getTemporalType());
//set temporal to null in the context model
- ormBasicMapping.setTemporal(null);
+ ormBasicMapping.setSpecifiedConverter(null);
assertNull(basicResource.getTemporal());
- assertNull(ormBasicMapping.getTemporal());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
}
//TODO test defaults
@@ -413,14 +418,11 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
assertEquals("foo", ormBasicMapping.getName());
- assertNull(ormBasicMapping.getSpecifiedEnumerated());
+ assertNull(ormBasicMapping.getSpecifiedConverter());
assertNull(ormBasicMapping.getSpecifiedFetch());
assertNull(ormBasicMapping.getSpecifiedOptional());
- assertFalse(ormBasicMapping.isLob());
- assertEquals(EnumType.ORDINAL, ormBasicMapping.getEnumerated());
assertEquals(FetchType.EAGER, ormBasicMapping.getFetch());
assertEquals(Boolean.TRUE, ormBasicMapping.getOptional());
- assertNull(ormBasicMapping.getTemporal());
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -462,11 +464,10 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormBasicMapping.getName());
- assertTrue(ormBasicMapping.isLob());
- assertEquals(EnumType.STRING, ormBasicMapping.getSpecifiedEnumerated());
+ assertEquals(Converter.ENUMERATED_CONVERTER, ormBasicMapping.getConverter().getType());
+ assertEquals(EnumType.STRING, ((EnumeratedConverter) ormBasicMapping.getConverter()).getEnumType());
assertEquals(FetchType.LAZY, ormBasicMapping.getSpecifiedFetch());
assertEquals(Boolean.FALSE, ormBasicMapping.getSpecifiedOptional());
- assertEquals(TemporalType.TIMESTAMP, ormBasicMapping.getTemporal());
OrmColumn ormColumn = ormBasicMapping.getColumn();
assertEquals("MY_COLUMN", ormColumn.getSpecifiedName());
@@ -490,11 +491,9 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormBasicMapping.getName());
- assertFalse(ormBasicMapping.isLob());
- assertEquals(EnumType.ORDINAL, ormBasicMapping.getSpecifiedEnumerated());
+ assertEquals(Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
assertEquals(FetchType.EAGER, ormBasicMapping.getSpecifiedFetch());
assertEquals(Boolean.TRUE, ormBasicMapping.getSpecifiedOptional());
- assertNull(ormBasicMapping.getTemporal());
OrmColumn ormColumn = ormBasicMapping.getColumn();
assertEquals("id", ormColumn.getSpecifiedName());
@@ -520,14 +519,11 @@ public class OrmBasicMappingTests extends ContextModelTestCase
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormBasicMapping.getName());
- assertNull(ormBasicMapping.getSpecifiedEnumerated());
+ assertEquals(Converter.NO_CONVERTER, ormBasicMapping.getConverter().getType());
assertNull(ormBasicMapping.getSpecifiedFetch());
assertNull(ormBasicMapping.getSpecifiedOptional());
- assertFalse(ormBasicMapping.isLob());
- assertEquals(EnumType.ORDINAL, ormBasicMapping.getDefaultEnumerated());
assertEquals(FetchType.EAGER, ormBasicMapping.getDefaultFetch());
assertEquals(Boolean.TRUE, ormBasicMapping.getDefaultOptional());
- assertNull(ormBasicMapping.getTemporal());
OrmColumn ormColumn = ormBasicMapping.getColumn();
assertNull(ormColumn.getSpecifiedName());
@@ -567,9 +563,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -579,7 +574,6 @@ public class OrmBasicMappingTests extends ContextModelTestCase
assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- assertEquals(TemporalType.TIME, ((IdMapping) ormPersistentAttribute.getMapping()).getTemporal());
assertEquals("FOO", ((IdMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
}
@@ -591,9 +585,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -603,7 +596,6 @@ public class OrmBasicMappingTests extends ContextModelTestCase
assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
assertEquals("basic", ormPersistentAttribute.getMapping().getName());
- assertEquals(TemporalType.TIME, ((VersionMapping) ormPersistentAttribute.getMapping()).getTemporal());
assertEquals("FOO", ((VersionMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
}
@@ -615,9 +607,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -637,9 +628,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -659,9 +649,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -681,9 +670,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -703,9 +691,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -725,9 +712,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -747,9 +733,8 @@ public class OrmBasicMappingTests extends ContextModelTestCase
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- basicMapping.setLob(true);
- basicMapping.setTemporal(TemporalType.TIME);
- basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
index 8199e6f116..2b27cec7c6 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
@@ -14,6 +14,7 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.core.context.EmbeddedMapping;
import org.eclipse.jpt.core.context.GenerationType;
@@ -22,6 +23,7 @@ import org.eclipse.jpt.core.context.ManyToManyMapping;
import org.eclipse.jpt.core.context.ManyToOneMapping;
import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.core.context.OneToOneMapping;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.core.context.VersionMapping;
@@ -193,25 +195,25 @@ public class OrmIdMappingTests extends ContextModelTestCase
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
- assertNull(ormIdMapping.getTemporal());
+ assertNull(ormIdMapping.getSpecifiedConverter());
assertNull(idResource.getTemporal());
//set temporal in the resource model, verify context model updated
idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE);
- assertEquals(TemporalType.DATE, ormIdMapping.getTemporal());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) ormIdMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, idResource.getTemporal());
idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME);
- assertEquals(TemporalType.TIME, ormIdMapping.getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ormIdMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, idResource.getTemporal());
idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP);
- assertEquals(TemporalType.TIMESTAMP, ormIdMapping.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormIdMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal());
//set temporal to null in the resource model
idResource.setTemporal(null);
- assertNull(ormIdMapping.getTemporal());
+ assertNull(ormIdMapping.getSpecifiedConverter());
assertNull(idResource.getTemporal());
}
@@ -221,26 +223,27 @@ public class OrmIdMappingTests extends ContextModelTestCase
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
- assertNull(ormIdMapping.getTemporal());
+ assertNull(ormIdMapping.getSpecifiedConverter());
assertNull(idResource.getTemporal());
//set temporal in the context model, verify resource model updated
- ormIdMapping.setTemporal(TemporalType.DATE);
+ ormIdMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).setTemporalType(TemporalType.DATE);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, idResource.getTemporal());
- assertEquals(TemporalType.DATE, ormIdMapping.getTemporal());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).getTemporalType());
- ormIdMapping.setTemporal(TemporalType.TIME);
+ ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, idResource.getTemporal());
- assertEquals(TemporalType.TIME, ormIdMapping.getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).getTemporalType());
- ormIdMapping.setTemporal(TemporalType.TIMESTAMP);
+ ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIMESTAMP);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal());
- assertEquals(TemporalType.TIMESTAMP, ormIdMapping.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormIdMapping.getSpecifiedConverter()).getTemporalType());
//set temporal to null in the context model
- ormIdMapping.setTemporal(null);
+ ormIdMapping.setSpecifiedConverter(null);
assertNull(idResource.getTemporal());
- assertNull(ormIdMapping.getTemporal());
+ assertNull(ormIdMapping.getSpecifiedConverter());
}
//TODO test defaults
@@ -476,7 +479,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
assertEquals("foo", ormIdMapping.getName());
- assertNull(ormIdMapping.getTemporal());
+ assertNull(ormIdMapping.getSpecifiedConverter());
assertNull(ormIdMapping.getGeneratedValue());
assertNull(ormIdMapping.getSequenceGenerator());
assertNull(ormIdMapping.getTableGenerator());
@@ -521,7 +524,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormIdMapping.getName());
- assertEquals(TemporalType.TIMESTAMP, ormIdMapping.getTemporal());
+ assertEquals(Converter.TEMPORAL_CONVERTER, ormIdMapping.getConverter().getType());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormIdMapping.getConverter()).getTemporalType());
OrmColumn ormColumn = ormIdMapping.getColumn();
assertEquals("MY_COLUMN", ormColumn.getSpecifiedName());
@@ -568,7 +572,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormIdMapping.getName());
- assertNull(ormIdMapping.getTemporal());
+ assertNull(ormIdMapping.getSpecifiedConverter());
assertNull(ormIdMapping.getGeneratedValue());
assertNull(ormIdMapping.getSequenceGenerator());
assertNull(ormIdMapping.getTableGenerator());
@@ -597,7 +601,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormIdMapping.getName());
- assertNull(ormIdMapping.getTemporal());
+ assertNull(ormIdMapping.getSpecifiedConverter());
assertNull(ormIdMapping.getGeneratedValue());
assertNull(ormIdMapping.getSequenceGenerator());
assertNull(ormIdMapping.getTableGenerator());
@@ -639,7 +643,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
@@ -647,7 +652,6 @@ public class OrmIdMappingTests extends ContextModelTestCase
assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
assertEquals("id", ormPersistentAttribute.getMapping().getName());
- assertEquals(TemporalType.TIME, ((BasicMapping) ormPersistentAttribute.getMapping()).getTemporal());
assertEquals("FOO", ((BasicMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
}
@@ -659,7 +663,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
@@ -667,7 +672,6 @@ public class OrmIdMappingTests extends ContextModelTestCase
assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
assertTrue(ormPersistentAttribute.getMapping() instanceof VersionMapping);
assertEquals("id", ormPersistentAttribute.getMapping().getName());
- assertEquals(TemporalType.TIME, ((VersionMapping) ormPersistentAttribute.getMapping()).getTemporal());
assertEquals("FOO", ((VersionMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
}
@@ -679,7 +683,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
@@ -695,7 +700,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
@@ -713,7 +719,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
@@ -729,7 +736,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
@@ -747,7 +755,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
@@ -765,7 +774,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
@@ -783,7 +793,8 @@ public class OrmIdMappingTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
- idMapping.setTemporal(TemporalType.TIME);
+ idMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) idMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(idMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
index a053b9f8a0..30aa4d7c13 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
@@ -14,6 +14,7 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.core.context.EmbeddedMapping;
import org.eclipse.jpt.core.context.IdMapping;
@@ -21,6 +22,7 @@ import org.eclipse.jpt.core.context.ManyToManyMapping;
import org.eclipse.jpt.core.context.ManyToOneMapping;
import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.core.context.OneToOneMapping;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.context.TemporalType;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.core.context.VersionMapping;
@@ -148,25 +150,25 @@ public class OrmVersionMappingTests extends ContextModelTestCase
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
XmlVersion versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
- assertNull(ormVersionMapping.getTemporal());
+ assertNull(ormVersionMapping.getSpecifiedConverter());
assertNull(versionResource.getTemporal());
//set temporal in the resource model, verify context model updated
versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE);
- assertEquals(TemporalType.DATE, ormVersionMapping.getTemporal());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) ormVersionMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, versionResource.getTemporal());
versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME);
- assertEquals(TemporalType.TIME, ormVersionMapping.getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ormVersionMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, versionResource.getTemporal());
versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP);
- assertEquals(TemporalType.TIMESTAMP, ormVersionMapping.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormVersionMapping.getConverter()).getTemporalType());
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal());
//set temporal to null in the resource model
versionResource.setTemporal(null);
- assertNull(ormVersionMapping.getTemporal());
+ assertNull(ormVersionMapping.getSpecifiedConverter());
assertNull(versionResource.getTemporal());
}
@@ -176,26 +178,27 @@ public class OrmVersionMappingTests extends ContextModelTestCase
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
XmlVersion versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
- assertNull(ormVersionMapping.getTemporal());
+ assertNull(ormVersionMapping.getSpecifiedConverter());
assertNull(versionResource.getTemporal());
//set temporal in the context model, verify resource model updated
- ormVersionMapping.setTemporal(TemporalType.DATE);
+ ormVersionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.DATE);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, versionResource.getTemporal());
- assertEquals(TemporalType.DATE, ormVersionMapping.getTemporal());
+ assertEquals(TemporalType.DATE, ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).getTemporalType());
- ormVersionMapping.setTemporal(TemporalType.TIME);
+ ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, versionResource.getTemporal());
- assertEquals(TemporalType.TIME, ormVersionMapping.getTemporal());
+ assertEquals(TemporalType.TIME, ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).getTemporalType());
- ormVersionMapping.setTemporal(TemporalType.TIMESTAMP);
+ ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIMESTAMP);
assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal());
- assertEquals(TemporalType.TIMESTAMP, ormVersionMapping.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormVersionMapping.getSpecifiedConverter()).getTemporalType());
//set temporal to null in the context model
- ormVersionMapping.setTemporal(null);
+ ormVersionMapping.setSpecifiedConverter(null);
assertNull(versionResource.getTemporal());
- assertNull(ormVersionMapping.getTemporal());
+ assertNull(ormVersionMapping.getSpecifiedConverter());
}
//TODO test defaults
@@ -212,7 +215,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
assertEquals("foo", ormVersionMapping.getName());
- assertNull(ormVersionMapping.getTemporal());
+ assertNull(ormVersionMapping.getSpecifiedConverter());
OrmColumn ormColumn = ormVersionMapping.getColumn();
@@ -254,7 +257,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormVersionMapping.getName());
- assertEquals(TemporalType.TIMESTAMP, ormVersionMapping.getTemporal());
+ assertEquals(Converter.TEMPORAL_CONVERTER, ormVersionMapping.getConverter().getType());
+ assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) ormVersionMapping.getConverter()).getTemporalType());
OrmColumn ormColumn = ormVersionMapping.getColumn();
assertEquals("MY_COLUMN", ormColumn.getSpecifiedName());
@@ -283,7 +287,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormVersionMapping.getName());
- assertNull(ormVersionMapping.getTemporal());
+ assertNull(ormVersionMapping.getSpecifiedConverter());
OrmColumn ormColumn = ormVersionMapping.getColumn();
assertEquals("id", ormColumn.getName());
@@ -309,7 +313,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
assertEquals("id", ormVersionMapping.getName());
- assertNull(ormVersionMapping.getTemporal());
+ assertNull(ormVersionMapping.getSpecifiedConverter());
OrmColumn ormColumn = ormVersionMapping.getColumn();
assertNull(ormColumn.getSpecifiedName());
@@ -343,7 +347,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
@@ -351,7 +356,6 @@ public class OrmVersionMappingTests extends ContextModelTestCase
assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
assertTrue(ormPersistentAttribute.getMapping() instanceof IdMapping);
assertEquals("version", ormPersistentAttribute.getMapping().getName());
- assertEquals(TemporalType.TIME, ((IdMapping) ormPersistentAttribute.getMapping()).getTemporal());
assertEquals("FOO", ((IdMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
}
@@ -363,7 +367,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
@@ -371,7 +376,6 @@ public class OrmVersionMappingTests extends ContextModelTestCase
assertEquals(ormPersistentAttribute, ormPersistentType.specifiedAttributes().next());
assertTrue(ormPersistentAttribute.getMapping() instanceof BasicMapping);
assertEquals("version", ormPersistentAttribute.getMapping().getName());
- assertEquals(TemporalType.TIME, ((BasicMapping) ormPersistentAttribute.getMapping()).getTemporal());
assertEquals("FOO", ((BasicMapping) ormPersistentAttribute.getMapping()).getColumn().getSpecifiedName());
}
@@ -383,7 +387,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
@@ -401,7 +406,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
@@ -419,7 +425,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
@@ -437,7 +444,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
@@ -455,7 +463,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
@@ -473,7 +482,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
@@ -491,7 +501,8 @@ public class OrmVersionMappingTests extends ContextModelTestCase
VersionMapping versionMapping = (VersionMapping) ormPersistentAttribute.getMapping();
assertFalse(versionMapping.isDefault());
versionMapping.getColumn().setSpecifiedName("FOO");
- versionMapping.setTemporal(TemporalType.TIME);
+ versionMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
+ ((TemporalConverter) versionMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME);
assertFalse(versionMapping.isDefault());
ormPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java
index cd7dd1ef49..6c477083c9 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java
@@ -85,7 +85,8 @@ public class EnumeratedTests extends JavaResourceModelTestCase {
enumerated.setValue(null);
- assertSourceDoesNotContain("@Enumerated", cu);
+ assertSourceDoesNotContain("@Enumerated(", cu);
+ assertSourceContains("@Enumerated", cu);
}
}

Back to the top