Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2008-10-27 20:23:32 +0000
committerkmoore2008-10-27 20:23:32 +0000
commit63a2433d3873b4b32f567ac4a467e8402a3e4a36 (patch)
tree4df2580198d641f43e2f05255be4e53096da9fae /jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm
parent467fe80abce1e057f857cf016fa9aa2ca701af98 (diff)
downloadwebtools.dali-63a2433d3873b4b32f567ac4a467e8402a3e4a36.tar.gz
webtools.dali-63a2433d3873b4b32f567ac4a467e8402a3e4a36.tar.xz
webtools.dali-63a2433d3873b4b32f567ac4a467e8402a3e4a36.zip
249505 - more converters support on attribute mappings, conversion-values on object-type-converter still unfinished
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm')
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterImpl.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java209
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasic.java57
12 files changed, 1155 insertions, 80 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java
new file mode 100644
index 0000000000..d12cc740d9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.context.ConversionValue;
+import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class EclipseLinkOrmConversionValue extends AbstractXmlContextNode implements ConversionValue
+{
+ private XmlConversionValue resourceConversionValue;
+
+ private String dataValue;
+
+ private String objectValue;
+
+ public EclipseLinkOrmConversionValue(EclipseLinkOrmObjectTypeConverter parent) {
+ super(parent);
+ }
+
+ @Override
+ public EclipseLinkOrmObjectTypeConverter getParent() {
+ return (EclipseLinkOrmObjectTypeConverter) super.getParent();
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.resourceConversionValue.getValidationTextRange();
+ }
+
+ public String getDataValue() {
+ return this.dataValue;
+ }
+
+ public void setDataValue(String newDataValue) {
+ String oldDataValue = this.dataValue;
+ this.dataValue = newDataValue;
+ this.resourceConversionValue.setDataValue(newDataValue);
+ firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue);
+ }
+
+ protected void setDataValue_(String newDataValue) {
+ String oldDataValue = this.dataValue;
+ this.dataValue = newDataValue;
+ firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue);
+ }
+
+ public String getObjectValue() {
+ return this.objectValue;
+ }
+
+ public void setObjectValue(String newObjectValue) {
+ String oldObjectValue = this.objectValue;
+ this.objectValue = newObjectValue;
+ this.resourceConversionValue.setObjectValue(newObjectValue);
+ firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue);
+ }
+
+ protected void setObjectValue_(String newObjectValue) {
+ String oldObjectValue = this.objectValue;
+ this.objectValue = newObjectValue;
+ firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue);
+ }
+
+ public void initialize(XmlConversionValue resourceConversionValue) {
+ this.resourceConversionValue = resourceConversionValue;
+ this.dataValue = this.dataValue();
+ this.objectValue = this.objectValue();
+ }
+
+ public void update(XmlConversionValue resourceConversionValue) {
+ this.resourceConversionValue = resourceConversionValue;
+ this.setDataValue_(this.dataValue());
+ this.setObjectValue_(this.objectValue());
+ }
+
+ protected String dataValue() {
+ return this.resourceConversionValue.getDataValue();
+ }
+
+ protected String objectValue() {
+ return this.resourceConversionValue.getObjectValue();
+ }
+
+ public TextRange getDataValueTextRange() {
+ return this.resourceConversionValue.getDataValueTextRange();
+ }
+
+ public TextRange getObjectValueTextRange() {
+ return this.resourceConversionValue.getObjectValueTextRange();
+ }
+
+ @Override
+ public void validate(List<IMessage> messages) {
+ super.validate(messages);
+ validateDataValuesUnique(messages);
+ }
+
+ protected void validateDataValuesUnique(List<IMessage> messages) {
+ List<String> dataValues = CollectionTools.list(getParent().dataValues());
+ dataValues.remove(this.dataValue);
+ if (dataValues.contains(this.dataValue)) {
+ messages.add(
+ DefaultEclipseLinkJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE,
+ new String[] {this.dataValue},
+ this,
+ this.getDataValueTextRange()
+ )
+ );
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java
index 10f9b186bf..9138bbc030 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java
@@ -25,7 +25,7 @@ public class EclipseLinkOrmConvert extends AbstractXmlContextNode implements Con
protected XmlConvertibleMapping resourceMapping;
-// protected EclipseLinkOrmConverter converter;
+ protected EclipseLinkOrmConverter converter;
public EclipseLinkOrmConvert(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) {
super(parent);
@@ -78,55 +78,55 @@ public class EclipseLinkOrmConvert extends AbstractXmlContextNode implements Con
firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName);
}
- public EclipseLinkConverter getConverter() {
- return null;
+ public EclipseLinkOrmConverter getConverter() {
+ return this.converter;
}
protected String getConverterType() {
- //if (this.converter == null) {
+ if (this.converter == null) {
return EclipseLinkConverter.NO_CONVERTER;
- //}
- //return this.converter.getType();
+ }
+ return this.converter.getType();
}
public void setConverter(String converterType) {
-// if (getConverterType() == converterType) {
-// return;
-// }
-// EclipseLinkOrmConverter oldConverter = this.converter;
-// EclipseLinkOrmConverter newConverter = buildConverter(converterType);
-// this.converter = null;
-// if (oldConverter != null) {
-// oldConverter.removeFromResourceModel();
-// }
-// this.converter = newConverter;
-// if (newConverter != null) {
-// newConverter.addToResourceModel();
-// }
-// firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-//
-// protected void setConverter(EclipseLinkOrmConverter newConverter) {
-// EclipseLinkOrmConverter oldConverter = this.converter;
-// this.converter = newConverter;
-// firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
-// }
+ if (getConverterType() == converterType) {
+ return;
+ }
+ EclipseLinkOrmConverter oldConverter = this.converter;
+ EclipseLinkOrmConverter newConverter = buildConverter(converterType);
+ this.converter = null;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.converter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
+ protected void setConverter(EclipseLinkOrmConverter newConverter) {
+ EclipseLinkOrmConverter oldConverter = this.converter;
+ this.converter = newConverter;
+ firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
protected void initialize(XmlConvertibleMapping resourceMapping) {
this.resourceMapping = resourceMapping;
this.specifiedConverterName = this.specifiedConverterName();
-// this.converter = this.buildConverter(this.converterType());
+ this.converter = this.buildConverter(this.converterType());
}
public void update() {
this.setSpecifiedConverterName_(this.specifiedConverterName());
-// if (converterType() == getConverterType()) {
-// getConverter().update(jrpa);
-// }
-// else {
-// EclipseLinkOrmConverter javaConverter = buildConverter(converterType());
-// setConverter(javaConverter);
-// }
+ if (converterType() == getConverterType()) {
+ this.converter.update();
+ }
+ else {
+ EclipseLinkOrmConverter javaConverter = buildConverter(converterType());
+ setConverter(javaConverter);
+ }
}
protected String specifiedConverterName() {
@@ -134,38 +134,38 @@ public class EclipseLinkOrmConvert extends AbstractXmlContextNode implements Con
}
-// protected EclipseLinkOrmConverter buildConverter(String converterType) {
-// if (converterType == EclipseLinkConverter.NO_CONVERTER) {
-// return null;
-// }
-// if (converterType == EclipseLinkConverter.CONVERTER) {
-// return new org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaConverter(this, this.resourcePersistentAttribute);
-// }
-// else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) {
-// return new EclipseLinkOrmTypeConverter(this, this.resourcePersistentAttribute);
-// }
-// else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
-// return new EclipseLinkOrmObjectTypeConverter(this, this.resourcePersistentAttribute);
-// }
-// else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) {
-// return new EclipseLinkOrmStructConverter(this, this.resourcePersistentAttribute);
-// }
-// return null;
-// }
+ protected EclipseLinkOrmConverter buildConverter(String converterType) {
+ if (converterType == EclipseLinkConverter.NO_CONVERTER) {
+ return null;
+ }
+ if (converterType == EclipseLinkConverter.CONVERTER) {
+ return new EclipseLinkOrmConverterImpl(this, this.resourceMapping);
+ }
+ else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) {
+ return new EclipseLinkOrmTypeConverter(this, this.resourceMapping);
+ }
+ else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
+ return new EclipseLinkOrmObjectTypeConverter(this, this.resourceMapping);
+ }
+ else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) {
+ return new EclipseLinkOrmStructConverter(this, this.resourceMapping);
+ }
+ return null;
+ }
protected String converterType() {
-// if (jrpa.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME) != null) {
-// return EclipseLinkConverter.CONVERTER;
-// }
-// else if (jrpa.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME) != null) {
-// return EclipseLinkConverter.TYPE_CONVERTER;
-// }
-// else if (jrpa.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME) != null) {
-// return EclipseLinkConverter.OBJECT_TYPE_CONVERTER;
-// }
-// else if (jrpa.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME) != null) {
-// return EclipseLinkConverter.STRUCT_CONVERTER;
-// }
+ if (this.resourceMapping.getConverter() != null) {
+ return EclipseLinkConverter.CONVERTER;
+ }
+ else if (this.resourceMapping.getTypeConverter() != null) {
+ return EclipseLinkConverter.TYPE_CONVERTER;
+ }
+ else if (this.resourceMapping.getObjectTypeConverter() != null) {
+ return EclipseLinkConverter.OBJECT_TYPE_CONVERTER;
+ }
+ else if (this.resourceMapping.getStructConverter() != null) {
+ return EclipseLinkConverter.STRUCT_CONVERTER;
+ }
return null;
}
@@ -173,8 +173,8 @@ public class EclipseLinkOrmConvert extends AbstractXmlContextNode implements Con
@Override
public void validate(List<IMessage> messages) {
super.validate(messages);
-// if (getConverter() != null) {
-// getConverter().validate(messages);
-// }
+ if (getConverter() != null) {
+ getConverter().validate(messages);
+ }
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java
new file mode 100644
index 0000000000..106621edc3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.XmlContextNode;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
+
+
+/**
+ * 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 EclipseLinkOrmConverter extends EclipseLinkConverter, XmlContextNode
+{
+ /**
+ * Update the EclipseLinkOrmConverter context model object to match the
+ * resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
+ */
+ void update();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterImpl.java
new file mode 100644
index 0000000000..95e118356a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterImpl.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.core.context.XmlContextNode;
+import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.context.Converter;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class EclipseLinkOrmConverterImpl extends AbstractXmlContextNode implements Converter, EclipseLinkOrmConverter
+{
+ private XmlConvertibleMapping resourceMapping;
+
+ private String name;
+
+ private String converterClass;
+
+ public EclipseLinkOrmConverterImpl(XmlContextNode parent, XmlConvertibleMapping resourceMapping) {
+ super(parent);
+ this.initialize(resourceMapping);
+ }
+
+ public String getType() {
+ return EclipseLinkConverter.CONVERTER;
+ }
+
+ public void addToResourceModel() {
+ this.resourceMapping.setConverter(EclipseLinkOrmFactory.eINSTANCE.createXmlConverterImpl());
+ }
+
+ public void removeFromResourceModel() {
+ this.resourceMapping.setConverter(null);
+ }
+
+ protected XmlConverter getResourceConverter() {
+ return this.resourceMapping.getConverter();
+ }
+
+ public String getConverterClass() {
+ return this.converterClass;
+ }
+
+ public void setConverterClass(String newConverterClass) {
+ String oldConverterClass = this.converterClass;
+ this.converterClass = newConverterClass;
+ getResourceConverter().setClassName(newConverterClass);
+ firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass);
+ }
+
+ protected void setConverterClass_(String newConverterClass) {
+ String oldConverterClass = this.converterClass;
+ this.converterClass = newConverterClass;
+ firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ getResourceConverter().setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void setName_(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void initialize(XmlConvertibleMapping resourceMapping) {
+ this.resourceMapping = resourceMapping;
+ this.name = this.name();
+ this.converterClass = this.converterClass();
+ }
+
+ public void update() {
+ this.setName_(this.name());
+ this.setConverterClass_(this.converterClass());
+ }
+
+ protected String name() {
+ return getResourceConverter() == null ? null : getResourceConverter().getName();
+ }
+
+ protected String converterClass() {
+ return getResourceConverter() == null ? null : getResourceConverter().getClassName();
+ }
+
+ //************ validation ***************
+
+ @Override
+ public void validate(List<IMessage> messages) {
+ super.validate(messages);
+ validateConverterClass(messages);
+ }
+//TODO validate converter class
+ protected void validateConverterClass(List<IMessage> messages) {
+// if (!getResourceConverter().implementsConverter()) {
+// messages.add(
+// DefaultEclipseLinkJpaValidationMessages.buildMessage(
+// IMessage.HIGH_SEVERITY,
+// EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER,
+// new String[] {this.converterClass},
+// this,
+// getConverterClassTextRange()
+// )
+// );
+// }
+ }
+
+// public TextRange getConverterClassTextRange() {
+// return getResourceConverter().getClassNameTextRange();
+// }
+
+ public TextRange getValidationTextRange() {
+ return getResourceConverter().getValidationTextRange();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java
new file mode 100644
index 0000000000..7639691943
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.context.orm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.context.XmlContextNode;
+import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.context.ConversionValue;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator;
+
+public class EclipseLinkOrmObjectTypeConverter extends AbstractXmlContextNode implements ObjectTypeConverter, EclipseLinkOrmConverter
+{
+ private XmlConvertibleMapping resourceMapping;
+
+ private String name;
+
+ private String dataType;
+
+ private String objectType;
+
+ private String defaultObjectValue;
+
+ private final List<EclipseLinkOrmConversionValue> conversionValues;
+
+ public EclipseLinkOrmObjectTypeConverter(XmlContextNode parent, XmlConvertibleMapping resourceMapping) {
+ super(parent);
+ this.conversionValues = new ArrayList<EclipseLinkOrmConversionValue>();
+ this.initialize(resourceMapping);
+ }
+
+ public String getType() {
+ return EclipseLinkConverter.OBJECT_TYPE_CONVERTER;
+ }
+
+ public void addToResourceModel() {
+ this.resourceMapping.setObjectTypeConverter(EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverterImpl());
+ }
+
+ public void removeFromResourceModel() {
+ this.resourceMapping.setObjectTypeConverter(null);
+ }
+
+ protected XmlObjectTypeConverter getResourceConverter() {
+ return this.resourceMapping.getObjectTypeConverter();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ getResourceConverter().setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void setName_(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getDataType() {
+ return this.dataType;
+ }
+
+ public void setDataType(String newDataType) {
+ String oldDataType = this.dataType;
+ this.dataType = newDataType;
+ getResourceConverter().setDataType(newDataType);
+ firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType);
+ }
+
+ protected void setDataType_(String newDataType) {
+ String oldDataType = this.dataType;
+ this.dataType = newDataType;
+ firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType);
+ }
+
+ public String getObjectType() {
+ return this.objectType;
+ }
+
+ public void setObjectType(String newObjectType) {
+ String oldObjectType = this.objectType;
+ this.objectType = newObjectType;
+ getResourceConverter().setObjectType(newObjectType);
+ firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType);
+ }
+
+ protected void setObjectType_(String newObjectType) {
+ String oldObjectType = this.objectType;
+ this.objectType = newObjectType;
+ firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType);
+ }
+
+ public ListIterator<EclipseLinkOrmConversionValue> conversionValues() {
+ return new CloneListIterator<EclipseLinkOrmConversionValue>(this.conversionValues);
+ }
+
+ public int conversionValuesSize() {
+ return this.conversionValues.size();
+ }
+
+ public ConversionValue addConversionValue(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ConversionValue addConversionValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void moveConversionValue(int targetIndex, int sourceIndex) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeConversionValue(int index) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeConversionValue(ConversionValue conversionValue) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public ListIterator<String> dataValues() {
+ return new TransformationListIterator<EclipseLinkOrmConversionValue, String>(conversionValues()) {
+ @Override
+ protected String transform(EclipseLinkOrmConversionValue next) {
+ return next.getDataValue();
+ }
+ };
+ }
+
+
+ public String getDefaultObjectValue() {
+ return this.defaultObjectValue;
+ }
+
+ public void setDefaultObjectValue(String newDefaultObjectValue) {
+ String oldDefaultObjectValue = this.defaultObjectValue;
+ this.defaultObjectValue = newDefaultObjectValue;
+ getResourceConverter().setDefaultObjectValue(newDefaultObjectValue);
+ firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue);
+ }
+
+ protected void setDefaultObjectValue_(String newDefaultObjectValue) {
+ String oldDefaultObjectValue = this.defaultObjectValue;
+ this.defaultObjectValue = newDefaultObjectValue;
+ firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue);
+ }
+
+
+ protected void initialize(XmlConvertibleMapping resourceMapping) {
+ this.resourceMapping = resourceMapping;
+ this.name = this.name();
+ this.dataType = this.dataType();
+ this.objectType = this.objectType();
+ this.defaultObjectValue = this.defaultObjectValue();
+ }
+
+ public void update() {
+ this.setName_(this.name());
+ this.setDataType_(this.dataType());
+ this.setObjectType_(this.objectType());
+ this.setDefaultObjectValue_(this.defaultObjectValue());
+ }
+
+ protected String name() {
+ return getResourceConverter() == null ? null : getResourceConverter().getName();
+ }
+
+ protected String dataType() {
+ return getResourceConverter() == null ? null : getResourceConverter().getDataType();
+ }
+
+ protected String objectType() {
+ return getResourceConverter() == null ? null : getResourceConverter().getObjectType();
+ }
+
+ protected String defaultObjectValue() {
+ return getResourceConverter() == null ? null : getResourceConverter().getDefaultObjectValue();
+ }
+
+ public TextRange getValidationTextRange() {
+ return getResourceConverter().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java
new file mode 100644
index 0000000000..62f0cb9d50
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.core.context.XmlContextNode;
+import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.eclipselink.core.context.StructConverter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class EclipseLinkOrmStructConverter extends AbstractXmlContextNode implements StructConverter, EclipseLinkOrmConverter
+{
+ private XmlConvertibleMapping resourceMapping;
+
+ private String name;
+
+ private String converterClass;
+
+ public EclipseLinkOrmStructConverter(XmlContextNode parent, XmlConvertibleMapping resourceMapping) {
+ super(parent);
+ this.initialize(resourceMapping);
+ }
+
+ public String getType() {
+ return EclipseLinkConverter.STRUCT_CONVERTER;
+ }
+
+ public void addToResourceModel() {
+ this.resourceMapping.setStructConverter(EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverterImpl());
+ }
+
+ public void removeFromResourceModel() {
+ this.resourceMapping.setStructConverter(null);
+ }
+
+ protected XmlStructConverter getResourceConverter() {
+ return this.resourceMapping.getStructConverter();
+ }
+
+ public String getConverterClass() {
+ return this.converterClass;
+ }
+
+ public void setConverterClass(String newConverterClass) {
+ String oldConverterClass = this.converterClass;
+ this.converterClass = newConverterClass;
+ getResourceConverter().setConverter(newConverterClass);
+ firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass);
+ }
+
+ protected void setConverterClass_(String newConverterClass) {
+ String oldConverterClass = this.converterClass;
+ this.converterClass = newConverterClass;
+ firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ getResourceConverter().setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void setName_(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void initialize(XmlConvertibleMapping resourceMapping) {
+ this.resourceMapping = resourceMapping;
+ this.name = this.name();
+ this.converterClass = this.converterClass();
+ }
+
+ public void update() {
+ this.setName_(this.name());
+ this.setConverterClass_(this.converterClass());
+ }
+
+ protected String name() {
+ return getResourceConverter() == null ? null : getResourceConverter().getName();
+ }
+
+ protected String converterClass() {
+ return getResourceConverter() == null ? null : getResourceConverter().getConverter();
+ }
+
+ //************ validation ***************
+
+ @Override
+ public void validate(List<IMessage> messages) {
+ super.validate(messages);
+ validateConverterClass(messages);
+ }
+//TODO validate converter class
+ protected void validateConverterClass(List<IMessage> messages) {
+// if (!getResourceConverter().implementsConverter()) {
+// messages.add(
+// DefaultEclipseLinkJpaValidationMessages.buildMessage(
+// IMessage.HIGH_SEVERITY,
+// EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER,
+// new String[] {this.converterClass},
+// this,
+// getConverterClassTextRange()
+// )
+// );
+// }
+ }
+
+// public TextRange getConverterClassTextRange() {
+// return getResourceConverter().getClassNameTextRange();
+// }
+
+ public TextRange getValidationTextRange() {
+ return getResourceConverter().getValidationTextRange();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java
new file mode 100644
index 0000000000..d6b350f94e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.XmlContextNode;
+import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter;
+
+public class EclipseLinkOrmTypeConverter extends AbstractXmlContextNode implements TypeConverter, EclipseLinkOrmConverter
+{
+ private XmlConvertibleMapping resourceMapping;
+
+ private String name;
+
+ private String dataType;
+
+ private String objectType;
+
+ public EclipseLinkOrmTypeConverter(XmlContextNode parent, XmlConvertibleMapping resourceMapping) {
+ super(parent);
+ this.initialize(resourceMapping);
+ }
+
+ public String getType() {
+ return EclipseLinkConverter.TYPE_CONVERTER;
+ }
+
+ public void addToResourceModel() {
+ this.resourceMapping.setTypeConverter(EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverterImpl());
+ }
+
+ public void removeFromResourceModel() {
+ this.resourceMapping.setTypeConverter(null);
+ }
+
+ protected XmlTypeConverter getResourceConverter() {
+ return this.resourceMapping.getTypeConverter();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ getResourceConverter().setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void setName_(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getDataType() {
+ return this.dataType;
+ }
+
+ public void setDataType(String newDataType) {
+ String oldDataType = this.dataType;
+ this.dataType = newDataType;
+ getResourceConverter().setDataType(newDataType);
+ firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType);
+ }
+
+ protected void setDataType_(String newDataType) {
+ String oldDataType = this.dataType;
+ this.dataType = newDataType;
+ firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType);
+ }
+
+ public String getObjectType() {
+ return this.objectType;
+ }
+
+ public void setObjectType(String newObjectType) {
+ String oldObjectType = this.objectType;
+ this.objectType = newObjectType;
+ getResourceConverter().setObjectType(newObjectType);
+ firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType);
+ }
+
+ protected void setObjectType_(String newObjectType) {
+ String oldObjectType = this.objectType;
+ this.objectType = newObjectType;
+ firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType);
+ }
+
+ protected void initialize(XmlConvertibleMapping resourceMapping) {
+ this.resourceMapping = resourceMapping;
+ this.name = this.name();
+ this.dataType = this.dataType();
+ this.objectType = this.objectType();
+ }
+
+ public void update() {
+ this.setName_(this.name());
+ this.setDataType_(this.dataType());
+ this.setObjectType_(this.objectType());
+ }
+
+ protected String name() {
+ return getResourceConverter() == null ? null : getResourceConverter().getName();
+ }
+
+ protected String dataType() {
+ return getResourceConverter() == null ? null : getResourceConverter().getDataType();
+ }
+
+ protected String objectType() {
+ return getResourceConverter() == null ? null : getResourceConverter().getObjectType();
+ }
+
+ public TextRange getValidationTextRange() {
+ return getResourceConverter().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java
new file mode 100644
index 0000000000..fc51e04f58
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.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.eclipselink.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
+import org.eclipse.jpt.eclipselink.core.context.Converter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter;
+
+/**
+ * VirtualBasic is an implementation of Basic used when there is
+ * no tag in the orm.xml and an underlying javaBasicMapping exists.
+ */
+public class EclipseLinkVirtualXmlConverter extends AbstractJpaEObject implements XmlConverter
+{
+ protected OrmTypeMapping ormTypeMapping;
+
+ protected Converter javaConverter;
+
+ public EclipseLinkVirtualXmlConverter(OrmTypeMapping ormTypeMapping, Converter javaConverter) {
+ super();
+ this.ormTypeMapping = ormTypeMapping;
+ this.javaConverter = javaConverter;
+ }
+
+ protected boolean isOrmMetadataComplete() {
+ return this.ormTypeMapping.isMetadataComplete();
+ }
+
+ public String getClassName() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getConverterClass();
+ }
+
+ public void setClassName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ public String getName() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java
new file mode 100644
index 0000000000..cc89367946
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.context.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
+import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter;
+
+/**
+ * VirtualBasic is an implementation of Basic used when there is
+ * no tag in the orm.xml and an underlying javaBasicMapping exists.
+ */
+public class EclipseLinkVirtualXmlObjectTypeConverter extends AbstractJpaEObject implements XmlObjectTypeConverter
+{
+ protected OrmTypeMapping ormTypeMapping;
+
+ protected ObjectTypeConverter javaConverter;
+
+ public EclipseLinkVirtualXmlObjectTypeConverter(OrmTypeMapping ormTypeMapping, ObjectTypeConverter javaConverter) {
+ super();
+ this.ormTypeMapping = ormTypeMapping;
+ this.javaConverter = javaConverter;
+ }
+
+ protected boolean isOrmMetadataComplete() {
+ return this.ormTypeMapping.isMetadataComplete();
+ }
+
+ public String getName() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ public String getDataType() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getDataType();
+ }
+
+ public void setDataType(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ public String getObjectType() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getObjectType();
+ }
+
+ public void setObjectType(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ public String getDefaultObjectValue() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getDefaultObjectValue();
+ }
+
+ public void setDefaultObjectValue(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ public EList<XmlConversionValue> getConversionValues() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java
new file mode 100644
index 0000000000..7dcda68133
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.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.eclipselink.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
+import org.eclipse.jpt.eclipselink.core.context.StructConverter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter;
+
+/**
+ * VirtualBasic is an implementation of Basic used when there is
+ * no tag in the orm.xml and an underlying javaBasicMapping exists.
+ */
+public class EclipseLinkVirtualXmlStructConverter extends AbstractJpaEObject implements XmlStructConverter
+{
+ protected OrmTypeMapping ormTypeMapping;
+
+ protected StructConverter javaConverter;
+
+ public EclipseLinkVirtualXmlStructConverter(OrmTypeMapping ormTypeMapping, StructConverter javaConverter) {
+ super();
+ this.ormTypeMapping = ormTypeMapping;
+ this.javaConverter = javaConverter;
+ }
+
+ protected boolean isOrmMetadataComplete() {
+ return this.ormTypeMapping.isMetadataComplete();
+ }
+
+ public String getConverter() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getConverterClass();
+ }
+
+ public void setConverter(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ public String getName() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.java
new file mode 100644
index 0000000000..2859580bd0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.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.eclipselink.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
+import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
+import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter;
+
+/**
+ * VirtualBasic is an implementation of Basic used when there is
+ * no tag in the orm.xml and an underlying javaBasicMapping exists.
+ */
+public class EclipseLinkVirtualXmlTypeConverter extends AbstractJpaEObject implements XmlTypeConverter
+{
+ protected OrmTypeMapping ormTypeMapping;
+
+ protected TypeConverter javaConverter;
+
+ public EclipseLinkVirtualXmlTypeConverter(OrmTypeMapping ormTypeMapping, TypeConverter javaConverter) {
+ super();
+ this.ormTypeMapping = ormTypeMapping;
+ this.javaConverter = javaConverter;
+ }
+
+ protected boolean isOrmMetadataComplete() {
+ return this.ormTypeMapping.isMetadataComplete();
+ }
+
+ public String getName() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ public String getDataType() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getDataType();
+ }
+
+ public void setDataType(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ public String getObjectType() {
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ return this.javaConverter.getObjectType();
+ }
+
+ public void setObjectType(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasic.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasic.java
index a450ac1837..3cd79c0fc2 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasic.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasic.java
@@ -14,7 +14,12 @@ import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.core.internal.context.orm.VirtualXmlBasic;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.eclipselink.core.context.Convert;
+import org.eclipse.jpt.eclipselink.core.context.Converter;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
+import org.eclipse.jpt.eclipselink.core.context.StructConverter;
+import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter;
@@ -66,42 +71,70 @@ public class VirtualEclipseLinkXmlBasic extends VirtualXmlBasic implements XmlBa
}
public XmlConverter getConverter() {
- // TODO Auto-generated method stub
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) {
+ EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter();
+ if (converter != null && converter.getType() == EclipseLinkConverter.CONVERTER) {
+ return new EclipseLinkVirtualXmlConverter(this.ormTypeMapping, (Converter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter());
+ }
+ }
return null;
}
public XmlObjectTypeConverter getObjectTypeConverter() {
- // TODO Auto-generated method stub
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) {
+ EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter();
+ if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
+ return new EclipseLinkVirtualXmlObjectTypeConverter(this.ormTypeMapping, (ObjectTypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter());
+ }
+ }
return null;
}
public XmlStructConverter getStructConverter() {
- // TODO Auto-generated method stub
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) {
+ EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter();
+ if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) {
+ return new EclipseLinkVirtualXmlStructConverter(this.ormTypeMapping, (StructConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter());
+ }
+ }
return null;
}
public XmlTypeConverter getTypeConverter() {
- // TODO Auto-generated method stub
+ if (isOrmMetadataComplete()) {
+ return null;
+ }
+ if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) {
+ EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter();
+ if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) {
+ return new EclipseLinkVirtualXmlTypeConverter(this.ormTypeMapping, (TypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter());
+ }
+ }
return null;
}
public void setConverter(XmlConverter value) {
- // TODO Auto-generated method stub
-
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
}
public void setObjectTypeConverter(XmlObjectTypeConverter value) {
- // TODO Auto-generated method stub
-
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
}
public void setStructConverter(XmlStructConverter value) {
- // TODO Auto-generated method stub
-
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
}
public void setTypeConverter(XmlTypeConverter value) {
- // TODO Auto-generated method stub
-
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
}
}

Back to the top