summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNan Li2012-09-18 12:37:19 (EDT)
committerKaren Butzke2012-09-18 12:37:19 (EDT)
commitf01bfd98943d26f4cd785cfb8a9a24337980a649 (patch)
treecbb940da0a6c5ead41dacb60586cee77336a655c
parent387e840daab9cab568e723283ceda994db8c9b58 (diff)
downloadwebtools.dali-f01bfd98943d26f4cd785cfb8a9a24337980a649.zip
webtools.dali-f01bfd98943d26f4cd785cfb8a9a24337980a649.tar.gz
webtools.dali-f01bfd98943d26f4cd785cfb8a9a24337980a649.tar.bz2
Bug 335447 - UI is out of sync once switching from Temporal to Converted
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBaseEnumeratedConverter.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmElementCollectionMappingTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java2
12 files changed, 93 insertions, 96 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java
index 435c601..f6190b5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java
@@ -55,6 +55,7 @@ public abstract class AbstractOrmBasicMapping<X extends XmlBasic>
protected OrmConverter converter; // never null
+ protected final OrmConverter nullConverter = new NullOrmConverter(this);
protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
OrmBaseEnumeratedConverter.BasicAdapter.instance(),
@@ -193,19 +194,26 @@ public abstract class AbstractOrmBasicMapping<X extends XmlBasic>
public void setConverter(Class<? extends Converter> converterType) {
if (this.converter.getType() != converterType) {
+ // Make the old value is the real old one when firing property changed event below
+ OrmConverter old = this.converter;
+ // Set the new value of the converter to a NullOrmConverter to prevent the following
+ // step from synchronizing through a separate thread when setting converters to null
+ // Through this way timing issue between different thread may be eliminated.
+ this.converter = this.nullConverter;
// note: we may also clear the XML value we want;
// but if we leave it, the resulting sync will screw things up...
this.clearXmlConverterValues();
OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
- this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter = this.buildConverter(converterAdapter);
this.converter.initialize();
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, this.converter);
}
}
protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
return (converterAdapter != null) ?
converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullConverter();
+ this.nullConverter;
}
protected void setConverter_(OrmConverter converter) {
@@ -228,14 +236,14 @@ public abstract class AbstractOrmBasicMapping<X extends XmlBasic>
return ormConverter;
}
}
- return this.buildNullConverter();
+ return this.nullConverter;
}
protected void syncConverter() {
OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
if (adapter == null) {
if (this.converter.getType() != null) {
- this.setConverter_(this.buildNullConverter());
+ this.setConverter_(this.nullConverter);
}
} else {
if (this.converter.getType() == adapter.getConverterType()) {
@@ -259,10 +267,6 @@ public abstract class AbstractOrmBasicMapping<X extends XmlBasic>
return null;
}
- protected OrmConverter buildNullConverter() {
- return new NullOrmConverter(this);
- }
-
// ********** converter adapters **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java
index 9a3f391..f09538e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java
@@ -64,6 +64,7 @@ public abstract class AbstractOrmIdMapping<X extends XmlId>
/* JPA 2.0 - the embedded id may be derived from a relationship */
protected boolean derived;
+ protected final OrmConverter nullConverter = new NullOrmConverter(this);
protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
OrmBaseTemporalConverter.BasicAdapter.instance(),
@@ -199,19 +200,26 @@ public abstract class AbstractOrmIdMapping<X extends XmlId>
public void setConverter(Class<? extends Converter> converterType) {
if (this.converter.getType() != converterType) {
+ // Make the old value is the real old one when firing property changed event below
+ OrmConverter old = this.converter;
+ // Set the new value of the converter to a NullOrmConverter to prevent the following
+ // step from synchronizing through a separate thread when setting converters to null
+ // Through this way timing issue between different thread may be eliminated.
+ this.converter = this.nullConverter;
// note: we may also clear the XML value we want;
// but if we leave it, the resulting sync will screw things up...
this.clearXmlConverterValues();
OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
- this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter = this.buildConverter(converterAdapter);
this.converter.initialize();
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, this.converter);
}
}
protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
return (converterAdapter != null) ?
converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullConverter();
+ this.nullConverter;
}
protected void setConverter_(OrmConverter converter) {
@@ -234,14 +242,14 @@ public abstract class AbstractOrmIdMapping<X extends XmlId>
return ormConverter;
}
}
- return this.buildNullConverter();
+ return this.nullConverter;
}
protected void syncConverter() {
OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
if (adapter == null) {
if (this.converter.getType() != null) {
- this.setConverter_(this.buildNullConverter());
+ this.setConverter_(this.nullConverter);
}
} else {
if (this.converter.getType() == adapter.getConverterType()) {
@@ -265,10 +273,6 @@ public abstract class AbstractOrmIdMapping<X extends XmlId>
return null;
}
- protected OrmConverter buildNullConverter() {
- return new NullOrmConverter(this);
- }
-
// ********** converter adapters **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
index 31034c9..079dbf4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
@@ -115,6 +115,7 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM
protected OrmJoinColumn defaultMapKeyJoinColumn;
+ protected final OrmConverter nullConverter = new NullOrmConverter(this);
protected static final OrmConverter.Adapter[] MAP_KEY_CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
OrmBaseEnumeratedConverter.MapKeyAdapter.instance(),
@@ -576,19 +577,26 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM
public void setMapKeyConverter(Class<? extends Converter> converterType) {
if (this.mapKeyConverter.getType() != converterType) {
+ // Make the old value is the real old one when firing property changed event below
+ OrmConverter old = this.mapKeyConverter;
+ // Set the new value of the map key converter to a NullOrmConverter to prevent the following
+ // step from synchronizing through a separate thread when setting converters to null
+ // Through this way timing issue between different thread may be eliminated.
+ this.mapKeyConverter = this.nullConverter;
// note: we may also clear the XML value we want;
// but if we leave it, the resulting sync will screw things up...
this.clearXmlMapKeyConverterValues();
OrmConverter.Adapter converterAdapter = this.getMapKeyConverterAdapter(converterType);
- this.setMapKeyConverter_(this.buildMapKeyConverter(converterAdapter));
+ this.mapKeyConverter = this.buildMapKeyConverter(converterAdapter);
this.mapKeyConverter.initialize();
+ this.firePropertyChanged(MAP_KEY_CONVERTER_PROPERTY, old, this.mapKeyConverter);
}
}
protected OrmConverter buildMapKeyConverter(OrmConverter.Adapter converterAdapter) {
return (converterAdapter != null) ?
converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullMapKeyConverter();
+ this.nullConverter;
}
protected void setMapKeyConverter_(OrmConverter converter) {
@@ -611,14 +619,14 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM
return ormConverter;
}
}
- return this.buildNullMapKeyConverter();
+ return this.nullConverter;
}
protected void syncMapKeyConverter() {
OrmConverter.Adapter adapter = this.getXmlMapKeyConverterAdapter();
if (adapter == null) {
if (this.mapKeyConverter.getType() != null) {
- this.setMapKeyConverter_(this.buildNullMapKeyConverter());
+ this.setMapKeyConverter_(this.nullConverter);
}
} else {
if (this.mapKeyConverter.getType() == adapter.getConverterType()) {
@@ -642,10 +650,6 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM
return null;
}
- protected OrmConverter buildNullMapKeyConverter() {
- return new NullOrmConverter(this);
- }
-
// ********** map key converter adapters **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java
index 975a020..7baee38 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java
@@ -49,6 +49,7 @@ public abstract class AbstractOrmVersionMapping<X extends XmlVersion>
protected OrmConverter converter; // never null
+ protected final OrmConverter nullConverter = new NullOrmConverter(this);
// the spec does not list Temporal explicitly,
// but it is included in the orm.xml schema...
@@ -101,19 +102,26 @@ public abstract class AbstractOrmVersionMapping<X extends XmlVersion>
public void setConverter(Class<? extends Converter> converterType) {
if (this.converter.getType() != converterType) {
+ // Make the old value is the real old one when firing property changed event below
+ OrmConverter old = this.converter;
+ // Set the new value of the converter to a NullOrmConverter to prevent the following
+ // step from synchronizing through a separate thread when setting converters to null
+ // Through this way timing issue between different thread may be eliminated.
+ this.converter = this.nullConverter;
// note: we may also clear the XML value we want;
// but if we leave it, the resulting sync will screw things up...
this.clearXmlConverterValues();
OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
- this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter = this.buildConverter(converterAdapter);
this.converter.initialize();
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, this.converter);
}
}
protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
return (converterAdapter != null) ?
converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullConverter();
+ this.nullConverter;
}
protected void setConverter_(OrmConverter converter) {
@@ -136,14 +144,14 @@ public abstract class AbstractOrmVersionMapping<X extends XmlVersion>
return ormConverter;
}
}
- return this.buildNullConverter();
+ return this.nullConverter;
}
protected void syncConverter() {
OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
if (adapter == null) {
if (this.converter.getType() != null) {
- this.setConverter_(this.buildNullConverter());
+ this.setConverter_(this.nullConverter);
}
} else {
if (this.converter.getType() == adapter.getConverterType()) {
@@ -167,10 +175,6 @@ public abstract class AbstractOrmVersionMapping<X extends XmlVersion>
return null;
}
- protected OrmConverter buildNullConverter() {
- return new NullOrmConverter(this);
- }
-
// ********** converter adapters **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBaseEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBaseEnumeratedConverter.java
index 915c56d..35706da 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBaseEnumeratedConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBaseEnumeratedConverter.java
@@ -21,7 +21,6 @@ public class GenericOrmBaseEnumeratedConverter
implements OrmBaseEnumeratedConverter
{
protected EnumType specifiedEnumType;
- protected EnumType defaultEnumType;
public GenericOrmBaseEnumeratedConverter(OrmAttributeMapping parent, OrmBaseEnumeratedConverter.Owner owner) {
@@ -43,12 +42,6 @@ public class GenericOrmBaseEnumeratedConverter
this.setSpecifiedEnumType_(this.buildSpecifiedEnumType());
}
- @Override
- public void update() {
- super.update();
- this.setDefaultEnumType(this.buildDefaultEnumType());
- }
-
// ********** enum type **********
@@ -79,23 +72,13 @@ public class GenericOrmBaseEnumeratedConverter
return EnumType.fromOrmResourceModel(this.getOwner().getXmlEnumType());
}
- public EnumType getDefaultEnumType() {
- return this.defaultEnumType;
- }
-
- protected void setDefaultEnumType(EnumType enumType) {
- EnumType old = this.defaultEnumType;
- this.defaultEnumType = enumType;
- this.firePropertyChanged(DEFAULT_ENUM_TYPE_PROPERTY, old, enumType);
- }
-
/**
* There is no default enum type in XML.
* If you specify the enumerated element, you must
* specify either {@link EnumType#ORDINAL} or
* {@link EnumType#STRING}.
*/
- protected EnumType buildDefaultEnumType() {
+ public EnumType getDefaultEnumType() {
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
index 2b7edbe..64b0d04 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
@@ -159,6 +159,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected OrmJoinColumn defaultMapKeyJoinColumn;
+ protected final OrmConverter nullConverter = new NullOrmConverter(this);
protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
OrmBaseEnumeratedConverter.BasicAdapter.instance(),
@@ -482,19 +483,26 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
public void setConverter(Class<? extends Converter> converterType) {
if (this.converter.getType() != converterType) {
+ // Make the old value is the real old one when firing property changed event below
+ OrmConverter old = this.converter;
+ // Set the new value of the converter to a NullOrmConverter to prevent the following
+ // step to synchronize through a separate thread when setting converters to null
+ // Through this way timing issue between different thread may be eliminated.
+ this.converter = this.nullConverter;
// note: we may also clear the XML value we want;
// but if we leave it, the resulting sync will screw things up...
this.clearXmlConverterValues();
OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
- this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter = this.buildConverter(converterAdapter);
this.converter.initialize();
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, this.converter);
}
}
protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
return (converterAdapter != null) ?
converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullConverter();
+ this.nullConverter;
}
protected void setConverter_(OrmConverter converter) {
@@ -517,14 +525,14 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
return ormConverter;
}
}
- return this.buildNullConverter();
+ return this.nullConverter;
}
protected void syncConverter() {
OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
if (adapter == null) {
if (this.converter.getType() != null) {
- this.setConverter_(this.buildNullConverter());
+ this.setConverter_(this.nullConverter);
}
} else {
if (this.converter.getType() == adapter.getConverterType()) {
@@ -548,10 +556,6 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
return null;
}
- protected OrmConverter buildNullConverter() {
- return new NullOrmConverter(this);
- }
-
// ********** converter adapters **********
@@ -920,19 +924,26 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
public void setMapKeyConverter(Class<? extends Converter> converterType) {
if (this.mapKeyConverter.getType() != converterType) {
+ // Make the old value is the real old one when firing property changed event below
+ OrmConverter old = this.mapKeyConverter;
+ // Set the new value of the map key converter to a NullOrmConverter to prevent the following
+ // step from synchronizing through a separate thread when setting converters to null
+ // Through this way timing issue between different thread may be eliminated.
+ this.mapKeyConverter = this.nullConverter;
// note: we may also clear the XML value we want;
// but if we leave it, the resulting sync will screw things up...
this.clearXmlMapKeyConverterValues();
OrmConverter.Adapter converterAdapter = this.getMapKeyConverterAdapter(converterType);
- this.setMapKeyConverter_(this.buildMapKeyConverter(converterAdapter));
+ this.mapKeyConverter = this.buildMapKeyConverter(converterAdapter);
this.mapKeyConverter.initialize();
+ this.firePropertyChanged(MAP_KEY_CONVERTER_PROPERTY, old, this.mapKeyConverter);
}
}
protected OrmConverter buildMapKeyConverter(OrmConverter.Adapter converterAdapter) {
return (converterAdapter != null) ?
converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullConverter();
+ this.nullConverter;
}
protected void setMapKeyConverter_(OrmConverter converter) {
@@ -955,14 +966,14 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
return ormConverter;
}
}
- return this.buildNullConverter();
+ return this.nullConverter;
}
protected void syncMapKeyConverter() {
OrmConverter.Adapter adapter = this.getXmlMapKeyConverterAdapter();
if (adapter == null) {
if (this.mapKeyConverter.getType() != null) {
- this.setMapKeyConverter_(this.buildNullConverter());
+ this.setMapKeyConverter_(this.nullConverter);
}
} else {
if (this.mapKeyConverter.getType() == adapter.getConverterType()) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java
index b7c2b0a..c48948a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java
@@ -58,6 +58,8 @@ public class OrmEclipseLinkArrayMapping2_3
protected OrmConverter converter; // never null
+ protected final OrmConverter nullConverter = new NullOrmConverter(this);
+
protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
OrmBaseEnumeratedConverter.BasicAdapter.instance(),
OrmBaseTemporalConverter.BasicAdapter.instance(),
@@ -128,19 +130,26 @@ public class OrmEclipseLinkArrayMapping2_3
public void setConverter(Class<? extends Converter> converterType) {
if (this.converter.getType() != converterType) {
+ // Make the old value is the real old one when firing property changed event below
+ OrmConverter old = this.converter;
+ // Set the new value of the converter to a NullOrmConverter to prevent the following
+ // step from synchronizing through a separate thread when setting converters to null
+ // Through this way timing issue between different thread may be eliminated.
+ this.converter = this.nullConverter;
// note: we may also clear the XML value we want;
// but if we leave it, the resulting sync will screw things up...
this.clearXmlConverterValues();
OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
- this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter = this.buildConverter(converterAdapter);
this.converter.initialize();
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, this.converter);
}
}
protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
return (converterAdapter != null) ?
converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullConverter();
+ this.nullConverter;
}
protected void setConverter_(OrmConverter converter) {
@@ -163,14 +172,14 @@ public class OrmEclipseLinkArrayMapping2_3
return ormConverter;
}
}
- return this.buildNullConverter();
+ return this.nullConverter;
}
protected void syncConverter() {
OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
if (adapter == null) {
if (this.converter.getType() != null) {
- this.setConverter_(this.buildNullConverter());
+ this.setConverter_(this.nullConverter);
}
} else {
if (this.converter.getType() == adapter.getConverterType()) {
@@ -194,10 +203,6 @@ public class OrmEclipseLinkArrayMapping2_3
return null;
}
- protected OrmConverter buildNullConverter() {
- return new NullOrmConverter(this);
- }
-
// ********** converter adapters **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java
index f260519..0e52a7b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java
@@ -29,7 +29,6 @@ public class OrmEclipseLinkConvert
implements EclipseLinkConvert
{
protected String specifiedConverterName;
- protected String defaultConverterName;
public OrmEclipseLinkConvert(OrmAttributeMapping parent, OrmConverter.Owner owner) {
super(parent, owner);
@@ -50,17 +49,10 @@ public class OrmEclipseLinkConvert
this.setSpecifiedConverterName_(this.getXmlConvertibleMapping().getConvert());
}
- @Override
- public void update() {
- super.update();
- this.setDefaultConverterName(this.buildDefaultConverterName());
- }
-
-
// ********** converter name **********
public String getConverterName() {
- return (this.specifiedConverterName != null) ? this.specifiedConverterName : this.defaultConverterName;
+ return (this.specifiedConverterName != null) ? this.specifiedConverterName : this.getDefaultConverterName();
}
public String getSpecifiedConverterName() {
@@ -79,16 +71,6 @@ public class OrmEclipseLinkConvert
}
public String getDefaultConverterName() {
- return this.defaultConverterName;
- }
-
- protected void setDefaultConverterName(String name) {
- String old = this.defaultConverterName;
- this.defaultConverterName = name;
- this.firePropertyChanged(DEFAULT_CONVERTER_NAME_PROPERTY, old, name);
- }
-
- protected String buildDefaultConverterName() {
return DEFAULT_CONVERTER_NAME;
}
@@ -105,7 +87,7 @@ public class OrmEclipseLinkConvert
}
public void initialize() {
- this.specifiedConverterName = ""; //$NON-NLS-1$
+ this.specifiedConverterName = DEFAULT_CONVERTER_NAME; //$NON-NLS-1$
this.getXmlConvertibleMapping().setConvert(this.specifiedConverterName);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmElementCollectionMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmElementCollectionMappingTests.java
index 9dccb43..89341d9 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmElementCollectionMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmElementCollectionMappingTests.java
@@ -17,12 +17,13 @@ import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AttributeOverride;
import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.BaseTemporalConverter;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
import org.eclipse.jpt.jpa.core.context.Column;
import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.jpa.core.context.EmbeddedMapping;
import org.eclipse.jpt.jpa.core.context.EnumType;
-import org.eclipse.jpt.jpa.core.context.BaseEnumeratedConverter;
import org.eclipse.jpt.jpa.core.context.FetchType;
import org.eclipse.jpt.jpa.core.context.IdMapping;
import org.eclipse.jpt.jpa.core.context.ManyToManyMapping;
@@ -30,7 +31,6 @@ import org.eclipse.jpt.jpa.core.context.ManyToOneMapping;
import org.eclipse.jpt.jpa.core.context.OneToManyMapping;
import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.BaseTemporalConverter;
import org.eclipse.jpt.jpa.core.context.TemporalType;
import org.eclipse.jpt.jpa.core.context.TransientMapping;
import org.eclipse.jpt.jpa.core.context.VersionMapping;
@@ -1682,7 +1682,7 @@ public class EclipseLink2_0OrmElementCollectionMappingTests
//set lob in the context model, verify resource model updated
ormElementCollectionMapping.setConverter(EclipseLinkConvert.class);
- assertEquals("", elementCollectionResource.getConvert());
+ assertEquals("none", elementCollectionResource.getConvert());
assertEquals(EclipseLinkConvert.class, ormElementCollectionMapping.getConverter().getType());
((EclipseLinkConvert) ormElementCollectionMapping.getConverter()).setSpecifiedConverterName("bar");
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java
index 02daf99..9237713 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java
@@ -369,7 +369,7 @@ public class EclipseLinkOrmBasicMappingTests
//set lob in the context model, verify resource model updated
ormBasicMapping.setConverter(EclipseLinkConvert.class);
- assertEquals("", basicResource.getConvert());
+ assertEquals("none", basicResource.getConvert());
assertEquals(EclipseLinkConvert.class, ormBasicMapping.getConverter().getType());
((EclipseLinkConvert) ormBasicMapping.getConverter()).setSpecifiedConverterName("bar");
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java
index 26342a5..b0d88a2 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java
@@ -370,7 +370,7 @@ public class EclipseLinkOrmIdMappingTests
//set lob in the context model, verify resource model updated
ormIdMapping.setConverter(EclipseLinkConvert.class);
- assertEquals("", basicResource.getConvert());
+ assertEquals("none", basicResource.getConvert());
assertEquals(EclipseLinkConvert.class, ormIdMapping.getConverter().getType());
((EclipseLinkConvert) ormIdMapping.getConverter()).setSpecifiedConverterName("bar");
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java
index b8d4428..c44be9e 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java
@@ -371,7 +371,7 @@ public class EclipseLinkOrmVersionMappingTests
//set lob in the context model, verify resource model updated
ormVersionMapping.setConverter(EclipseLinkConvert.class);
- assertEquals("", basicResource.getConvert());
+ assertEquals("none", basicResource.getConvert());
assertEquals(EclipseLinkConvert.class, ormVersionMapping.getConverter().getType());
((EclipseLinkConvert) ormVersionMapping.getConverter()).setSpecifiedConverterName("bar");