diff options
author | kmoore | 2011-08-12 21:01:03 +0000 |
---|---|---|
committer | kmoore | 2011-08-12 21:01:03 +0000 |
commit | 728f3d9b7e7cff1d5fa517079b97a025e7d274e2 (patch) | |
tree | 7cff10b8540d38e79d9eedbfef0ca8ba19302321 /jpa/plugins/org.eclipse.jpt.jpa.core/src/org | |
parent | 53bbc7bc023cf939d2e08cbb0e8dba503d77cd09 (diff) | |
download | webtools.dali-728f3d9b7e7cff1d5fa517079b97a025e7d274e2.tar.gz webtools.dali-728f3d9b7e7cff1d5fa517079b97a025e7d274e2.tar.xz webtools.dali-728f3d9b7e7cff1d5fa517079b97a025e7d274e2.zip |
Bug 354054 - [JPA2.0] MapKeyTemporal and MapKeyEnumerated model support
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org')
58 files changed, 2122 insertions, 660 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java index dafa2c44ae..2b8529e9cb 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java @@ -32,6 +32,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping; import org.eclipse.jpt.jpa.core.context.java.JavaColumn; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn; import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping; @@ -135,7 +136,7 @@ import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; * * @see org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFactory * - * @version 2.3 + * @version 3.1 * @since 2.0 */ public interface JpaFactory @@ -272,11 +273,11 @@ public interface JpaFactory JavaVirtualUniqueConstraint buildJavaVirtualUniqueConstraint(JavaJpaContextNode parent, ReadOnlyUniqueConstraint overriddenUniqueConstraint); - JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation); + JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation, JavaConverter.Owner owner); - JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation); + JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation, JavaConverter.Owner owner); - JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation); + JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation, JavaConverter.Owner owner); JavaOrderable buildJavaOrderable(JavaAttributeMapping parent); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java index 78be6044f1..deb2a9c932 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. + * Copyright (c) 2008, 2011 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. @@ -9,6 +9,9 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.context; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; + /** * JPA attribute mapping converter. * <p> @@ -18,7 +21,7 @@ package org.eclipse.jpt.jpa.core.context; * 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 + * @version 3.1 * @since 2.1 */ public interface Converter @@ -30,4 +33,20 @@ public interface Converter * Return the converter's type. */ Class<? extends Converter> getType(); + + + // ********** owner ********** + + /** + * Interface allowing converters to be used in multiple places + * (e.g. basic mappings, collection mappings, etc). + */ + public interface Owner + { + /** + * + */ + JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver); + } + } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java index 1b2d8c96e0..6ba7353ab2 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java @@ -15,6 +15,8 @@ import org.eclipse.jpt.common.utility.internal.ClassName; import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.jpa.core.JpaFactory; import org.eclipse.jpt.jpa.core.context.Converter; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; /** * Java converter @@ -25,7 +27,7 @@ import org.eclipse.jpt.jpa.core.context.Converter; * 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 + * @version 3.1 * @since 2.1 */ public interface JavaConverter @@ -111,12 +113,12 @@ public interface JavaConverter return (annotation == null) ? null : this.buildConverter(annotation, parent, factory); } + protected abstract String getAnnotationName(); + public Annotation getConverterAnnotation(JavaResourceAttribute attribute) { return attribute.getAnnotation(this.getAnnotationName()); } - protected abstract String getAnnotationName(); - public JavaConverter buildNewConverter(JavaAttributeMapping parent, JpaFactory factory) { return this.buildConverter(this.buildConverterAnnotationIfNecessary(parent.getResourceAttribute()), parent, factory); } @@ -135,6 +137,14 @@ public interface JavaConverter attribute.removeAnnotation(this.getAnnotationName()); } + protected Owner buildOwner() { + return new Owner() { + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return JptValidator.Null.instance(); + } + }; + } + @Override public String toString() { return StringTools.buildToStringFor(this, ClassName.getSimpleName(this.getAnnotationName())); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java index a054463334..e87c5304ff 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java @@ -51,7 +51,7 @@ public interface JavaEnumeratedConverter } public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { - return factory.buildJavaEnumeratedConverter(parent, (EnumeratedAnnotation) converterAnnotation); + return factory.buildJavaEnumeratedConverter(parent, (EnumeratedAnnotation) converterAnnotation, this.buildOwner()); } } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java index 83b059ee32..f78c21c8d3 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java @@ -51,7 +51,7 @@ public interface JavaLobConverter } public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { - return factory.buildJavaLobConverter(parent, (LobAnnotation) converterAnnotation); + return factory.buildJavaLobConverter(parent, (LobAnnotation) converterAnnotation, this.buildOwner()); } } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java index 29055561a9..85c41dfb23 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java @@ -13,6 +13,10 @@ import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.jpa.core.JpaFactory; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.JavaElementCollectionTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.JavaTemporalConverterValidator; import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; /** @@ -29,15 +33,53 @@ public interface JavaTemporalConverter { // ********** adapter ********** - public static class Adapter - extends JavaConverter.AbstractAdapter + public static class BasicAdapter extends AbstractAdapter + { + private static final Adapter INSTANCE = new BasicAdapter(); + public static Adapter instance() { + return INSTANCE; + } + + private BasicAdapter() { + super(); + } + + @Override + protected Owner buildOwner() { + return new Owner() { + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return new JavaTemporalConverterValidator((TemporalConverter) converter, textRangeResolver); + } + }; + } + } + + public static class ElementCollectionAdapter extends AbstractAdapter { - private static final Adapter INSTANCE = new Adapter(); + private static final Adapter INSTANCE = new ElementCollectionAdapter(); public static Adapter instance() { return INSTANCE; } + + private ElementCollectionAdapter() { + super(); + } + + @Override + protected Owner buildOwner() { + return new Owner() { + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return new JavaElementCollectionTemporalConverterValidator((TemporalConverter) converter, textRangeResolver); + } + }; + } + } - private Adapter() { + abstract static class AbstractAdapter + extends JavaConverter.AbstractAdapter + { + + AbstractAdapter() { super(); } @@ -51,7 +93,7 @@ public interface JavaTemporalConverter } public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { - return factory.buildJavaTemporalConverter(parent, (TemporalAnnotation) converterAnnotation); + return factory.buildJavaTemporalConverter(parent, (TemporalAnnotation) converterAnnotation, this.buildOwner()); } } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java index 2e8001eb7e..3df2014512 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. + * Copyright (c) 2008, 2011 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. @@ -13,6 +13,7 @@ import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.XmlContextNode; +import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; import org.eclipse.text.edits.ReplaceEdit; @@ -25,7 +26,7 @@ import org.eclipse.text.edits.ReplaceEdit; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.0 + * @version 3.1 * @since 2.1 */ public interface OrmConverter @@ -93,7 +94,7 @@ public interface OrmConverter * * @see #buildNewConverter(OrmAttributeMapping, OrmXmlContextNodeFactory) */ - boolean isActive(XmlConvertibleMapping xmlMapping); + boolean isActive(XmlAttributeMapping xmlMapping); /** * Build a converter for specified mapping. @@ -111,6 +112,6 @@ public interface OrmConverter /** * Clear the adapter's XML value from the specified XML mapping. */ - void clearXmlValue(XmlConvertibleMapping xmlMapping); + void clearXmlValue(XmlAttributeMapping xmlMapping); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java index 859883f98b..0e59469ff7 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 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. @@ -9,8 +9,13 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.context.orm; +import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.EnumeratedConverter; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.resource.orm.EnumType; +import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; /** @@ -25,6 +30,18 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; public interface OrmEnumeratedConverter extends EnumeratedConverter, OrmConverter { + // ********** owner ********** + + /** + */ + public interface Owner extends OrmConverter.Owner { + EnumType getXmlEnumType(); + + void setXmlEnumType(EnumType enumType); + + TextRange getEnumTextRange(); + } + // ********** adapter ********** public static class Adapter @@ -45,19 +62,36 @@ public interface OrmEnumeratedConverter public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping(); - return (xmlMapping.getEnumerated() == null) ? null : factory.buildOrmEnumeratedConverter(parent); + return (xmlMapping.getEnumerated() == null) ? null : factory.buildOrmEnumeratedConverter(parent, this.buildOwner(xmlMapping)); + } + + protected OrmEnumeratedConverter.Owner buildOwner(final XmlConvertibleMapping mapping) { + return new OrmEnumeratedConverter.Owner() { + public void setXmlEnumType(EnumType enumType) { + mapping.setEnumerated(enumType); + } + public EnumType getXmlEnumType() { + return mapping.getEnumerated(); + } + public TextRange getEnumTextRange() { + return mapping.getEnumeratedTextRange(); + } + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return JptValidator.Null.instance(); + } + }; } - public boolean isActive(XmlConvertibleMapping xmlMapping) { - return xmlMapping.getEnumerated() != null; + public boolean isActive(XmlAttributeMapping xmlMapping) { + return ((XmlConvertibleMapping) xmlMapping).getEnumerated() != null; } public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - return factory.buildOrmEnumeratedConverter(parent); + return factory.buildOrmEnumeratedConverter(parent, this.buildOwner((XmlConvertibleMapping) parent.getXmlAttributeMapping())); } - public void clearXmlValue(XmlConvertibleMapping xmlMapping) { - xmlMapping.setEnumerated(null); + public void clearXmlValue(XmlAttributeMapping xmlMapping) { + ((XmlConvertibleMapping) xmlMapping).setEnumerated(null); } } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java index f1a29164b4..75a4744fd1 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 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. @@ -11,6 +11,9 @@ package org.eclipse.jpt.jpa.core.context.orm; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.LobConverter; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; /** @@ -28,7 +31,7 @@ public interface OrmLobConverter // ********** adapter ********** public static class Adapter - implements OrmConverter.Adapter + implements OrmConverter.Adapter, OrmConverter.Owner { private static final Adapter INSTANCE = new Adapter(); public static Adapter instance() { @@ -45,19 +48,23 @@ public interface OrmLobConverter public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping(); - return xmlMapping.isLob() ? factory.buildOrmLobConverter(parent) : null; + return xmlMapping.isLob() ? factory.buildOrmLobConverter(parent, this) : null; } - public boolean isActive(XmlConvertibleMapping xmlMapping) { - return xmlMapping.isLob(); + public boolean isActive(XmlAttributeMapping xmlMapping) { + return ((XmlConvertibleMapping) xmlMapping).isLob(); } public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - return factory.buildOrmLobConverter(parent); + return factory.buildOrmLobConverter(parent, this); } - public void clearXmlValue(XmlConvertibleMapping xmlMapping) { - xmlMapping.setLob(false); + public void clearXmlValue(XmlAttributeMapping xmlMapping) { + ((XmlConvertibleMapping) xmlMapping).setLob(false); + } + + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return JptValidator.Null.instance(); } } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java index e474b841a2..2b515ef0a8 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 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. @@ -9,8 +9,15 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.context.orm; +import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.OrmElementCollectionTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.OrmTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.resource.orm.TemporalType; +import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; /** @@ -25,17 +32,85 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; public interface OrmTemporalConverter extends TemporalConverter, OrmConverter { + // ********** owner ********** + + /** + */ + public interface Owner + extends OrmConverter.Owner + { + TemporalType getXmlTemporalType(); + + void setXmlTemporalType(TemporalType temporalType); + + TextRange getTemporalTextRange(); + } + // ********** adapter ********** + public static class BasicAdapter extends AbstractAdapter + { + private static final Adapter INSTANCE = new BasicAdapter(); + public static Adapter instance() { + return INSTANCE; + } + + private BasicAdapter() { + super(); + } - public static class Adapter - implements OrmConverter.Adapter + @Override + protected Owner buildOwner(final XmlConvertibleMapping mapping) { + return new OrmTemporalConverter.Owner() { + public void setXmlTemporalType(TemporalType temporalType) { + mapping.setTemporal(temporalType); + } + public TemporalType getXmlTemporalType() { + return mapping.getTemporal(); + } + public TextRange getTemporalTextRange() { + return mapping.getTemporalTextRange(); + } + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return new OrmTemporalConverterValidator((TemporalConverter) converter, textRangeResolver); + } + }; + } + } + + public static class ElementCollectionAdapter extends AbstractAdapter { - private static final Adapter INSTANCE = new Adapter(); + private static final Adapter INSTANCE = new ElementCollectionAdapter(); public static Adapter instance() { return INSTANCE; } + + private ElementCollectionAdapter() { + super(); + } + + @Override + protected Owner buildOwner(final XmlConvertibleMapping mapping) { + return new OrmTemporalConverter.Owner() { + public void setXmlTemporalType(TemporalType temporalType) { + mapping.setTemporal(temporalType); + } + public TemporalType getXmlTemporalType() { + return mapping.getTemporal(); + } + public TextRange getTemporalTextRange() { + return mapping.getTemporalTextRange(); + } + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return new OrmElementCollectionTemporalConverterValidator((TemporalConverter) converter, textRangeResolver); + } + }; + } + } - private Adapter() { + abstract static class AbstractAdapter + implements OrmConverter.Adapter + { + AbstractAdapter() { super(); } @@ -45,19 +120,22 @@ public interface OrmTemporalConverter public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping(); - return (xmlMapping.getTemporal() == null) ? null : factory.buildOrmTemporalConverter(parent); + return (xmlMapping.getTemporal() == null) ? null : factory.buildOrmTemporalConverter(parent, this.buildOwner(xmlMapping)); } - public boolean isActive(XmlConvertibleMapping xmlMapping) { - return xmlMapping.getTemporal() != null; + protected abstract OrmTemporalConverter.Owner buildOwner(final XmlConvertibleMapping mapping); + + + public boolean isActive(XmlAttributeMapping xmlMapping) { + return ((XmlConvertibleMapping) xmlMapping).getTemporal() != null; } public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - return factory.buildOrmTemporalConverter(parent); + return factory.buildOrmTemporalConverter(parent, this.buildOwner((XmlConvertibleMapping) parent.getXmlAttributeMapping())); } - public void clearXmlValue(XmlConvertibleMapping xmlMapping) { - xmlMapping.setTemporal(null); + public void clearXmlValue(XmlAttributeMapping xmlMapping) { + ((XmlConvertibleMapping) xmlMapping).setTemporal(null); } } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java index 9c15fc8639..1ea00fe8a0 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java @@ -253,11 +253,11 @@ public interface OrmXmlContextNodeFactory OrmVirtualUniqueConstraint buildOrmVirtualUniqueConstraint(XmlContextNode parent, ReadOnlyUniqueConstraint overriddenUniqueConstraint); - OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent); + OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent, OrmEnumeratedConverter.Owner owner); - OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent); + OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent, OrmTemporalConverter.Owner owner); - OrmConverter buildOrmLobConverter(OrmAttributeMapping parent); + OrmConverter buildOrmLobConverter(OrmAttributeMapping parent, OrmConverter.Owner owner); /** * JPA 1.0 only diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java index bdc509a362..7cc2143d91 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java @@ -35,6 +35,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping; import org.eclipse.jpt.jpa.core.context.java.JavaColumn; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn; import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping; @@ -396,16 +397,16 @@ public abstract class AbstractJpaFactory return new GenericJavaVirtualUniqueConstraint(parent, overriddenUniqueConstraint); } - public JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation) { - return new GenericJavaEnumeratedConverter(parent, annotation); + public JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation, JavaConverter.Owner owner) { + return new GenericJavaEnumeratedConverter(parent, annotation, owner); } - public JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation) { - return new GenericJavaTemporalConverter(parent, annotation); + public JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation, JavaConverter.Owner owner) { + return new GenericJavaTemporalConverter(parent, annotation, owner); } - public JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation) { - return new GenericJavaLobConverter(parent, annotation); + public JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation, JavaConverter.Owner owner) { + return new GenericJavaLobConverter(parent, annotation, owner); } public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java index be2893ecb6..7da7603041 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java @@ -61,7 +61,7 @@ public abstract class AbstractJavaBasicMapping protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { JavaEnumeratedConverter.Adapter.instance(), - JavaTemporalConverter.Adapter.instance(), + JavaTemporalConverter.BasicAdapter.instance(), JavaLobConverter.Adapter.instance() }; protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); @@ -180,7 +180,7 @@ public abstract class AbstractJavaBasicMapping } public boolean isDefaultOptional() { - return defaultOptional; + return this.defaultOptional; } protected void setDefaultOptional(boolean optional) { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java index 4aeb7d87a4..5fefd49750 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java @@ -69,7 +69,7 @@ public abstract class AbstractJavaIdMapping protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { - JavaTemporalConverter.Adapter.instance(), + JavaTemporalConverter.BasicAdapter.instance(), }; protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java index e0c2467a91..909a4f8489 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java @@ -12,15 +12,21 @@ package org.eclipse.jpt.jpa.core.internal.context.java; import java.util.ArrayList; import java.util.List; import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.common.utility.Filter; +import org.eclipse.jpt.common.utility.internal.Association; +import org.eclipse.jpt.common.utility.internal.SimpleAssociation; import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.Tools; +import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; +import org.eclipse.jpt.jpa.core.JpaFactory; import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; import org.eclipse.jpt.jpa.core.context.Column; +import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.Embeddable; import org.eclipse.jpt.jpa.core.context.Entity; import org.eclipse.jpt.jpa.core.context.FetchType; @@ -33,6 +39,7 @@ import org.eclipse.jpt.jpa.core.context.RelationshipStrategy; import org.eclipse.jpt.jpa.core.context.TypeMapping; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; import org.eclipse.jpt.jpa.core.context.java.JavaColumn; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; import org.eclipse.jpt.jpa.core.context.java.JavaMultiRelationshipMapping; import org.eclipse.jpt.jpa.core.context.java.JavaOrderable; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; @@ -47,10 +54,13 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideCol import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator; import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator; import org.eclipse.jpt.jpa.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter; import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaMapKeyColumn2_0; import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapKeyEnumeratedConverter2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapKeyTemporalConverter2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; @@ -82,9 +92,16 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi protected Type keyType; protected final JavaColumn mapKeyColumn; + protected JavaConverter mapKeyConverter; // map key converter - never null protected final JavaAttributeOverrideContainer mapKeyAttributeOverrideContainer; + protected static final JavaConverter.Adapter[] MAP_KEY_CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { + JavaMapKeyEnumeratedConverter2_0.Adapter.instance(), + JavaMapKeyTemporalConverter2_0.Adapter.instance() + }; + protected static final Iterable<JavaConverter.Adapter> MAP_KEY_CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(MAP_KEY_CONVERTER_ADAPTER_ARRAY); + protected AbstractJavaMultiRelationshipMapping(JavaPersistentAttribute parent) { super(parent); @@ -98,6 +115,7 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass(); this.mapKeyColumn = this.buildMapKeyColumn(); + this.mapKeyConverter = this.buildMapKeyConverter(); this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer(); } @@ -117,6 +135,7 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass()); this.mapKeyColumn.synchronizeWithResourceModel(); + this.syncMapKeyConverter(); this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel(); } @@ -134,6 +153,7 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi this.setKeyType(this.buildKeyType()); this.mapKeyColumn.update(); + this.mapKeyConverter.update(); this.mapKeyAttributeOverrideContainer.update(); } @@ -532,6 +552,118 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi } + // ********** map key converter ********** + + public JavaConverter getMapKeyConverter() { + return this.mapKeyConverter; + } + + public void setMapKeyConverter(Class<? extends Converter> converterType) { + if (this.mapKeyConverter.getType() != converterType) { + this.mapKeyConverter.dispose(); + JavaConverter.Adapter converterAdapter = this.getKeyConverterAdapter(converterType); + this.retainMapKeyConverterAnnotation(converterAdapter); + this.setMapKeyConverter_(this.buildMapKeyConverter(converterAdapter)); + } + } + + protected JavaConverter buildMapKeyConverter(JavaConverter.Adapter converterAdapter) { + return (converterAdapter != null) ? + converterAdapter.buildNewConverter(this, this.getJpaFactory()) : + this.buildNullMapKeyConverter(); + } + + protected void setMapKeyConverter_(JavaConverter mapKeyConverter) { + Converter old = this.mapKeyConverter; + this.mapKeyConverter = mapKeyConverter; + this.firePropertyChanged(MAP_KEY_CONVERTER_PROPERTY, old, mapKeyConverter); + } + + /** + * Clear all the converter annotations <em>except</em> for the annotation + * corresponding to the specified adapter. If the specified adapter is + * <code>null</code>, remove <em>all</em> the converter annotations. + */ + protected void retainMapKeyConverterAnnotation(JavaConverter.Adapter converterAdapter) { + JavaResourceAttribute resourceAttribute = this.getResourceAttribute(); + for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + if (adapter != converterAdapter) { + adapter.removeConverterAnnotation(resourceAttribute); + } + } + } + + protected JavaConverter buildMapKeyConverter() { + if (isJpa2_0Compatible()) { + JpaFactory jpaFactory = this.getJpaFactory(); + for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory); + if (javaConverter != null) { + return javaConverter; + } + } + } + return this.buildNullMapKeyConverter(); + } + + protected void syncMapKeyConverter() { + Association<JavaConverter.Adapter, Annotation> assoc = this.getMapKeyConverterAnnotation(); + if (assoc == null) { + if (this.mapKeyConverter.getType() != null) { + this.setMapKeyConverter_(this.buildNullMapKeyConverter()); + } + } else { + JavaConverter.Adapter adapter = assoc.getKey(); + Annotation annotation = assoc.getValue(); + if ((this.mapKeyConverter.getType() == adapter.getConverterType()) && + (this.mapKeyConverter.getConverterAnnotation() == annotation)) { + this.mapKeyConverter.synchronizeWithResourceModel(); + } else { + this.setMapKeyConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory())); + } + } + } + + /** + * Return the first converter annotation we find along with its corresponding + * adapter. Return <code>null</code> if there are no converter annotations. + */ + protected Association<JavaConverter.Adapter, Annotation> getMapKeyConverterAnnotation() { + if (isJpa2_0Compatible()) { + JavaResourceAttribute resourceAttribute = this.getResourceAttribute(); + for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + Annotation annotation = adapter.getConverterAnnotation(resourceAttribute); + if (annotation != null) { + return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation); + } + } + } + return null; + } + + protected JavaConverter buildNullMapKeyConverter() { + return new NullJavaConverter(this); + } + + + // ********** map key converter adapters ********** + + /** + * Return the converter adapter for the specified converter type. + */ + protected JavaConverter.Adapter getKeyConverterAdapter(Class<? extends Converter> converterType) { + for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + if (adapter.getConverterType() == converterType) { + return adapter; + } + } + return null; + } + + protected Iterable<JavaConverter.Adapter> getMapKeyConverterAdapters() { + return MAP_KEY_CONVERTER_ADAPTERS; + } + // ********** map key attribute override container ********** public JavaAttributeOverrideContainer getMapKeyAttributeOverrideContainer() { @@ -650,7 +782,7 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi } if (this.getKeyType() == Type.BASIC_TYPE) { this.mapKeyColumn.validate(messages, reporter, astRoot); - //validate map key converter + this.mapKeyConverter.validate(messages, reporter, astRoot); } else if (this.getKeyType() == Type.ENTITY_TYPE) { //validate map key join columns diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java index 28d8530aa3..bb9b095979 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java @@ -56,7 +56,7 @@ public abstract class AbstractJavaVersionMapping // the spec does not list Temporal explicitly, // but it is included in the orm.xml schema... protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { - JavaTemporalConverter.Adapter.instance(), + JavaTemporalConverter.BasicAdapter.instance(), }; protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); 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 cec4aa4f4d..ba9731274d 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 @@ -65,7 +65,7 @@ public abstract class AbstractOrmBasicMapping<X extends XmlBasic> protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { OrmEnumeratedConverter.Adapter.instance(), - OrmTemporalConverter.Adapter.instance(), + OrmTemporalConverter.BasicAdapter.instance(), OrmLobConverter.Adapter.instance() }; protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); 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 b41cf8db22..7c1feca60b 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 @@ -72,7 +72,7 @@ public abstract class AbstractOrmIdMapping<X extends XmlId> protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { - OrmTemporalConverter.Adapter.instance(), + OrmTemporalConverter.BasicAdapter.instance(), }; protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); 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 eabf1c41cd..0fd2048d2e 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 @@ -16,12 +16,14 @@ import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.common.utility.internal.Tools; +import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; import org.eclipse.jpt.jpa.core.context.AttributeMapping; import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; import org.eclipse.jpt.jpa.core.context.Column; +import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.Embeddable; import org.eclipse.jpt.jpa.core.context.Entity; import org.eclipse.jpt.jpa.core.context.FetchType; @@ -36,11 +38,13 @@ import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; +import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; import org.eclipse.jpt.jpa.core.context.orm.OrmMultiRelationshipMapping; import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable; import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy; import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; +import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; import org.eclipse.jpt.jpa.core.internal.context.JptValidator; import org.eclipse.jpt.jpa.core.internal.context.MappingTools; @@ -51,9 +55,12 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideCol import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator; import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator; import org.eclipse.jpt.jpa.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter; import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionMapping2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapKeyEnumeratedConverter2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapKeyTemporalConverter2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0; import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping; import org.eclipse.jpt.jpa.core.resource.orm.MapKey; @@ -87,10 +94,17 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM protected Type keyType; protected final OrmColumn mapKeyColumn; + protected OrmConverter mapKeyConverter; // map key converter - never null protected final OrmAttributeOverrideContainer mapKeyAttributeOverrideContainer; + protected static final OrmConverter.Adapter[] MAP_KEY_CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { + OrmMapKeyEnumeratedConverter2_0.Adapter.instance(), + OrmMapKeyTemporalConverter2_0.Adapter.instance() + }; + protected static final Iterable<OrmConverter.Adapter> MAP_KEY_CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(MAP_KEY_CONVERTER_ADAPTER_ARRAY); + protected AbstractOrmMultiRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) { super(parent, xmlMapping); this.orderable = this.buildOrderable(); @@ -103,6 +117,7 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass(); this.mapKeyColumn = this.buildMapKeyColumn(); + this.mapKeyConverter = this.buildMapKeyConverter(); this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer(); } @@ -122,6 +137,7 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass()); this.mapKeyColumn.synchronizeWithResourceModel(); + this.syncMapKeyConverter(); this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel(); } @@ -138,6 +154,7 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM this.setKeyType(this.buildKeyType()); this.mapKeyColumn.update(); + this.mapKeyConverter.update(); this.mapKeyAttributeOverrideContainer.update(); } @@ -507,6 +524,103 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM } + // ********** map key converter ********** + + public OrmConverter getMapKeyConverter() { + return this.mapKeyConverter; + } + + public void setMapKeyConverter(Class<? extends Converter> converterType) { + if (this.mapKeyConverter.getType() != converterType) { + // 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.initialize(); + } + } + + protected OrmConverter buildMapKeyConverter(OrmConverter.Adapter converterAdapter) { + return (converterAdapter != null) ? + converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) : + this.buildNullMapKeyConverter(); + } + + protected void setMapKeyConverter_(OrmConverter converter) { + Converter old = this.mapKeyConverter; + this.mapKeyConverter = converter; + this.firePropertyChanged(MAP_KEY_CONVERTER_PROPERTY, old, converter); + } + + protected void clearXmlMapKeyConverterValues() { + for (OrmConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + adapter.clearXmlValue(this.xmlAttributeMapping); + } + } + + protected OrmConverter buildMapKeyConverter() { + OrmXmlContextNodeFactory factory = this.getContextNodeFactory(); + for (OrmConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + OrmConverter ormConverter = adapter.buildConverter(this, factory); + if (ormConverter != null) { + return ormConverter; + } + } + return this.buildNullMapKeyConverter(); + } + + protected void syncMapKeyConverter() { + OrmConverter.Adapter adapter = this.getXmlMapKeyConverterAdapter(); + if (adapter == null) { + if (this.mapKeyConverter.getType() != null) { + this.setMapKeyConverter_(this.buildNullMapKeyConverter()); + } + } else { + if (this.mapKeyConverter.getType() == adapter.getConverterType()) { + this.mapKeyConverter.synchronizeWithResourceModel(); + } else { + this.setMapKeyConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory())); + } + } + } + + /** + * Return the first adapter whose converter value is set in the XML mapping. + * Return <code>null</code> if there are no converter values in the XML. + */ + protected OrmConverter.Adapter getXmlMapKeyConverterAdapter() { + for (OrmConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + if (adapter.isActive(this.xmlAttributeMapping)) { + return adapter; + } + } + return null; + } + + protected OrmConverter buildNullMapKeyConverter() { + return new NullOrmConverter(this); + } + + + // ********** map key converter adapters ********** + + /** + * Return the converter adapter for the specified converter type. + */ + protected OrmConverter.Adapter getMapKeyConverterAdapter(Class<? extends Converter> converterType) { + for (OrmConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + if (adapter.getConverterType() == converterType) { + return adapter; + } + } + return null; + } + + protected Iterable<OrmConverter.Adapter> getMapKeyConverterAdapters() { + return MAP_KEY_CONVERTER_ADAPTERS; + } + // ********** map key attribute override container ********** public OrmAttributeOverrideContainer getMapKeyAttributeOverrideContainer() { @@ -670,7 +784,7 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM } if (this.keyType == Type.BASIC_TYPE) { this.mapKeyColumn.validate(messages, reporter); - //validate map key converter + this.mapKeyConverter.validate(messages, reporter); } else if (this.keyType == Type.ENTITY_TYPE) { //validate map key join columns 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 d2c9d40b6b..b14ca1b221 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 @@ -60,7 +60,7 @@ public abstract class AbstractOrmVersionMapping<X extends XmlVersion> // the spec does not list Temporal explicitly, // but it is included in the orm.xml schema... protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { - OrmTemporalConverter.Adapter.instance(), + OrmTemporalConverter.BasicAdapter.instance(), }; protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java index 7f2099dbe4..76b818aa60 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java @@ -34,6 +34,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable; import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping; import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping; import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; +import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter; import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue; import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer; import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping; @@ -64,6 +65,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable; import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; import org.eclipse.jpt.jpa.core.context.orm.OrmTable; import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator; +import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping; import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint; import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping; @@ -374,16 +376,16 @@ public abstract class AbstractOrmXmlContextNodeFactory return new GenericOrmVirtualUniqueConstraint(parent, overriddenUniqueConstraint); } - public OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent) { - return new GenericOrmEnumeratedConverter(parent); + public OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent, OrmEnumeratedConverter.Owner owner) { + return new GenericOrmEnumeratedConverter(parent, owner); } - public OrmConverter buildOrmLobConverter(OrmAttributeMapping parent) { - return new GenericOrmLobConverter(parent); + public OrmConverter buildOrmLobConverter(OrmAttributeMapping parent, OrmConverter.Owner owner) { + return new GenericOrmLobConverter(parent, owner); } - public OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent) { - return new GenericOrmTemporalConverter(parent); + public OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent, OrmTemporalConverter.Owner owner) { + return new GenericOrmTemporalConverter(parent, owner); } public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTemporalConverterValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTemporalConverterValidator.java new file mode 100644 index 0000000000..4f5a65a4c5 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTemporalConverterValidator.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.internal.jpa1.context; + +import java.util.List; +import org.eclipse.jpt.common.utility.internal.ArrayTools; +import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.jpa.core.context.AttributeMapping; +import org.eclipse.jpt.jpa.core.context.PersistentAttribute; +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; +import org.eclipse.wst.validation.internal.provisional.core.IMessage; +import org.eclipse.wst.validation.internal.provisional.core.IReporter; + +public abstract class AbstractTemporalConverterValidator + implements JptValidator +{ + protected final TemporalConverter converter; + + protected final ConverterTextRangeResolver textRangeResolver; + + protected AbstractTemporalConverterValidator(TemporalConverter converter, ConverterTextRangeResolver textRangeResolver) { + super(); + this.converter = converter; + this.textRangeResolver = textRangeResolver; + } + + protected ConverterTextRangeResolver getTextRangeResolver() { + return this.textRangeResolver; + } + + protected AttributeMapping getAttributeMapping() { + return this.converter.getParent(); + } + + protected PersistentAttribute getPersistentAttribute() { + return this.getAttributeMapping().getPersistentAttribute(); + } + + public boolean validate(List<IMessage> messages, IReporter reporter) { + return this.validateAttributeTypeWithTemporal(messages); + } + + protected boolean validateAttributeTypeWithTemporal(List<IMessage> messages) { + String typeName = this.getTypeName(); + if (typeName == null) { + //validation for a null type name is handled elsewhere, no need to have a temporal validation error + return true; + } + if (!ArrayTools.contains(TemporalConverter.TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) { + messages.add(this.buildInvalidTemporalMappingTypeMessage()); + return false; + } + return true; + } + + protected abstract String getTypeName(); + + protected IMessage buildInvalidTemporalMappingTypeMessage() { + return this.getPersistentAttribute().isVirtual() ? + this.buildVirtualAttributeInvalidTemporalMappingTypeMessage() : + this.buildInvalidTemporalMappingTypeMessage_(); + } + + protected IMessage buildInvalidTemporalMappingTypeMessage_() { + return DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + this.getInvalidTemporalMappingType(), + StringTools.EMPTY_STRING_ARRAY, + this.converter, + this.getTextRangeResolver().getConverterTextRange() + ); + } + + protected abstract String getInvalidTemporalMappingType(); + + protected IMessage buildVirtualAttributeInvalidTemporalMappingTypeMessage() { + return DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + this.getVirtualAttributeInvalidTemporalMappingType(), + new String[] {this.getPersistentAttribute().getName()}, + this.converter, + this.getTextRangeResolver().getConverterTextRange() + ); + } + + protected abstract String getVirtualAttributeInvalidTemporalMappingType(); + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/ConverterTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/ConverterTextRangeResolver.java new file mode 100644 index 0000000000..793fd8dc46 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/ConverterTextRangeResolver.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.internal.jpa1.context; + +import org.eclipse.jpt.common.core.utility.TextRange; + +/** + * Interface to resolve text ranges on converters. + */ +public interface ConverterTextRangeResolver +{ + TextRange getConverterTextRange(); +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java index 3d3b4d36c5..413f615d76 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java @@ -9,20 +9,54 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; +import java.util.List; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; import org.eclipse.jpt.jpa.core.context.java.JavaConverter; import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.wst.validation.internal.provisional.core.IMessage; +import org.eclipse.wst.validation.internal.provisional.core.IReporter; public abstract class AbstractJavaConverter extends AbstractJavaJpaContextNode implements JavaConverter { - protected AbstractJavaConverter(JavaAttributeMapping parent) { + + protected final JavaConverter.Owner owner; + + protected AbstractJavaConverter(JavaAttributeMapping parent, JavaConverter.Owner owner) { super(parent); + this.owner = owner; + } + + + // ********** validation ********** + + @Override + public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { + super.validate(messages, reporter, astRoot); + this.owner.buildValidator(this, this.buildConverterTextRangeResolver(astRoot)).validate(messages, reporter); + } + + + protected ConverterTextRangeResolver buildConverterTextRangeResolver(final CompilationUnit astRoot) { + return new ConverterTextRangeResolver() { + public TextRange getConverterTextRange() { + return getValidationTextRange(astRoot); + } + }; + } + + public TextRange getValidationTextRange(CompilationUnit astRoot) { + TextRange textRange = this.getAnnotationTextRange(astRoot); + return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); + } + + protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { + return this.getConverterAnnotation().getTextRange(astRoot); } @@ -41,19 +75,6 @@ public abstract class AbstractJavaConverter return this.getAttributeMapping().getResourceAttribute(); } - public Annotation getConverterAnnotation() { - return this.getResourceAttribute().getAnnotation(this.getAnnotationName()); - } - - protected abstract String getAnnotationName(); - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); - } - - protected abstract TextRange getAnnotationTextRange(CompilationUnit astRoot); - public void dispose() { // NOP } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java index 47336cfb95..9b508435c9 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java @@ -9,12 +9,11 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.EnumType; import org.eclipse.jpt.jpa.core.context.EnumeratedConverter; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter; import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation; @@ -28,8 +27,8 @@ public class GenericJavaEnumeratedConverter protected EnumType defaultEnumType; - public GenericJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation enumeratedAnnotation) { - super(parent); + public GenericJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation enumeratedAnnotation, JavaConverter.Owner owner) { + super(parent, owner); this.enumeratedAnnotation = enumeratedAnnotation; this.specifiedEnumType = this.buildSpecifiedEnumType(); } @@ -96,16 +95,7 @@ public class GenericJavaEnumeratedConverter return EnumeratedConverter.class; } - @Override - protected String getAnnotationName() { - return EnumeratedAnnotation.ANNOTATION_NAME; - } - - - // ********** validation ********** - - @Override - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - return this.enumeratedAnnotation.getTextRange(astRoot); + public EnumeratedAnnotation getConverterAnnotation() { + return this.enumeratedAnnotation; } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java index e82aa65ea0..c5c1ff4e57 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java @@ -9,11 +9,10 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.LobConverter; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter; import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation; @@ -23,8 +22,8 @@ public class GenericJavaLobConverter { protected final LobAnnotation lobAnnotation; - public GenericJavaLobConverter(JavaAttributeMapping parent, LobAnnotation lobAnnotation) { - super(parent); + public GenericJavaLobConverter(JavaAttributeMapping parent, LobAnnotation lobAnnotation, JavaConverter.Owner owner) { + super(parent, owner); this.lobAnnotation = lobAnnotation; } @@ -35,16 +34,7 @@ public class GenericJavaLobConverter return LobConverter.class; } - @Override - protected String getAnnotationName() { - return LobAnnotation.ANNOTATION_NAME; - } - - - // ********** validation ********** - - @Override - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - return this.lobAnnotation.getTextRange(astRoot); + public LobAnnotation getConverterAnnotation() { + return this.lobAnnotation; } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java index 65bdbb041b..d605a76ba7 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java @@ -9,22 +9,13 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ArrayTools; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.TemporalConverter; import org.eclipse.jpt.jpa.core.context.TemporalType; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.AbstractJavaElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; public class GenericJavaTemporalConverter extends AbstractJavaConverter @@ -35,8 +26,8 @@ public class GenericJavaTemporalConverter protected TemporalType temporalType; - public GenericJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation temporalAnnotation) { - super(parent); + public GenericJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation temporalAnnotation, JavaConverter.Owner owner) { + super(parent, owner); this.temporalAnnotation = temporalAnnotation; this.temporalType = this.buildTemporalType(); } @@ -82,9 +73,8 @@ public class GenericJavaTemporalConverter return TemporalConverter.class; } - @Override - protected String getAnnotationName() { - return TemporalAnnotation.ANNOTATION_NAME; + public TemporalAnnotation getConverterAnnotation() { + return this.temporalAnnotation; } protected void removeTemporalAnnotationIfUnset() { @@ -92,49 +82,4 @@ public class GenericJavaTemporalConverter this.temporalAnnotation.removeAnnotation(); } } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateAttributeTypeWithTemporal(messages, astRoot); - } - - protected void validateAttributeTypeWithTemporal(List<IMessage> messages, CompilationUnit astRoot) { - if (this.getAttributeMapping().getKey() == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) { - String typeName = ((AbstractJavaElementCollectionMapping2_0) this.getAttributeMapping()).getFullyQualifiedTargetClass(); - if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - } else { - String typeName = this.getAttributeMapping().getPersistentAttribute().getTypeName(); - if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - - } - } - - @Override - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - return this.temporalAnnotation.getTextRange(astRoot); - } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/JavaElementCollectionTemporalConverterValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/JavaElementCollectionTemporalConverterValidator.java new file mode 100644 index 0000000000..c549461787 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/JavaElementCollectionTemporalConverterValidator.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.internal.jpa1.context.java; + +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; +import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0; + +public class JavaElementCollectionTemporalConverterValidator extends AbstractTemporalConverterValidator +{ + + public JavaElementCollectionTemporalConverterValidator(TemporalConverter converter, ConverterTextRangeResolver textRangeResolver) { + super(converter, textRangeResolver); + } + + @Override + protected JavaElementCollectionMapping2_0 getAttributeMapping() { + return (JavaElementCollectionMapping2_0) super.getAttributeMapping(); + } + @Override + protected String getTypeName() { + return this.getAttributeMapping().getFullyQualifiedTargetClass(); + } + + @Override + protected String getInvalidTemporalMappingType() { + return JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE; + } + + @Override + protected String getVirtualAttributeInvalidTemporalMappingType() { + return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE; + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/JavaTemporalConverterValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/JavaTemporalConverterValidator.java new file mode 100644 index 0000000000..8372c14220 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/JavaTemporalConverterValidator.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.internal.jpa1.context.java; + +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; + +public class JavaTemporalConverterValidator extends AbstractTemporalConverterValidator +{ + + public JavaTemporalConverterValidator(TemporalConverter converter, ConverterTextRangeResolver textRangeResolver) { + super(converter, textRangeResolver); + } + + @Override + protected String getTypeName() { + return this.getPersistentAttribute().getTypeName(); + } + + @Override + protected String getInvalidTemporalMappingType() { + return JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE; + } + + @Override + protected String getVirtualAttributeInvalidTemporalMappingType() { + return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE; + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java index 2968119981..d4457f3730 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java @@ -9,21 +9,30 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; +import java.util.List; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; +import org.eclipse.wst.validation.internal.provisional.core.IMessage; +import org.eclipse.wst.validation.internal.provisional.core.IReporter; public abstract class AbstractOrmConverter extends AbstractOrmXmlContextNode implements OrmConverter { - protected AbstractOrmConverter(OrmAttributeMapping parent) { + protected final OrmConverter.Owner owner; + + protected AbstractOrmConverter(OrmAttributeMapping parent, OrmConverter.Owner owner) { super(parent); + this.owner = owner; } + protected OrmConverter.Owner getOwner() { + return this.owner; + } // ********** misc ********** @@ -40,13 +49,23 @@ public abstract class AbstractOrmConverter return this.getAttributeMapping().getXmlAttributeMapping(); } - protected XmlConvertibleMapping getXmlConvertibleMapping() { - return (XmlConvertibleMapping) this.getXmlAttributeMapping(); - } - // ********** validation ********** + @Override + public void validate(List<IMessage> messages, IReporter reporter) { + super.validate(messages, reporter); + this.owner.buildValidator(this, this.buildConverterTextRangeResolver()).validate(messages, reporter); + } + + + protected ConverterTextRangeResolver buildConverterTextRangeResolver() { + return new ConverterTextRangeResolver() { + public TextRange getConverterTextRange() { + return getValidationTextRange(); + } + }; + } public TextRange getValidationTextRange() { TextRange textRange = this.getXmlValidationTextRange(); return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java index 06bfd06add..d55140872c 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java @@ -28,11 +28,16 @@ public class GenericOrmEnumeratedConverter protected EnumType defaultEnumType; - public GenericOrmEnumeratedConverter(OrmAttributeMapping parent) { - super(parent); + public GenericOrmEnumeratedConverter(OrmAttributeMapping parent, OrmEnumeratedConverter.Owner owner) { + super(parent, owner); this.specifiedEnumType = this.buildSpecifiedEnumType(); } + @Override + protected OrmEnumeratedConverter.Owner getOwner() { + return (OrmEnumeratedConverter.Owner) super.getOwner(); + } + // ********** synchronize/update ********** @@ -71,11 +76,11 @@ public class GenericOrmEnumeratedConverter } protected void setXmlEnumerated(EnumType enumType) { - this.getXmlConvertibleMapping().setEnumerated(EnumType.toOrmResourceModel(enumType)); + this.getOwner().setXmlEnumType(EnumType.toOrmResourceModel(enumType)); } protected EnumType buildSpecifiedEnumType() { - return EnumType.fromOrmResourceModel(this.getXmlConvertibleMapping().getEnumerated()); + return EnumType.fromOrmResourceModel(this.getOwner().getXmlEnumType()); } public EnumType getDefaultEnumType() { @@ -130,6 +135,6 @@ public class GenericOrmEnumeratedConverter @Override protected TextRange getXmlValidationTextRange() { - return this.getXmlConvertibleMapping().getEnumeratedTextRange(); + return this.getOwner().getEnumTextRange(); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java index 94c52ecc93..17bf750aa8 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java @@ -16,15 +16,21 @@ import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.LobConverter; import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; +import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter; +import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; import org.eclipse.text.edits.ReplaceEdit; public class GenericOrmLobConverter extends AbstractOrmConverter implements OrmLobConverter { - public GenericOrmLobConverter(OrmAttributeMapping parent) { - super(parent); + public GenericOrmLobConverter(OrmAttributeMapping parent, OrmConverter.Owner owner) { + super(parent, owner); + } + + protected XmlConvertibleMapping getXmlConvertibleMapping() { + return (XmlConvertibleMapping) this.getXmlAttributeMapping(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java index 138e39344f..2576d11b43 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java @@ -9,24 +9,16 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; -import java.util.List; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ArrayTools; import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.TemporalConverter; import org.eclipse.jpt.jpa.core.context.TemporalType; import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.AbstractOrmElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; public class GenericOrmTemporalConverter extends AbstractOrmConverter @@ -34,12 +26,16 @@ public class GenericOrmTemporalConverter { protected TemporalType temporalType; - - public GenericOrmTemporalConverter(OrmAttributeMapping parent) { - super(parent); + public GenericOrmTemporalConverter(OrmAttributeMapping parent, OrmTemporalConverter.Owner owner) { + super(parent, owner); this.temporalType = this.buildTemporalType(); } + @Override + protected OrmTemporalConverter.Owner getOwner() { + return (OrmTemporalConverter.Owner) super.getOwner(); + } + // ********** synchronize/update ********** @@ -68,11 +64,11 @@ public class GenericOrmTemporalConverter } protected void setXmlTemporal(TemporalType temporalType) { - this.getXmlConvertibleMapping().setTemporal(TemporalType.toOrmResourceModel(temporalType)); + this.getOwner().setXmlTemporalType(TemporalType.toOrmResourceModel(temporalType)); } protected TemporalType buildTemporalType() { - return TemporalType.fromOrmResourceModel(this.getXmlConvertibleMapping().getTemporal()); + return TemporalType.fromOrmResourceModel(this.getOwner().getXmlTemporalType()); } @@ -92,46 +88,8 @@ public class GenericOrmTemporalConverter // ********** validation ********** @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateAttributeTypeWithTemporal(messages); - } - - protected void validateAttributeTypeWithTemporal(List<IMessage> messages) { - if (this.getAttributeMapping().getKey() == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) { - @SuppressWarnings("rawtypes") - String typeName = ((AbstractOrmElementCollectionMapping2_0) this.getAttributeMapping()).getTargetClass(); - if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange() - ) - ); - } - } else { - String typeName = this.getAttributeMapping().getPersistentAttribute().getTypeName(); - if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange() - ) - ); - } - - } - } - - @Override protected TextRange getXmlValidationTextRange() { - return this.getXmlConvertibleMapping().getTemporalTextRange(); + return this.getOwner().getTemporalTextRange(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java index 9915124912..f92b9709e8 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java @@ -15,15 +15,23 @@ import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; +import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; +import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; import org.eclipse.text.edits.ReplaceEdit; public class NullOrmConverter - extends AbstractOrmConverter + extends AbstractOrmXmlContextNode + implements OrmConverter { public NullOrmConverter(OrmAttributeMapping parent) { super(parent); } + @Override + public OrmAttributeMapping getParent() { + return (OrmAttributeMapping) super.getParent(); + } + public void initialize() { // NOP } @@ -32,12 +40,10 @@ public class NullOrmConverter return null; } - @Override - protected TextRange getXmlValidationTextRange() { - return null; + public TextRange getValidationTextRange() { + return this.getParent().getValidationTextRange(); } - // ********** refactoring ********** public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java index 2f0edb9941..0681fc030a 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java @@ -92,6 +92,8 @@ import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContain import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapKeyEnumeratedConverter2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapKeyTemporalConverter2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; @@ -141,18 +143,26 @@ public abstract class AbstractJavaElementCollectionMapping2_0 protected String fullyQualifiedMapKeyClass; protected final JavaColumn mapKeyColumn; + protected JavaConverter mapKeyConverter; // map key converter - never null protected final JavaAttributeOverrideContainer mapKeyAttributeOverrideContainer; protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { JavaEnumeratedConverter.Adapter.instance(), - JavaTemporalConverter.Adapter.instance(), + JavaTemporalConverter.ElementCollectionAdapter.instance(), JavaLobConverter.Adapter.instance() }; protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); + protected static final JavaConverter.Adapter[] MAP_KEY_CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { + JavaMapKeyEnumeratedConverter2_0.Adapter.instance(), + JavaMapKeyTemporalConverter2_0.Adapter.instance() + }; + protected static final Iterable<JavaConverter.Adapter> MAP_KEY_CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(MAP_KEY_CONVERTER_ADAPTER_ARRAY); + + protected AbstractJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) { super(parent); this.specifiedTargetClass = this.buildSpecifiedTargetClass(); @@ -172,6 +182,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0 this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass(); this.mapKeyColumn = this.buildMapKeyColumn(); + this.mapKeyConverter = this.buildMapKeyConverter(); this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer(); } @@ -198,6 +209,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0 this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass()); this.mapKeyColumn.synchronizeWithResourceModel(); + this.syncMapKeyConverter(); this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel(); } @@ -223,6 +235,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0 this.setFullyQualifiedMapKeyClass(this.buildFullyQualifiedMapKeyClass()); this.mapKeyColumn.update(); + this.mapKeyConverter.update(); this.mapKeyAttributeOverrideContainer.update(); } @@ -903,6 +916,109 @@ public abstract class AbstractJavaElementCollectionMapping2_0 this.getResourceAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME); } + // ********** map key converter ********** + + public JavaConverter getMapKeyConverter() { + return this.mapKeyConverter; + } + + public void setMapKeyConverter(Class<? extends Converter> converterType) { + if (this.mapKeyConverter.getType() != converterType) { + this.mapKeyConverter.dispose(); + JavaConverter.Adapter converterAdapter = this.getMapKeyConverterAdapter(converterType); + this.retainMapKeyConverterAnnotation(converterAdapter); + this.setMapKeyConverter_(this.buildKeyConverter(converterAdapter)); + } + } + + protected JavaConverter buildKeyConverter(JavaConverter.Adapter converterAdapter) { + return (converterAdapter != null) ? + converterAdapter.buildNewConverter(this, this.getJpaFactory()) : + this.buildNullConverter(); + } + + protected void setMapKeyConverter_(JavaConverter keyConverter) { + Converter old = this.mapKeyConverter; + this.mapKeyConverter = keyConverter; + this.firePropertyChanged(MAP_KEY_CONVERTER_PROPERTY, old, keyConverter); + } + + /** + * Clear all the converter annotations <em>except</em> for the annotation + * corresponding to the specified adapter. If the specified adapter is + * <code>null</code>, remove <em>all</em> the converter annotations. + */ + protected void retainMapKeyConverterAnnotation(JavaConverter.Adapter converterAdapter) { + JavaResourceAttribute resourceAttribute = this.getResourceAttribute(); + for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + if (adapter != converterAdapter) { + adapter.removeConverterAnnotation(resourceAttribute); + } + } + } + + protected JavaConverter buildMapKeyConverter() { + JpaFactory jpaFactory = this.getJpaFactory(); + for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory); + if (javaConverter != null) { + return javaConverter; + } + } + return this.buildNullConverter(); + } + + protected void syncMapKeyConverter() { + Association<JavaConverter.Adapter, Annotation> assoc = this.getMapKeyConverterAnnotation(); + if (assoc == null) { + if (this.mapKeyConverter.getType() != null) { + this.setMapKeyConverter_(this.buildNullConverter()); + } + } else { + JavaConverter.Adapter adapter = assoc.getKey(); + Annotation annotation = assoc.getValue(); + if ((this.mapKeyConverter.getType() == adapter.getConverterType()) && + (this.mapKeyConverter.getConverterAnnotation() == annotation)) { + this.mapKeyConverter.synchronizeWithResourceModel(); + } else { + this.setMapKeyConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory())); + } + } + } + + /** + * Return the first converter annotation we find along with its corresponding + * adapter. Return <code>null</code> if there are no converter annotations. + */ + protected Association<JavaConverter.Adapter, Annotation> getMapKeyConverterAnnotation() { + JavaResourceAttribute resourceAttribute = this.getResourceAttribute(); + for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + Annotation annotation = adapter.getConverterAnnotation(resourceAttribute); + if (annotation != null) { + return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation); + } + } + return null; + } + + + // ********** map key converter adapters ********** + + /** + * Return the converter adapter for the specified converter type. + */ + protected JavaConverter.Adapter getMapKeyConverterAdapter(Class<? extends Converter> converterType) { + for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + if (adapter.getConverterType() == converterType) { + return adapter; + } + } + return null; + } + + protected Iterable<JavaConverter.Adapter> getMapKeyConverterAdapters() { + return MAP_KEY_CONVERTER_ADAPTERS; + } // ********** map key attribute override container ********** @@ -1295,7 +1411,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0 switch (this.keyType) { case BASIC_TYPE : this.mapKeyColumn.validate(messages, reporter, astRoot); - //validate map key converter + this.mapKeyConverter.validate(messages, reporter, astRoot); break; case ENTITY_TYPE : //validate map key join columns diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaMapKeyTemporalConverterValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaMapKeyTemporalConverterValidator.java new file mode 100644 index 0000000000..812a289d79 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaMapKeyTemporalConverterValidator.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.internal.jpa2.context.java; + +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; +import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0; + +public class JavaMapKeyTemporalConverterValidator extends AbstractTemporalConverterValidator +{ + + public JavaMapKeyTemporalConverterValidator(TemporalConverter converter, ConverterTextRangeResolver textRangeResolver) { + super(converter, textRangeResolver); + } + + @Override + protected JavaCollectionMapping2_0 getAttributeMapping() { + return (JavaCollectionMapping2_0) super.getAttributeMapping(); + } + + @Override + protected String getTypeName() { + return this.getAttributeMapping().getFullyQualifiedMapKeyClass(); + } + + @Override + protected String getInvalidTemporalMappingType() { + return JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAP_KEY_TYPE; + } + + @Override + protected String getVirtualAttributeInvalidTemporalMappingType() { + return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVALID_TEMPORAL_MAP_KEY_TYPE; + } + +} 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 33a3a8f69c..96bba9fbea 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 @@ -90,6 +90,8 @@ import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapKeyEnumeratedConverter2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapKeyTemporalConverter2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0; import org.eclipse.jpt.jpa.core.resource.orm.Attributes; @@ -139,17 +141,24 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen protected String defaultMapKeyClass; protected final OrmColumn mapKeyColumn; + protected OrmConverter mapKeyConverter; // map key converter - never null protected final OrmAttributeOverrideContainer mapKeyAttributeOverrideContainer; protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { OrmEnumeratedConverter.Adapter.instance(), - OrmTemporalConverter.Adapter.instance(), + OrmTemporalConverter.ElementCollectionAdapter.instance(), OrmLobConverter.Adapter.instance() }; protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); + protected static final OrmConverter.Adapter[] MAP_KEY_CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { + OrmMapKeyEnumeratedConverter2_0.Adapter.instance(), + OrmMapKeyTemporalConverter2_0.Adapter.instance() + }; + protected static final Iterable<OrmConverter.Adapter> MAP_KEY_CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(MAP_KEY_CONVERTER_ADAPTER_ARRAY); + protected AbstractOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, X xmlMapping) { super(parent, xmlMapping); @@ -170,6 +179,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass(); this.mapKeyColumn = this.buildMapKeyColumn(); + this.mapKeyConverter = this.buildMapKeyConverter(); this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer(); } @@ -196,6 +206,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass()); this.mapKeyColumn.synchronizeWithResourceModel(); + this.syncMapKeyConverter(); this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel(); } @@ -217,6 +228,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass()); this.mapKeyColumn.update(); + this.mapKeyConverter.update(); this.mapKeyAttributeOverrideContainer.update(); } @@ -837,6 +849,98 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen } + // ********** map key converter ********** + + public OrmConverter getMapKeyConverter() { + return this.mapKeyConverter; + } + + public void setMapKeyConverter(Class<? extends Converter> converterType) { + if (this.mapKeyConverter.getType() != converterType) { + // 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.initialize(); + } + } + + protected OrmConverter buildMapKeyConverter(OrmConverter.Adapter converterAdapter) { + return (converterAdapter != null) ? + converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) : + this.buildNullConverter(); + } + + protected void setMapKeyConverter_(OrmConverter converter) { + Converter old = this.mapKeyConverter; + this.mapKeyConverter = converter; + this.firePropertyChanged(MAP_KEY_CONVERTER_PROPERTY, old, converter); + } + + protected void clearXmlMapKeyConverterValues() { + for (OrmConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + adapter.clearXmlValue(this.xmlAttributeMapping); + } + } + + protected OrmConverter buildMapKeyConverter() { + OrmXmlContextNodeFactory factory = this.getContextNodeFactory(); + for (OrmConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + OrmConverter ormConverter = adapter.buildConverter(this, factory); + if (ormConverter != null) { + return ormConverter; + } + } + return this.buildNullConverter(); + } + + protected void syncMapKeyConverter() { + OrmConverter.Adapter adapter = this.getXmlMapKeyConverterAdapter(); + if (adapter == null) { + if (this.mapKeyConverter.getType() != null) { + this.setMapKeyConverter_(this.buildNullConverter()); + } + } else { + if (this.mapKeyConverter.getType() == adapter.getConverterType()) { + this.mapKeyConverter.synchronizeWithResourceModel(); + } else { + this.setMapKeyConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory())); + } + } + } + + /** + * Return the first adapter whose converter value is set in the XML mapping. + * Return <code>null</code> if there are no converter values in the XML. + */ + protected OrmConverter.Adapter getXmlMapKeyConverterAdapter() { + for (OrmConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + if (adapter.isActive(this.xmlAttributeMapping)) { + return adapter; + } + } + return null; + } + + // ********** map key converter adapters ********** + + /** + * Return the converter adapter for the specified converter type. + */ + protected OrmConverter.Adapter getMapKeyConverterAdapter(Class<? extends Converter> converterType) { + for (OrmConverter.Adapter adapter : this.getMapKeyConverterAdapters()) { + if (adapter.getConverterType() == converterType) { + return adapter; + } + } + return null; + } + + protected Iterable<OrmConverter.Adapter> getMapKeyConverterAdapters() { + return MAP_KEY_CONVERTER_ADAPTERS; + } + // ********** map key attribute override container ********** public OrmAttributeOverrideContainer getMapKeyAttributeOverrideContainer() { @@ -1276,7 +1380,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen switch (this.keyType) { case BASIC_TYPE : this.mapKeyColumn.validate(messages, reporter); - //validate map key converter + this.mapKeyConverter.validate(messages, reporter); break; case ENTITY_TYPE : //validate map key join columns diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionTemporalConverterValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionTemporalConverterValidator.java new file mode 100644 index 0000000000..b50545e150 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionTemporalConverterValidator.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.internal.jpa2.context.orm; + +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; +import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0; + +public class OrmElementCollectionTemporalConverterValidator extends AbstractTemporalConverterValidator +{ + + public OrmElementCollectionTemporalConverterValidator(TemporalConverter converter, ConverterTextRangeResolver textRangeResolver) { + super(converter, textRangeResolver); + } + + @Override + protected OrmElementCollectionMapping2_0 getAttributeMapping() { + return (OrmElementCollectionMapping2_0) super.getAttributeMapping(); + } + + @Override + protected String getTypeName() { + //no need to worry about the orm.xml package element because we are + //only looking for java.util classes, we don't need to append the package element + return this.getAttributeMapping().getTargetClass(); + } + + @Override + protected String getInvalidTemporalMappingType() { + return JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE; + } + + @Override + protected String getVirtualAttributeInvalidTemporalMappingType() { + throw new UnsupportedOperationException(); + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmMapKeyTemporalConverterValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmMapKeyTemporalConverterValidator.java new file mode 100644 index 0000000000..463ab8cbf9 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmMapKeyTemporalConverterValidator.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.internal.jpa2.context.orm; + +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; +import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionMapping2_0; + +public class OrmMapKeyTemporalConverterValidator extends AbstractTemporalConverterValidator +{ + + public OrmMapKeyTemporalConverterValidator(TemporalConverter converter, ConverterTextRangeResolver textRangeResolver) { + super(converter, textRangeResolver); + } + + @Override + protected OrmCollectionMapping2_0 getAttributeMapping() { + return (OrmCollectionMapping2_0) super.getAttributeMapping(); + } + + @Override + protected String getTypeName() { + //no need to worry about the orm.xml package element because we are + //only looking for java.util classes, we don't need to append the package element + return this.getAttributeMapping().getMapKeyClass(); + } + + @Override + protected String getInvalidTemporalMappingType() { + return JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAP_KEY_TYPE; + } + + @Override + protected String getVirtualAttributeInvalidTemporalMappingType() { + throw new UnsupportedOperationException(); + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmTemporalConverterValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmTemporalConverterValidator.java new file mode 100644 index 0000000000..9d7182cb28 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmTemporalConverterValidator.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.internal.jpa2.context.orm; + +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; + +public class OrmTemporalConverterValidator extends AbstractTemporalConverterValidator +{ + + public OrmTemporalConverterValidator(TemporalConverter converter, ConverterTextRangeResolver textRangeResolver) { + super(converter, textRangeResolver); + } + + @Override + protected String getTypeName() { + //no need to worry about the orm.xml package element because we are + //only looking for java.util classes, we don't need to append the package element + return this.getPersistentAttribute().getTypeName(); + } + + @Override + protected String getInvalidTemporalMappingType() { + return JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE; + } + + @Override + protected String getVirtualAttributeInvalidTemporalMappingType() { + throw new UnsupportedOperationException(); + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java index 3ae7907e20..4c142d722b 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java @@ -97,6 +97,7 @@ public interface JpaValidationMessages { public static final String MAPPING_UNRESOLVED_MAPPED_BY = "MAPPING_UNRESOLVED_MAPPED_BY"; public static final String ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED = "ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED"; public static final String PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE = "PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE"; + public static final String PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAP_KEY_TYPE = "PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAP_KEY_TYPE"; public static final String PERSISTENT_ATTRIBUTE_FINAL_FIELD = "PERSISTENT_ATTRIBUTE_FINAL_FIELD"; public static final String PERSISTENT_ATTRIBUTE_FINAL_GETTER = "PERSISTENT_ATTRIBUTE_FINAL_GETTER"; public static final String PERSISTENT_ATTRIBUTE_FINAL_SETTER = "PERSISTENT_ATTRIBUTE_FINAL_SETTER"; @@ -116,6 +117,10 @@ public interface JpaValidationMessages { public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED"; public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY"; public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED"; + public static final String VIRTUAL_ATTRIBUTE_INVALID_TEMPORAL_MAP_KEY_TYPE = "VIRTUAL_ATTRIBUTE_INVALID_TEMPORAL_MAP_KEY_TYPE"; + public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE"; + public static final String VIRTUAL_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE = "VIRTUAL_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE"; + //Table public static final String COLLECTION_TABLE_UNRESOLVED_CATALOG = "COLLECTION_TABLE_UNRESOLVED_CATALOG"; diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java index d2d53d61a1..3bfb15b12c 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 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. @@ -23,11 +23,11 @@ import org.eclipse.jpt.jpa.core.context.Column; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 2.3 + * @version 3.1 * @since 2.3 */ public interface CollectionMapping2_0 - extends CollectionMapping, AttributeMapping2_0 + extends CollectionMapping, AttributeMapping2_0, ConvertibleKeyMapping2_0 { // ********** map key class ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ConvertibleKeyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ConvertibleKeyMapping2_0.java new file mode 100644 index 0000000000..135aec4249 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ConvertibleKeyMapping2_0.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.jpa2.context; + +import org.eclipse.jpt.jpa.core.context.Converter; + +/** + * JPA attribute mapping that has a map key converter (JPA 2.0 collection mappings) + * <p> + * 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 3.1 + * @since 3.1 + */ +public interface ConvertibleKeyMapping2_0 + extends AttributeMapping2_0 +{ + /** + * Return the mapping's key converter. Never <code>null</code>. + */ + Converter getMapKeyConverter(); + String MAP_KEY_CONVERTER_PROPERTY = "mapKeyConverter"; //$NON-NLS-1$ + + /** + * Set the key converter type, adding the appropriate converter to the resource + * model and removing any other converters. Clear all converters if the + * specified type is <code>null</code>. + */ + void setMapKeyConverter(Class<? extends Converter> converterType); +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java index 1c62018f68..1cf70199b1 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 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. @@ -22,11 +22,11 @@ import org.eclipse.jpt.jpa.core.jpa2.context.CollectionMapping2_0; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 2.3 + * @version 3.1 * @since 2.3 */ public interface JavaCollectionMapping2_0 - extends CollectionMapping2_0, JavaCollectionMapping + extends CollectionMapping2_0, JavaCollectionMapping, JavaConvertibleKeyMapping2_0 { JavaAttributeOverrideContainer getMapKeyAttributeOverrideContainer(); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaConvertibleKeyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaConvertibleKeyMapping2_0.java new file mode 100644 index 0000000000..22d0047a30 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaConvertibleKeyMapping2_0.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.jpa2.context.java; + +import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; +import org.eclipse.jpt.jpa.core.jpa2.context.ConvertibleKeyMapping2_0; + +/** + * Java attribute mapping that has a key converter, collection mappings + * <p> + * 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. + */ +public interface JavaConvertibleKeyMapping2_0 + extends ConvertibleKeyMapping2_0, JavaAttributeMapping +{ + JavaConverter getMapKeyConverter(); +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapKeyEnumeratedConverter2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapKeyEnumeratedConverter2_0.java new file mode 100644 index 0000000000..7c5a24945e --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapKeyEnumeratedConverter2_0.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.jpa2.context.java; + +import org.eclipse.jpt.common.core.resource.java.Annotation; +import org.eclipse.jpt.jpa.core.JpaFactory; +import org.eclipse.jpt.jpa.core.context.Converter; +import org.eclipse.jpt.jpa.core.context.EnumeratedConverter; +import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; +import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; + +/** + * Java map key enumerated converter + * <p> + * 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. + */ +public interface JavaMapKeyEnumeratedConverter2_0 + extends EnumeratedConverter, JavaConverter +{ + // ********** adapter ********** + + public static class Adapter + extends JavaConverter.AbstractAdapter + { + private static final Adapter INSTANCE = new Adapter(); + public static Adapter instance() { + return INSTANCE; + } + + private Adapter() { + super(); + } + + public Class<? extends Converter> getConverterType() { + return EnumeratedConverter.class; + } + + @Override + protected String getAnnotationName() { + return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME; + } + + public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { + return factory.buildJavaEnumeratedConverter(parent, (MapKeyEnumerated2_0Annotation) converterAnnotation, this.buildOwner()); + } + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapKeyTemporalConverter2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapKeyTemporalConverter2_0.java new file mode 100644 index 0000000000..e88ee02f50 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapKeyTemporalConverter2_0.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.jpa2.context.java; + +import org.eclipse.jpt.common.core.resource.java.Annotation; +import org.eclipse.jpt.jpa.core.JpaFactory; +import org.eclipse.jpt.jpa.core.context.Converter; +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; +import org.eclipse.jpt.jpa.core.context.java.JavaConverter; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaMapKeyTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; + +/** + * Java map key temporal converter + * <p> + * 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. + */ +public interface JavaMapKeyTemporalConverter2_0 + extends TemporalConverter, JavaConverter +{ + // ********** adapter ********** + + public static class Adapter + extends JavaConverter.AbstractAdapter + { + private static final Adapter INSTANCE = new Adapter(); + public static Adapter instance() { + return INSTANCE; + } + + private Adapter() { + super(); + } + + public Class<? extends Converter> getConverterType() { + return TemporalConverter.class; + } + + @Override + protected String getAnnotationName() { + return MapKeyTemporal2_0Annotation.ANNOTATION_NAME; + } + + public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { + return factory.buildJavaTemporalConverter((JavaCollectionMapping2_0) parent, (MapKeyTemporal2_0Annotation) converterAnnotation, this.buildOwner()); + } + + @Override + protected Owner buildOwner() { + return new Owner() { + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return new JavaMapKeyTemporalConverterValidator((TemporalConverter) converter, textRangeResolver); + } + }; + } + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java index 6451a12115..6d48329dc0 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 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. @@ -26,7 +26,7 @@ import org.eclipse.jpt.jpa.core.jpa2.context.CollectionMapping2_0; * @since 2.3 */ public interface OrmCollectionMapping2_0 - extends CollectionMapping2_0, OrmCollectionMapping + extends CollectionMapping2_0, OrmCollectionMapping, OrmConvertibleKeyMapping2_0 { OrmAttributeOverrideContainer getMapKeyAttributeOverrideContainer(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmConvertibleKeyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmConvertibleKeyMapping2_0.java new file mode 100644 index 0000000000..a758fd8392 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmConvertibleKeyMapping2_0.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.jpa2.context.orm; + +import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; +import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; +import org.eclipse.jpt.jpa.core.jpa2.context.ConvertibleKeyMapping2_0; + +/** + * Java attribute mapping that has a key converter, collection mappings + * <p> + * 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. + */ +public interface OrmConvertibleKeyMapping2_0 + extends ConvertibleKeyMapping2_0, OrmAttributeMapping +{ + OrmConverter getMapKeyConverter(); +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapKeyEnumeratedConverter2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapKeyEnumeratedConverter2_0.java new file mode 100644 index 0000000000..933b9e0288 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapKeyEnumeratedConverter2_0.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.jpa2.context.orm; + +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.jpa.core.context.Converter; +import org.eclipse.jpt.jpa.core.context.EnumeratedConverter; +import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; +import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; +import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter; +import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.resource.orm.EnumType; +import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; +import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0; + +/** + * <code>orm.xml</code> enumerated converter + * <p> + * 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. + */ +public interface OrmMapKeyEnumeratedConverter2_0 + extends EnumeratedConverter, OrmConverter +{ + // ********** adapter ********** + + public static class Adapter + implements OrmConverter.Adapter + { + private static final Adapter INSTANCE = new Adapter(); + public static Adapter instance() { + return INSTANCE; + } + + private Adapter() { + super(); + } + + public Class<? extends Converter> getConverterType() { + return EnumeratedConverter.class; + } + + public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { + XmlMapKeyConvertibleMapping_2_0 xmlMapping = (XmlMapKeyConvertibleMapping_2_0) parent.getXmlAttributeMapping(); + return (xmlMapping.getMapKeyEnumerated() == null) ? null : factory.buildOrmEnumeratedConverter(parent, this.buildOwner(xmlMapping)); + } + + protected OrmEnumeratedConverter.Owner buildOwner(final XmlMapKeyConvertibleMapping_2_0 mapping) { + return new OrmEnumeratedConverter.Owner() { + public void setXmlEnumType(EnumType enumType) { + mapping.setMapKeyEnumerated(enumType); + } + + public EnumType getXmlEnumType() { + return mapping.getMapKeyEnumerated(); + } + + public TextRange getEnumTextRange() { + return mapping.getMapKeyEnumeratedTextRange(); + } + + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return JptValidator.Null.instance(); + } + }; + } + + public boolean isActive(XmlAttributeMapping xmlMapping) { + return ((XmlMapKeyConvertibleMapping_2_0) xmlMapping).getMapKeyEnumerated() != null; + } + + public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { + return factory.buildOrmEnumeratedConverter(parent, this.buildOwner((XmlMapKeyConvertibleMapping_2_0) parent.getXmlAttributeMapping())); + } + + public void clearXmlValue(XmlAttributeMapping xmlMapping) { + ((XmlMapKeyConvertibleMapping_2_0) xmlMapping).setMapKeyEnumerated(null); + } + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapKeyTemporalConverter2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapKeyTemporalConverter2_0.java new file mode 100644 index 0000000000..581de35a34 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapKeyTemporalConverter2_0.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.jpa2.context.orm; + +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.jpa.core.context.Converter; +import org.eclipse.jpt.jpa.core.context.TemporalConverter; +import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; +import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; +import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; +import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.OrmMapKeyTemporalConverterValidator; +import org.eclipse.jpt.jpa.core.resource.orm.TemporalType; +import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; +import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0; + +/** + * <code>orm.xml</code> temporal converter + * <p> + * 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. + */ +public interface OrmMapKeyTemporalConverter2_0 + extends OrmTemporalConverter +{ + + // ********** adapter ********** + + public static class Adapter + implements OrmConverter.Adapter + { + private static final Adapter INSTANCE = new Adapter(); + public static Adapter instance() { + return INSTANCE; + } + + private Adapter() { + super(); + } + + public Class<? extends Converter> getConverterType() { + return TemporalConverter.class; + } + + public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { + XmlMapKeyConvertibleMapping_2_0 xmlMapping = (XmlMapKeyConvertibleMapping_2_0) parent.getXmlAttributeMapping(); + return (xmlMapping.getMapKeyTemporal() == null) ? null : factory.buildOrmTemporalConverter(parent, this.buildOwner(xmlMapping)); + } + + protected OrmTemporalConverter.Owner buildOwner(final XmlMapKeyConvertibleMapping_2_0 mapping) { + return new OrmTemporalConverter.Owner() { + public void setXmlTemporalType(TemporalType temporalType) { + mapping.setMapKeyTemporal(temporalType); + } + + public TemporalType getXmlTemporalType() { + return mapping.getMapKeyTemporal(); + } + + public TextRange getTemporalTextRange() { + return mapping.getMapKeyTemporalTextRange(); + } + + public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { + return new OrmMapKeyTemporalConverterValidator((TemporalConverter) converter, textRangeResolver); + } + }; + } + + public boolean isActive(XmlAttributeMapping xmlMapping) { + return ((XmlMapKeyConvertibleMapping_2_0) xmlMapping).getMapKeyTemporal() != null; + } + + public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { + return factory.buildOrmTemporalConverter(parent, this.buildOwner((XmlMapKeyConvertibleMapping_2_0) parent.getXmlAttributeMapping())); + } + + public void clearXmlValue(XmlAttributeMapping xmlMapping) { + ((XmlMapKeyConvertibleMapping_2_0) xmlMapping).setMapKeyTemporal(null); + } + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java index 28c06421ef..1a0dd36d3a 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. + * Copyright (c) 2007, 2011 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. @@ -23,6 +23,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0; +import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0; import org.eclipse.text.edits.ReplaceEdit; @@ -117,15 +118,6 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel */ protected EList<XmlAttributeOverride> mapKeyAttributeOverrides; /** - * The cached value of the '{@link #getMapKeyClass() <em>Map Key Class</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMapKeyClass() - * @generated - * @ordered - */ - protected XmlClassReference mapKeyClass; - /** * 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 */ @@ -154,6 +146,15 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel */ protected EnumType mapKeyEnumerated = MAP_KEY_ENUMERATED_EDEFAULT; /** + * The cached value of the '{@link #getMapKeyClass() <em>Map Key Class</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMapKeyClass() + * @generated + * @ordered + */ + protected XmlClassReference mapKeyClass; + /** * The cached value of the '{@link #getMapKeyColumn() <em>Map Key Column</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -485,7 +486,7 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel * @return the value of the '<em>Map Key Temporal</em>' attribute. * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType * @see #setMapKeyTemporal(TemporalType) - * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMultiRelationshipMapping_2_0_MapKeyTemporal() + * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMapKeyConvertibleMapping_2_0_MapKeyTemporal() * @model * @generated */ @@ -523,7 +524,7 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel * @return the value of the '<em>Map Key Enumerated</em>' attribute. * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType * @see #setMapKeyEnumerated(EnumType) - * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated() + * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMapKeyConvertibleMapping_2_0_MapKeyEnumerated() * @model * @generated */ @@ -738,12 +739,12 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel return getOrderBy(); case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES: return getMapKeyAttributeOverrides(); - case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: - return getMapKeyClass(); case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL: return getMapKeyTemporal(); case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED: return getMapKeyEnumerated(); + case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: + return getMapKeyClass(); case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN: return getMapKeyColumn(); case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS: @@ -781,15 +782,15 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel getMapKeyAttributeOverrides().clear(); getMapKeyAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)newValue); return; - case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: - setMapKeyClass((XmlClassReference)newValue); - return; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL: setMapKeyTemporal((TemporalType)newValue); return; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED: setMapKeyEnumerated((EnumType)newValue); return; + case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: + setMapKeyClass((XmlClassReference)newValue); + return; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN: setMapKeyColumn((XmlColumn)newValue); return; @@ -829,15 +830,15 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES: getMapKeyAttributeOverrides().clear(); return; - case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: - setMapKeyClass((XmlClassReference)null); - return; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL: setMapKeyTemporal(MAP_KEY_TEMPORAL_EDEFAULT); return; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED: setMapKeyEnumerated(MAP_KEY_ENUMERATED_EDEFAULT); return; + case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: + setMapKeyClass((XmlClassReference)null); + return; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN: setMapKeyColumn((XmlColumn)null); return; @@ -871,12 +872,12 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel return ORDER_BY_EDEFAULT == null ? orderBy != null : !ORDER_BY_EDEFAULT.equals(orderBy); case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES: return mapKeyAttributeOverrides != null && !mapKeyAttributeOverrides.isEmpty(); - case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: - return mapKeyClass != null; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL: return mapKeyTemporal != MAP_KEY_TEMPORAL_EDEFAULT; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED: return mapKeyEnumerated != MAP_KEY_ENUMERATED_EDEFAULT; + case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: + return mapKeyClass != null; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN: return mapKeyColumn != null; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS: @@ -935,13 +936,20 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel default: return -1; } } + if (baseClass == XmlMapKeyConvertibleMapping_2_0.class) + { + switch (derivedFeatureID) + { + case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL: return OrmV2_0Package.XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_TEMPORAL; + case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED: return OrmV2_0Package.XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_ENUMERATED; + default: return -1; + } + } if (baseClass == XmlMultiRelationshipMapping_2_0.class) { switch (derivedFeatureID) { case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS; - case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL; - case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN; case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS; default: return -1; @@ -998,13 +1006,20 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel default: return -1; } } + if (baseClass == XmlMapKeyConvertibleMapping_2_0.class) + { + switch (baseFeatureID) + { + case OrmV2_0Package.XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_TEMPORAL: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL; + case OrmV2_0Package.XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_ENUMERATED: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED; + default: return -1; + } + } if (baseClass == XmlMultiRelationshipMapping_2_0.class) { switch (baseFeatureID) { case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS; - case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL; - case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED; case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN; case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS; default: return -1; @@ -1040,6 +1055,14 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel return getAttributeTextRange(JPA.MAPPED_BY); } + public TextRange getMapKeyEnumeratedTextRange() { + return getAttributeTextRange(JPA2_0.MAP_KEY_ENUMERATED); + } + + public TextRange getMapKeyTemporalTextRange() { + return getAttributeTextRange(JPA2_0.MAP_KEY_TEMPORAL); + } + // ********** refactoring ********** @@ -1063,11 +1086,11 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel } protected static Translator buildMapKeyTemporalTranslator() { - return new Translator(JPA2_0.MAP_KEY_TEMPORAL, OrmV2_0Package.eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyTemporal()); + return new Translator(JPA2_0.MAP_KEY_TEMPORAL, OrmV2_0Package.eINSTANCE.getXmlMapKeyConvertibleMapping_2_0_MapKeyTemporal()); } protected static Translator buildMapKeyEnumeratedTranslator() { - return new Translator(JPA2_0.MAP_KEY_ENUMERATED, OrmV2_0Package.eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated()); + return new Translator(JPA2_0.MAP_KEY_ENUMERATED, OrmV2_0Package.eINSTANCE.getXmlMapKeyConvertibleMapping_2_0_MapKeyEnumerated()); } protected static Translator buildMapKeyClassTranslator() { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java index 8f62fbc828..9f4f300571 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java @@ -558,31 +558,31 @@ public class OrmPackage extends EPackageImpl public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4; /** - * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5; + public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5; /** - * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 6; + public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 6; /** - * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 7; + public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 7; /** * The feature id for the '<em><b>Map Key Column</b></em>' containment reference. @@ -1911,58 +1911,58 @@ public class OrmPackage extends EPackageImpl public static final int XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7; /** - * The feature id for the '<em><b>Target Class</b></em>' attribute. + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION__TARGET_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 8; + public static final int XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 8; /** - * The feature id for the '<em><b>Fetch</b></em>' attribute. + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION__FETCH = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 9; + public static final int XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 9; /** - * The feature id for the '<em><b>Map Key</b></em>' containment reference. + * The feature id for the '<em><b>Target Class</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION__MAP_KEY = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10; + public static final int XML_ELEMENT_COLLECTION__TARGET_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10; /** - * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. + * The feature id for the '<em><b>Fetch</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION__MAP_KEY_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 11; + public static final int XML_ELEMENT_COLLECTION__FETCH = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 11; /** - * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * The feature id for the '<em><b>Map Key</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 12; + public static final int XML_ELEMENT_COLLECTION__MAP_KEY = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 12; /** - * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 13; + public static final int XML_ELEMENT_COLLECTION__MAP_KEY_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 13; /** * The feature id for the '<em><b>Map Key Column</b></em>' containment reference. @@ -3820,31 +3820,31 @@ public class OrmPackage extends EPackageImpl public static final int XML_MANY_TO_MANY__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES; /** - * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MANY_TO_MANY__MAP_KEY_CLASS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS; + public static final int XML_MANY_TO_MANY__MAP_KEY_TEMPORAL = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL; /** - * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MANY_TO_MANY__MAP_KEY_TEMPORAL = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL; + public static final int XML_MANY_TO_MANY__MAP_KEY_ENUMERATED = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED; /** - * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MANY_TO_MANY__MAP_KEY_ENUMERATED = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED; + public static final int XML_MANY_TO_MANY__MAP_KEY_CLASS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS; /** * The feature id for the '<em><b>Map Key Column</b></em>' containment reference. @@ -4387,31 +4387,31 @@ public class OrmPackage extends EPackageImpl public static final int XML_ONE_TO_MANY__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES; /** - * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ONE_TO_MANY__MAP_KEY_CLASS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS; + public static final int XML_ONE_TO_MANY__MAP_KEY_TEMPORAL = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL; /** - * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ONE_TO_MANY__MAP_KEY_TEMPORAL = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL; + public static final int XML_ONE_TO_MANY__MAP_KEY_ENUMERATED = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED; /** - * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ONE_TO_MANY__MAP_KEY_ENUMERATED = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED; + public static final int XML_ONE_TO_MANY__MAP_KEY_CLASS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS; /** * The feature id for the '<em><b>Map Key Column</b></em>' containment reference. diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java index ad33f6c53b..fabebea4a4 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. + * Copyright (c) 2009, 2011 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 @@ -30,6 +30,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0; +import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0; import org.eclipse.text.edits.ReplaceEdit; import org.eclipse.wst.common.internal.emf.resource.Translator; @@ -159,92 +160,92 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements protected EList<XmlAttributeOverride> mapKeyAttributeOverrides; /** - * The default value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTargetClass() - * @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 static final String TARGET_CLASS_EDEFAULT = null; + protected static final TemporalType MAP_KEY_TEMPORAL_EDEFAULT = null; /** - * The cached value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute. + * The cached value of the '{@link #getMapKeyTemporal() <em>Map Key Temporal</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getTargetClass() + * @see #getMapKeyTemporal() * @generated * @ordered */ - protected String targetClass = TARGET_CLASS_EDEFAULT; + protected TemporalType mapKeyTemporal = MAP_KEY_TEMPORAL_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 FetchType FETCH_EDEFAULT = null; + protected static final EnumType MAP_KEY_ENUMERATED_EDEFAULT = null; /** - * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute. + * The cached value of the '{@link #getMapKeyEnumerated() <em>Map Key Enumerated</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getFetch() + * @see #getMapKeyEnumerated() * @generated * @ordered */ - protected FetchType fetch = FETCH_EDEFAULT; + protected EnumType mapKeyEnumerated = MAP_KEY_ENUMERATED_EDEFAULT; /** - * The cached value of the '{@link #getMapKey() <em>Map Key</em>}' containment reference. + * The default value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getMapKey() + * @see #getTargetClass() * @generated * @ordered */ - protected MapKey mapKey; + protected static final String TARGET_CLASS_EDEFAULT = null; /** - * The cached value of the '{@link #getMapKeyClass() <em>Map Key Class</em>}' containment reference. + * The cached value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getMapKeyClass() + * @see #getTargetClass() * @generated * @ordered */ - protected XmlClassReference mapKeyClass; + protected String targetClass = TARGET_CLASS_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 MAP_KEY_TEMPORAL_EDEFAULT = null; + protected static final FetchType FETCH_EDEFAULT = null; /** - * The cached value of the '{@link #getMapKeyTemporal() <em>Map Key Temporal</em>}' attribute. + * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getMapKeyTemporal() + * @see #getFetch() * @generated * @ordered */ - protected TemporalType mapKeyTemporal = MAP_KEY_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 cached value of the '{@link #getMapKey() <em>Map Key</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMapKey() + * @generated + * @ordered */ - protected static final EnumType MAP_KEY_ENUMERATED_EDEFAULT = null; + protected MapKey mapKey; /** - * The cached value of the '{@link #getMapKeyEnumerated() <em>Map Key Enumerated</em>}' attribute. + * The cached value of the '{@link #getMapKeyClass() <em>Map Key Class</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getMapKeyEnumerated() + * @see #getMapKeyClass() * @generated * @ordered */ - protected EnumType mapKeyEnumerated = MAP_KEY_ENUMERATED_EDEFAULT; + protected XmlClassReference mapKeyClass; /** * The cached value of the '{@link #getMapKeyColumn() <em>Map Key Column</em>}' containment reference. @@ -787,7 +788,7 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements * @return the value of the '<em>Map Key Temporal</em>' attribute. * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType * @see #setMapKeyTemporal(TemporalType) - * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_MapKeyTemporal() + * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMapKeyConvertibleMapping_2_0_MapKeyTemporal() * @model * @generated */ @@ -825,7 +826,7 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements * @return the value of the '<em>Map Key Enumerated</em>' attribute. * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType * @see #setMapKeyEnumerated(EnumType) - * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_MapKeyEnumerated() + * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMapKeyConvertibleMapping_2_0_MapKeyEnumerated() * @model * @generated */ @@ -1114,6 +1115,10 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements return getAssociationOverrides(); case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES: return getMapKeyAttributeOverrides(); + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: + return getMapKeyTemporal(); + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: + return getMapKeyEnumerated(); case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS: return getTargetClass(); case OrmPackage.XML_ELEMENT_COLLECTION__FETCH: @@ -1122,10 +1127,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements return getMapKey(); case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS: return getMapKeyClass(); - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: - return getMapKeyTemporal(); - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: - return getMapKeyEnumerated(); case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN: return getMapKeyColumn(); case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS: @@ -1176,6 +1177,12 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements getMapKeyAttributeOverrides().clear(); getMapKeyAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)newValue); return; + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: + setMapKeyTemporal((TemporalType)newValue); + return; + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: + setMapKeyEnumerated((EnumType)newValue); + return; case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS: setTargetClass((String)newValue); return; @@ -1188,12 +1195,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS: setMapKeyClass((XmlClassReference)newValue); return; - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: - setMapKeyTemporal((TemporalType)newValue); - return; - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: - setMapKeyEnumerated((EnumType)newValue); - return; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN: setMapKeyColumn((XmlColumn)newValue); return; @@ -1245,6 +1246,12 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES: getMapKeyAttributeOverrides().clear(); return; + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: + setMapKeyTemporal(MAP_KEY_TEMPORAL_EDEFAULT); + return; + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: + setMapKeyEnumerated(MAP_KEY_ENUMERATED_EDEFAULT); + return; case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS: setTargetClass(TARGET_CLASS_EDEFAULT); return; @@ -1257,12 +1264,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS: setMapKeyClass((XmlClassReference)null); return; - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: - setMapKeyTemporal(MAP_KEY_TEMPORAL_EDEFAULT); - return; - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: - setMapKeyEnumerated(MAP_KEY_ENUMERATED_EDEFAULT); - return; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN: setMapKeyColumn((XmlColumn)null); return; @@ -1305,6 +1306,10 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements return associationOverrides != null && !associationOverrides.isEmpty(); case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES: return mapKeyAttributeOverrides != null && !mapKeyAttributeOverrides.isEmpty(); + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: + return mapKeyTemporal != MAP_KEY_TEMPORAL_EDEFAULT; + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: + return mapKeyEnumerated != MAP_KEY_ENUMERATED_EDEFAULT; case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS: return TARGET_CLASS_EDEFAULT == null ? targetClass != null : !TARGET_CLASS_EDEFAULT.equals(targetClass); case OrmPackage.XML_ELEMENT_COLLECTION__FETCH: @@ -1313,10 +1318,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements return mapKey != null; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS: return mapKeyClass != null; - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: - return mapKeyTemporal != MAP_KEY_TEMPORAL_EDEFAULT; - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: - return mapKeyEnumerated != MAP_KEY_ENUMERATED_EDEFAULT; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN: return mapKeyColumn != null; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS: @@ -1387,6 +1388,15 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements default: return -1; } } + if (baseClass == XmlMapKeyConvertibleMapping_2_0.class) + { + switch (derivedFeatureID) + { + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: return OrmV2_0Package.XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_TEMPORAL; + case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: return OrmV2_0Package.XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_ENUMERATED; + default: return -1; + } + } if (baseClass == XmlElementCollection_2_0.class) { switch (derivedFeatureID) @@ -1395,8 +1405,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements case OrmPackage.XML_ELEMENT_COLLECTION__FETCH: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__FETCH; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS; - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL; - case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN; case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS; case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__COLUMN; @@ -1465,6 +1473,15 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements default: return -1; } } + if (baseClass == XmlMapKeyConvertibleMapping_2_0.class) + { + switch (baseFeatureID) + { + case OrmV2_0Package.XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_TEMPORAL: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL; + case OrmV2_0Package.XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_ENUMERATED: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED; + default: return -1; + } + } if (baseClass == XmlElementCollection_2_0.class) { switch (baseFeatureID) @@ -1473,8 +1490,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__FETCH: return OrmPackage.XML_ELEMENT_COLLECTION__FETCH; case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY; case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS; - case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL; - case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED; case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN; case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS; case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__COLUMN: return OrmPackage.XML_ELEMENT_COLLECTION__COLUMN; @@ -1504,14 +1519,14 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements result.append(enumerated); result.append(", orderBy: "); result.append(orderBy); - result.append(", targetClass: "); - result.append(targetClass); - result.append(", fetch: "); - result.append(fetch); result.append(", mapKeyTemporal: "); result.append(mapKeyTemporal); result.append(", mapKeyEnumerated: "); result.append(mapKeyEnumerated); + result.append(", targetClass: "); + result.append(targetClass); + result.append(", fetch: "); + result.append(fetch); result.append(')'); return result.toString(); } @@ -1541,6 +1556,14 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements public TextRange getTargetClassTextRange() { return getAttributeTextRange(JPA2_0.TARGET_CLASS); } + + public TextRange getMapKeyEnumeratedTextRange() { + return getAttributeTextRange(JPA2_0.MAP_KEY_ENUMERATED); + } + + public TextRange getMapKeyTemporalTextRange() { + return getAttributeTextRange(JPA2_0.MAP_KEY_TEMPORAL); + } // **************** translators ******************************************* @@ -1614,11 +1637,11 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements } protected static Translator buildMapKeyTemporalTranslator() { - return new Translator(JPA2_0.MAP_KEY_TEMPORAL, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKeyTemporal()); + return new Translator(JPA2_0.MAP_KEY_TEMPORAL, OrmV2_0Package.eINSTANCE.getXmlMapKeyConvertibleMapping_2_0_MapKeyTemporal()); } protected static Translator buildMapKeyEnumeratedTranslator() { - return new Translator(JPA2_0.MAP_KEY_ENUMERATED, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKeyEnumerated()); + return new Translator(JPA2_0.MAP_KEY_ENUMERATED, OrmV2_0Package.eINSTANCE.getXmlMapKeyConvertibleMapping_2_0_MapKeyEnumerated()); } protected static Translator buildAttributeOverrideTranslator() { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java index de0d4b3a0e..73829aed1a 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. + * Copyright (c) 2009, 2011 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. @@ -406,58 +406,58 @@ public class OrmV2_0Package extends EPackageImpl public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_ATTRIBUTE_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 4; /** - * The feature id for the '<em><b>Target Class</b></em>' attribute. + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION_20__TARGET_CLASS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 5; + public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 5; /** - * The feature id for the '<em><b>Fetch</b></em>' attribute. + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION_20__FETCH = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 6; + public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 6; /** - * The feature id for the '<em><b>Map Key</b></em>' containment reference. + * The feature id for the '<em><b>Target Class</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 7; + public static final int XML_ELEMENT_COLLECTION_20__TARGET_CLASS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 7; /** - * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. + * The feature id for the '<em><b>Fetch</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 8; + public static final int XML_ELEMENT_COLLECTION_20__FETCH = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 8; /** - * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * The feature id for the '<em><b>Map Key</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 9; + public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 9; /** - * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 10; + public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 10; /** * The feature id for the '<em><b>Map Key Column</b></em>' containment reference. @@ -642,7 +642,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderable_2_0() * @generated */ - public static final int XML_ORDERABLE_20 = 21; + public static final int XML_ORDERABLE_20 = 22; /** * The feature id for the '<em><b>Order Column</b></em>' containment reference. @@ -670,7 +670,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0() * @generated */ - public static final int XML_MULTI_RELATIONSHIP_MAPPING_20 = 17; + public static final int XML_MULTI_RELATIONSHIP_MAPPING_20 = 18; /** * The feature id for the '<em><b>Order Column</b></em>' containment reference. @@ -691,31 +691,31 @@ public class OrmV2_0Package extends EPackageImpl public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ATTRIBUTE_OVERRIDES = XML_ORDERABLE_20_FEATURE_COUNT + 0; /** - * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS = XML_ORDERABLE_20_FEATURE_COUNT + 1; + public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL = XML_ORDERABLE_20_FEATURE_COUNT + 1; /** - * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL = XML_ORDERABLE_20_FEATURE_COUNT + 2; + public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED = XML_ORDERABLE_20_FEATURE_COUNT + 2; /** - * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED = XML_ORDERABLE_20_FEATURE_COUNT + 3; + public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS = XML_ORDERABLE_20_FEATURE_COUNT + 3; /** * The feature id for the '<em><b>Map Key Column</b></em>' containment reference. @@ -773,31 +773,31 @@ public class OrmV2_0Package extends EPackageImpl public static final int XML_MANY_TO_MANY_20__MAP_KEY_ATTRIBUTE_OVERRIDES = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ATTRIBUTE_OVERRIDES; /** - * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MANY_TO_MANY_20__MAP_KEY_CLASS = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS; + public static final int XML_MANY_TO_MANY_20__MAP_KEY_TEMPORAL = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL; /** - * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MANY_TO_MANY_20__MAP_KEY_TEMPORAL = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL; + public static final int XML_MANY_TO_MANY_20__MAP_KEY_ENUMERATED = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED; /** - * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MANY_TO_MANY_20__MAP_KEY_ENUMERATED = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED; + public static final int XML_MANY_TO_MANY_20__MAP_KEY_CLASS = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS; /** * The feature id for the '<em><b>Map Key Column</b></em>' containment reference. @@ -855,6 +855,43 @@ public class OrmV2_0Package extends EPackageImpl public static final int XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20_FEATURE_COUNT = 1; /** + * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0 <em>Xml Map Key Convertible Mapping 20</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0 + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyConvertibleMapping_2_0() + * @generated + */ + public static final int XML_MAP_KEY_CONVERTIBLE_MAPPING_20 = 16; + + /** + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_TEMPORAL = 0; + + /** + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_ENUMERATED = 1; + + /** + * The number of structural features of the '<em>Xml Map Key Convertible Mapping 20</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_MAP_KEY_CONVERTIBLE_MAPPING_20_FEATURE_COUNT = 2; + + /** * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 <em>Xml Maps Id 20</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -862,7 +899,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapsId_2_0() * @generated */ - public static final int XML_MAPS_ID_20 = 16; + public static final int XML_MAPS_ID_20 = 17; /** * The feature id for the '<em><b>Maps Id</b></em>' attribute. @@ -890,7 +927,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlNamedQuery_2_0() * @generated */ - public static final int XML_NAMED_QUERY_20 = 18; + public static final int XML_NAMED_QUERY_20 = 19; /** * The feature id for the '<em><b>Lock Mode</b></em>' attribute. @@ -918,7 +955,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrphanRemovable_2_0() * @generated */ - public static final int XML_ORPHAN_REMOVABLE_20 = 23; + public static final int XML_ORPHAN_REMOVABLE_20 = 24; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToMany_2_0 <em>Xml One To Many 20</em>}' class. @@ -928,7 +965,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOneToMany_2_0() * @generated */ - public static final int XML_ONE_TO_MANY_20 = 19; + public static final int XML_ONE_TO_MANY_20 = 20; /** * The feature id for the '<em><b>Order Column</b></em>' containment reference. @@ -949,31 +986,31 @@ public class OrmV2_0Package extends EPackageImpl public static final int XML_ONE_TO_MANY_20__MAP_KEY_ATTRIBUTE_OVERRIDES = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ATTRIBUTE_OVERRIDES; /** - * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. + * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ONE_TO_MANY_20__MAP_KEY_CLASS = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS; + public static final int XML_ONE_TO_MANY_20__MAP_KEY_TEMPORAL = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL; /** - * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute. + * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ONE_TO_MANY_20__MAP_KEY_TEMPORAL = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL; + public static final int XML_ONE_TO_MANY_20__MAP_KEY_ENUMERATED = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED; /** - * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute. + * The feature id for the '<em><b>Map Key Class</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_ONE_TO_MANY_20__MAP_KEY_ENUMERATED = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED; + public static final int XML_ONE_TO_MANY_20__MAP_KEY_CLASS = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS; /** * The feature id for the '<em><b>Map Key Column</b></em>' containment reference. @@ -1019,7 +1056,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSingleRelationshipMapping_2_0() * @generated */ - public static final int XML_SINGLE_RELATIONSHIP_MAPPING_20 = 29; + public static final int XML_SINGLE_RELATIONSHIP_MAPPING_20 = 30; /** * The feature id for the '<em><b>Id</b></em>' attribute. @@ -1056,7 +1093,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOneToOne_2_0() * @generated */ - public static final int XML_ONE_TO_ONE_20 = 20; + public static final int XML_ONE_TO_ONE_20 = 21; /** * The feature id for the '<em><b>Id</b></em>' attribute. @@ -1102,7 +1139,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderColumn_2_0() * @generated */ - public static final int XML_ORDER_COLUMN_20 = 22; + public static final int XML_ORDER_COLUMN_20 = 23; /** * The feature id for the '<em><b>Nullable</b></em>' attribute. @@ -1148,7 +1185,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitDefaults_2_0() * @generated */ - public static final int XML_PERSISTENCE_UNIT_DEFAULTS_20 = 24; + public static final int XML_PERSISTENCE_UNIT_DEFAULTS_20 = 25; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0 <em>Xml Persistence Unit Metadata 20</em>}' class. @@ -1158,7 +1195,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitMetadata_2_0() * @generated */ - public static final int XML_PERSISTENCE_UNIT_METADATA_20 = 25; + public static final int XML_PERSISTENCE_UNIT_METADATA_20 = 26; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0 <em>Xml Query 20</em>}' class. @@ -1168,7 +1205,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQuery_2_0() * @generated */ - public static final int XML_QUERY_20 = 26; + public static final int XML_QUERY_20 = 27; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0 <em>Xml Query Hint 20</em>}' class. @@ -1178,7 +1215,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQueryHint_2_0() * @generated */ - public static final int XML_QUERY_HINT_20 = 27; + public static final int XML_QUERY_HINT_20 = 28; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0 <em>Xml Sequence Generator 20</em>}' class. @@ -1188,7 +1225,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSequenceGenerator_2_0() * @generated */ - public static final int XML_SEQUENCE_GENERATOR_20 = 28; + public static final int XML_SEQUENCE_GENERATOR_20 = 29; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0 <em>Xml Sql Result Set Mapping 20</em>}' class. @@ -1198,7 +1235,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSqlResultSetMapping_2_0() * @generated */ - public static final int XML_SQL_RESULT_SET_MAPPING_20 = 30; + public static final int XML_SQL_RESULT_SET_MAPPING_20 = 31; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0 <em>Xml Unique Constraint 20</em>}' class. @@ -1208,7 +1245,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlUniqueConstraint_2_0() * @generated */ - public static final int XML_UNIQUE_CONSTRAINT_20 = 31; + public static final int XML_UNIQUE_CONSTRAINT_20 = 32; /** * The feature id for the '<em><b>Orphan Removal</b></em>' attribute. @@ -1380,7 +1417,7 @@ public class OrmV2_0Package extends EPackageImpl * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getLockModeType_2_0() * @generated */ - public static final int LOCK_MODE_TYPE_20 = 32; + public static final int LOCK_MODE_TYPE_20 = 33; /** * <!-- begin-user-doc --> @@ -1485,6 +1522,13 @@ public class OrmV2_0Package extends EPackageImpl * <!-- end-user-doc --> * @generated */ + private EClass xmlMapKeyConvertibleMapping_2_0EClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ private EClass xmlMapsId_2_0EClass = null; /** @@ -1929,36 +1973,6 @@ public class OrmV2_0Package extends EPackageImpl /** - * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Map Key Temporal</em>'. - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyTemporal() - * @see #getXmlElementCollection_2_0() - * @generated - */ - public EAttribute getXmlElementCollection_2_0_MapKeyTemporal() - { - return (EAttribute)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(4); - } - - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Map Key Enumerated</em>'. - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyEnumerated() - * @see #getXmlElementCollection_2_0() - * @generated - */ - public EAttribute getXmlElementCollection_2_0_MapKeyEnumerated() - { - return (EAttribute)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(5); - } - - - /** * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyColumn <em>Map Key Column</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1969,7 +1983,7 @@ public class OrmV2_0Package extends EPackageImpl */ public EReference getXmlElementCollection_2_0_MapKeyColumn() { - return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(6); + return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(4); } @@ -1984,7 +1998,7 @@ public class OrmV2_0Package extends EPackageImpl */ public EReference getXmlElementCollection_2_0_MapKeyJoinColumns() { - return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(7); + return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(5); } @@ -1999,7 +2013,7 @@ public class OrmV2_0Package extends EPackageImpl */ public EReference getXmlElementCollection_2_0_Column() { - return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(8); + return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(6); } @@ -2014,7 +2028,7 @@ public class OrmV2_0Package extends EPackageImpl */ public EReference getXmlElementCollection_2_0_CollectionTable() { - return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(9); + return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(7); } @@ -2177,6 +2191,50 @@ public class OrmV2_0Package extends EPackageImpl /** + * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0 <em>Xml Map Key Convertible Mapping 20</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Xml Map Key Convertible Mapping 20</em>'. + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0 + * @generated + */ + public EClass getXmlMapKeyConvertibleMapping_2_0() + { + return xmlMapKeyConvertibleMapping_2_0EClass; + } + + + /** + * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Map Key Temporal</em>'. + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0#getMapKeyTemporal() + * @see #getXmlMapKeyConvertibleMapping_2_0() + * @generated + */ + public EAttribute getXmlMapKeyConvertibleMapping_2_0_MapKeyTemporal() + { + return (EAttribute)xmlMapKeyConvertibleMapping_2_0EClass.getEStructuralFeatures().get(0); + } + + + /** + * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Map Key Enumerated</em>'. + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0#getMapKeyEnumerated() + * @see #getXmlMapKeyConvertibleMapping_2_0() + * @generated + */ + public EAttribute getXmlMapKeyConvertibleMapping_2_0_MapKeyEnumerated() + { + return (EAttribute)xmlMapKeyConvertibleMapping_2_0EClass.getEStructuralFeatures().get(1); + } + + + /** * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 <em>Xml Maps Id 20</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -2235,36 +2293,6 @@ public class OrmV2_0Package extends EPackageImpl /** - * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Map Key Temporal</em>'. - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyTemporal() - * @see #getXmlMultiRelationshipMapping_2_0() - * @generated - */ - public EAttribute getXmlMultiRelationshipMapping_2_0_MapKeyTemporal() - { - return (EAttribute)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(1); - } - - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Map Key Enumerated</em>'. - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyEnumerated() - * @see #getXmlMultiRelationshipMapping_2_0() - * @generated - */ - public EAttribute getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated() - { - return (EAttribute)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(2); - } - - - /** * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyColumn <em>Map Key Column</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -2275,7 +2303,7 @@ public class OrmV2_0Package extends EPackageImpl */ public EReference getXmlMultiRelationshipMapping_2_0_MapKeyColumn() { - return (EReference)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(3); + return (EReference)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(1); } @@ -2290,7 +2318,7 @@ public class OrmV2_0Package extends EPackageImpl */ public EReference getXmlMultiRelationshipMapping_2_0_MapKeyJoinColumns() { - return (EReference)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(4); + return (EReference)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(2); } @@ -2845,8 +2873,6 @@ public class OrmV2_0Package extends EPackageImpl createEAttribute(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__FETCH); createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY); createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS); - createEAttribute(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL); - createEAttribute(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED); createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN); createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS); createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__COLUMN); @@ -2870,13 +2896,15 @@ public class OrmV2_0Package extends EPackageImpl xmlMapKeyAttributeOverrideContainer_2_0EClass = createEClass(XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20); createEReference(xmlMapKeyAttributeOverrideContainer_2_0EClass, XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES); + xmlMapKeyConvertibleMapping_2_0EClass = createEClass(XML_MAP_KEY_CONVERTIBLE_MAPPING_20); + createEAttribute(xmlMapKeyConvertibleMapping_2_0EClass, XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_TEMPORAL); + createEAttribute(xmlMapKeyConvertibleMapping_2_0EClass, XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_ENUMERATED); + xmlMapsId_2_0EClass = createEClass(XML_MAPS_ID_20); createEAttribute(xmlMapsId_2_0EClass, XML_MAPS_ID_20__MAPS_ID); xmlMultiRelationshipMapping_2_0EClass = createEClass(XML_MULTI_RELATIONSHIP_MAPPING_20); createEReference(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS); - createEAttribute(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL); - createEAttribute(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED); createEReference(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN); createEReference(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS); @@ -2968,11 +2996,13 @@ public class OrmV2_0Package extends EPackageImpl xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAttributeOverrideContainer()); xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAssociationOverrideContainer()); xmlElementCollection_2_0EClass.getESuperTypes().add(this.getXmlMapKeyAttributeOverrideContainer_2_0()); + xmlElementCollection_2_0EClass.getESuperTypes().add(this.getXmlMapKeyConvertibleMapping_2_0()); xmlEmbedded_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAssociationOverrideContainer()); xmlEntity_2_0EClass.getESuperTypes().add(this.getXmlCacheable_2_0()); xmlManyToMany_2_0EClass.getESuperTypes().add(this.getXmlMultiRelationshipMapping_2_0()); xmlMultiRelationshipMapping_2_0EClass.getESuperTypes().add(this.getXmlOrderable_2_0()); xmlMultiRelationshipMapping_2_0EClass.getESuperTypes().add(this.getXmlMapKeyAttributeOverrideContainer_2_0()); + xmlMultiRelationshipMapping_2_0EClass.getESuperTypes().add(this.getXmlMapKeyConvertibleMapping_2_0()); xmlOneToMany_2_0EClass.getESuperTypes().add(this.getXmlMultiRelationshipMapping_2_0()); xmlOneToMany_2_0EClass.getESuperTypes().add(this.getXmlOrphanRemovable_2_0()); xmlOneToOne_2_0EClass.getESuperTypes().add(this.getXmlSingleRelationshipMapping_2_0()); @@ -3009,8 +3039,6 @@ public class OrmV2_0Package extends EPackageImpl initEAttribute(getXmlElementCollection_2_0_Fetch(), theOrmPackage.getFetchType(), "fetch", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlElementCollection_2_0_MapKey(), theOrmPackage.getMapKey(), null, "mapKey", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlElementCollection_2_0_MapKeyClass(), theOrmPackage.getXmlClassReference(), null, "mapKeyClass", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getXmlElementCollection_2_0_MapKeyTemporal(), theOrmPackage.getTemporalType(), "mapKeyTemporal", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getXmlElementCollection_2_0_MapKeyEnumerated(), theOrmPackage.getEnumType(), "mapKeyEnumerated", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlElementCollection_2_0_MapKeyColumn(), theOrmPackage.getXmlColumn(), null, "mapKeyColumn", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlElementCollection_2_0_MapKeyJoinColumns(), theOrmPackage.getXmlJoinColumn(), null, "mapKeyJoinColumns", null, 0, -1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlElementCollection_2_0_Column(), theOrmPackage.getXmlColumn(), null, "column", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -3034,13 +3062,15 @@ public class OrmV2_0Package extends EPackageImpl initEClass(xmlMapKeyAttributeOverrideContainer_2_0EClass, XmlMapKeyAttributeOverrideContainer_2_0.class, "XmlMapKeyAttributeOverrideContainer_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides(), theOrmPackage.getXmlAttributeOverride(), null, "mapKeyAttributeOverrides", null, 0, -1, XmlMapKeyAttributeOverrideContainer_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(xmlMapKeyConvertibleMapping_2_0EClass, XmlMapKeyConvertibleMapping_2_0.class, "XmlMapKeyConvertibleMapping_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getXmlMapKeyConvertibleMapping_2_0_MapKeyTemporal(), theOrmPackage.getTemporalType(), "mapKeyTemporal", null, 0, 1, XmlMapKeyConvertibleMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getXmlMapKeyConvertibleMapping_2_0_MapKeyEnumerated(), theOrmPackage.getEnumType(), "mapKeyEnumerated", null, 0, 1, XmlMapKeyConvertibleMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(xmlMapsId_2_0EClass, XmlMapsId_2_0.class, "XmlMapsId_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getXmlMapsId_2_0_MapsId(), theXMLTypePackage.getString(), "mapsId", null, 0, 1, XmlMapsId_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(xmlMultiRelationshipMapping_2_0EClass, XmlMultiRelationshipMapping_2_0.class, "XmlMultiRelationshipMapping_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getXmlMultiRelationshipMapping_2_0_MapKeyClass(), theOrmPackage.getXmlClassReference(), null, "mapKeyClass", null, 0, 1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getXmlMultiRelationshipMapping_2_0_MapKeyTemporal(), theOrmPackage.getTemporalType(), "mapKeyTemporal", null, 0, 1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated(), theOrmPackage.getEnumType(), "mapKeyEnumerated", null, 0, 1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlMultiRelationshipMapping_2_0_MapKeyColumn(), theOrmPackage.getXmlColumn(), null, "mapKeyColumn", null, 0, 1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlMultiRelationshipMapping_2_0_MapKeyJoinColumns(), theOrmPackage.getXmlJoinColumn(), null, "mapKeyJoinColumns", null, 0, -1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -3256,22 +3286,6 @@ public class OrmV2_0Package extends EPackageImpl public static final EReference XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS = eINSTANCE.getXmlElementCollection_2_0_MapKeyClass(); /** - * The meta object literal for the '<em><b>Map Key Temporal</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL = eINSTANCE.getXmlElementCollection_2_0_MapKeyTemporal(); - - /** - * The meta object literal for the '<em><b>Map Key Enumerated</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED = eINSTANCE.getXmlElementCollection_2_0_MapKeyEnumerated(); - - /** * The meta object literal for the '<em><b>Map Key Column</b></em>' containment reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -3406,56 +3420,66 @@ public class OrmV2_0Package extends EPackageImpl public static final EReference XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES = eINSTANCE.getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides(); /** - * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 <em>Xml Maps Id 20</em>}' class. + * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0 <em>Xml Map Key Convertible Mapping 20</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapsId_2_0() + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0 + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyConvertibleMapping_2_0() * @generated */ - public static final EClass XML_MAPS_ID_20 = eINSTANCE.getXmlMapsId_2_0(); + public static final EClass XML_MAP_KEY_CONVERTIBLE_MAPPING_20 = eINSTANCE.getXmlMapKeyConvertibleMapping_2_0(); /** - * The meta object literal for the '<em><b>Maps Id</b></em>' attribute feature. + * The meta object literal for the '<em><b>Map Key Temporal</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - public static final EAttribute XML_MAPS_ID_20__MAPS_ID = eINSTANCE.getXmlMapsId_2_0_MapsId(); + public static final EAttribute XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_TEMPORAL = eINSTANCE.getXmlMapKeyConvertibleMapping_2_0_MapKeyTemporal(); /** - * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0 <em>Xml Multi Relationship Mapping 20</em>}' class. + * The meta object literal for the '<em><b>Map Key Enumerated</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0 - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0() * @generated */ - public static final EClass XML_MULTI_RELATIONSHIP_MAPPING_20 = eINSTANCE.getXmlMultiRelationshipMapping_2_0(); + public static final EAttribute XML_MAP_KEY_CONVERTIBLE_MAPPING_20__MAP_KEY_ENUMERATED = eINSTANCE.getXmlMapKeyConvertibleMapping_2_0_MapKeyEnumerated(); /** - * The meta object literal for the '<em><b>Map Key Class</b></em>' containment reference feature. + * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 <em>Xml Maps Id 20</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapsId_2_0() * @generated */ - public static final EReference XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyClass(); + public static final EClass XML_MAPS_ID_20 = eINSTANCE.getXmlMapsId_2_0(); /** - * The meta object literal for the '<em><b>Map Key Temporal</b></em>' attribute feature. + * The meta object literal for the '<em><b>Maps Id</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - public static final EAttribute XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyTemporal(); + public static final EAttribute XML_MAPS_ID_20__MAPS_ID = eINSTANCE.getXmlMapsId_2_0_MapsId(); /** - * The meta object literal for the '<em><b>Map Key Enumerated</b></em>' attribute feature. + * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0 <em>Xml Multi Relationship Mapping 20</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0 + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0() + * @generated + */ + public static final EClass XML_MULTI_RELATIONSHIP_MAPPING_20 = eINSTANCE.getXmlMultiRelationshipMapping_2_0(); + + /** + * The meta object literal for the '<em><b>Map Key Class</b></em>' containment reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - public static final EAttribute XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated(); + public static final EReference XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyClass(); /** * The meta object literal for the '<em><b>Map Key Column</b></em>' containment reference feature. diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java index 9940b49e73..e95b0c62b5 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. + * Copyright (c) 2009, 2011 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 @@ -13,10 +13,8 @@ package org.eclipse.jpt.jpa.core.resource.orm.v2_0; import org.eclipse.emf.common.util.EList; import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.resource.orm.EnumType; import org.eclipse.jpt.jpa.core.resource.orm.FetchType; import org.eclipse.jpt.jpa.core.resource.orm.MapKey; -import org.eclipse.jpt.jpa.core.resource.orm.TemporalType; import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer; import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer; import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference; @@ -44,8 +42,6 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable; * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getFetch <em>Fetch</em>}</li> * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKey <em>Map Key</em>}</li> * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyClass <em>Map Key Class</em>}</li> - * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}</li> - * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}</li> * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyColumn <em>Map Key Column</em>}</li> * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyJoinColumns <em>Map Key Join Columns</em>}</li> * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getColumn <em>Column</em>}</li> @@ -57,7 +53,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable; * @model kind="class" interface="true" abstract="true" * @generated */ -public interface XmlElementCollection_2_0 extends XmlConvertibleMapping, XmlOrderable, XmlAttributeOverrideContainer, XmlAssociationOverrideContainer, XmlMapKeyAttributeOverrideContainer_2_0 +public interface XmlElementCollection_2_0 extends XmlConvertibleMapping, XmlOrderable, XmlAttributeOverrideContainer, XmlAssociationOverrideContainer, XmlMapKeyAttributeOverrideContainer_2_0, XmlMapKeyConvertibleMapping_2_0 { /** * Returns the value of the '<em><b>Target Class</b></em>' attribute. @@ -167,64 +163,6 @@ public interface XmlElementCollection_2_0 extends XmlConvertibleMapping, XmlOrde void setMapKeyClass(XmlClassReference value); /** - * Returns the value of the '<em><b>Map Key Temporal</b></em>' attribute. - * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Map Key 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>Map Key Temporal</em>' attribute. - * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType - * @see #setMapKeyTemporal(TemporalType) - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_MapKeyTemporal() - * @model - * @generated - */ - TemporalType getMapKeyTemporal(); - - /** - * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Map Key Temporal</em>' attribute. - * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType - * @see #getMapKeyTemporal() - * @generated - */ - void setMapKeyTemporal(TemporalType value); - - /** - * Returns the value of the '<em><b>Map Key Enumerated</b></em>' attribute. - * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.EnumType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Map Key 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>Map Key Enumerated</em>' attribute. - * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType - * @see #setMapKeyEnumerated(EnumType) - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_MapKeyEnumerated() - * @model - * @generated - */ - EnumType getMapKeyEnumerated(); - - /** - * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Map Key Enumerated</em>' attribute. - * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType - * @see #getMapKeyEnumerated() - * @generated - */ - void setMapKeyEnumerated(EnumType value); - - /** * Returns the value of the '<em><b>Map Key Column</b></em>' containment reference. * <!-- begin-user-doc --> * <p> diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyConvertibleMapping_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyConvertibleMapping_2_0.java new file mode 100644 index 0000000000..d0fe51b6ad --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyConvertibleMapping_2_0.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2011 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.jpa.core.resource.orm.v2_0; + +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.jpa.core.resource.orm.EnumType; +import org.eclipse.jpt.jpa.core.resource.orm.TemporalType; + +import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Xml Map Key Convertible Mapping 20</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.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}</li> + * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyConvertibleMapping_2_0() + * @model kind="class" interface="true" abstract="true" + * @extends JpaEObject + * @generated + */ +public interface XmlMapKeyConvertibleMapping_2_0 extends JpaEObject +{ + /** + * Returns the value of the '<em><b>Map Key Temporal</b></em>' attribute. + * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Map Key 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>Map Key Temporal</em>' attribute. + * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType + * @see #setMapKeyTemporal(TemporalType) + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyConvertibleMapping_2_0_MapKeyTemporal() + * @model + * @generated + */ + TemporalType getMapKeyTemporal(); + + /** + * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Map Key Temporal</em>' attribute. + * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType + * @see #getMapKeyTemporal() + * @generated + */ + void setMapKeyTemporal(TemporalType value); + + /** + * Returns the value of the '<em><b>Map Key Enumerated</b></em>' attribute. + * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.EnumType}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Map Key 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>Map Key Enumerated</em>' attribute. + * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType + * @see #setMapKeyEnumerated(EnumType) + * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyConvertibleMapping_2_0_MapKeyEnumerated() + * @model + * @generated + */ + EnumType getMapKeyEnumerated(); + + /** + * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyConvertibleMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Map Key Enumerated</em>' attribute. + * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType + * @see #getMapKeyEnumerated() + * @generated + */ + void setMapKeyEnumerated(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 getMapKeyEnumeratedTextRange(); + + /** + * Return the {@link TextRange} for the temporal element. If the temporal element + * does not exist return the {@link TextRange} for the basic element. + */ + TextRange getMapKeyTemporalTextRange(); + +} // XmlMapKeyConvertibleMapping_2_0 diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java index 6389cf6e1d..f821acbf5e 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. + * Copyright (c) 2010, 2011 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 @@ -11,8 +11,6 @@ package org.eclipse.jpt.jpa.core.resource.orm.v2_0; import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.jpa.core.resource.orm.EnumType; -import org.eclipse.jpt.jpa.core.resource.orm.TemporalType; import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference; import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; @@ -32,8 +30,6 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; * The following features are supported: * <ul> * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyClass <em>Map Key Class</em>}</li> - * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}</li> - * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}</li> * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyColumn <em>Map Key Column</em>}</li> * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyJoinColumns <em>Map Key Join Columns</em>}</li> * </ul> @@ -43,7 +39,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; * @model kind="class" interface="true" abstract="true" * @generated */ -public interface XmlMultiRelationshipMapping_2_0 extends XmlOrderable_2_0, XmlMapKeyAttributeOverrideContainer_2_0 +public interface XmlMultiRelationshipMapping_2_0 extends XmlOrderable_2_0, XmlMapKeyAttributeOverrideContainer_2_0, XmlMapKeyConvertibleMapping_2_0 { /** * Returns the value of the '<em><b>Map Key Class</b></em>' containment reference. @@ -72,64 +68,6 @@ public interface XmlMultiRelationshipMapping_2_0 extends XmlOrderable_2_0, XmlMa void setMapKeyClass(XmlClassReference value); /** - * Returns the value of the '<em><b>Map Key Temporal</b></em>' attribute. - * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Map Key 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>Map Key Temporal</em>' attribute. - * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType - * @see #setMapKeyTemporal(TemporalType) - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0_MapKeyTemporal() - * @model - * @generated - */ - TemporalType getMapKeyTemporal(); - - /** - * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Map Key Temporal</em>' attribute. - * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType - * @see #getMapKeyTemporal() - * @generated - */ - void setMapKeyTemporal(TemporalType value); - - /** - * Returns the value of the '<em><b>Map Key Enumerated</b></em>' attribute. - * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.EnumType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Map Key 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>Map Key Enumerated</em>' attribute. - * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType - * @see #setMapKeyEnumerated(EnumType) - * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated() - * @model - * @generated - */ - EnumType getMapKeyEnumerated(); - - /** - * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Map Key Enumerated</em>' attribute. - * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType - * @see #getMapKeyEnumerated() - * @generated - */ - void setMapKeyEnumerated(EnumType value); - - /** * Returns the value of the '<em><b>Map Key Column</b></em>' containment reference. * <!-- begin-user-doc --> * <p> |