Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2010-01-12 19:09:18 +0000
committerkmoore2010-01-12 19:09:18 +0000
commitcbd13fd4e11083fb6bef59d8de0da8379a9e56b2 (patch)
treea0c6519e2b889062476d4537448ac68d90bd7727
parent508bd987eebe7f171840caa0ae2947e81dd56ba5 (diff)
downloadwebtools.dali-cbd13fd4e11083fb6bef59d8de0da8379a9e56b2.tar.gz
webtools.dali-cbd13fd4e11083fb6bef59d8de0da8379a9e56b2.tar.xz
webtools.dali-cbd13fd4e11083fb6bef59d8de0da8379a9e56b2.zip
258490 - element collection support for basic and embedded collections
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/jpaResourceModels.genmodel2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/orm.ecore6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java378
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java392
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/ElementCollectionMapping2_0.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaElementCollectionMapping2_0.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlElementCollection.java234
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/OrmV2_0Package.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/XmlElementCollection_2_0.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/XmlElementCollection.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_details2_0.properties2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0Composite.java253
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AssociationOverride2_0Composite.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionMapping2_0Composite.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionValueOverridesComposite.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/JptUiDetailsMessages2_0.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/orm/OrmElementCollectionMapping2_0Composite.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0Tests.java71
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java133
36 files changed, 1625 insertions, 417 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/jpaResourceModels.genmodel b/jpa/plugins/org.eclipse.jpt.core/model/jpaResourceModels.genmodel
index b02821baaa..185b36b684 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/jpaResourceModels.genmodel
+++ b/jpa/plugins/org.eclipse.jpt.core/model/jpaResourceModels.genmodel
@@ -378,8 +378,6 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//v2_0/XmlElementCollection_2_0/mapKeyColumn"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//v2_0/XmlElementCollection_2_0/mapKeyJoinColumns"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//v2_0/XmlElementCollection_2_0/column"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//v2_0/XmlElementCollection_2_0/attributeOverrides"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//v2_0/XmlElementCollection_2_0/associationOverrides"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//v2_0/XmlElementCollection_2_0/collectionTable"/>
</genClasses>
<genClasses image="false" ecoreClass="orm.ecore#//v2_0/XmlEmbedded_2_0"/>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
index 82b21290ca..cd9ad31b95 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
+++ b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
@@ -446,7 +446,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XmlElementCollection_2_0" abstract="true"
- interface="true" eSuperTypes="#//XmlConvertibleMapping #//XmlOrderable">
+ interface="true" eSuperTypes="#//XmlConvertibleMapping #//XmlOrderable #//XmlAttributeOverrideContainer #//XmlAssociationOverrideContainer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="targetClass" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fetch" eType="#//FetchType"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="mapKey" eType="#//MapKey"
@@ -463,10 +463,6 @@
eType="#//XmlJoinColumn" containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="column" eType="#//XmlColumn"
containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="attributeOverrides" upperBound="-1"
- eType="#//XmlAttributeOverride" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="associationOverrides"
- upperBound="-1" eType="#//XmlAssociationOverride" containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="collectionTable" eType="#//XmlCollectionTable"
containment="true" resolveProxies="false"/>
</eClassifiers>
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
index 9a142b1807..f458786284 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 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.
@@ -207,7 +207,7 @@ public interface JpaFactory
JavaAttributeOverride buildJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverride.Owner owner);
- JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEntity parent, AssociationOverrideContainer.Owner owner);
+ JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaJpaContextNode parent, AssociationOverrideContainer.Owner owner);
JavaAssociationOverride buildJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverride.Owner owner);
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java
index 3c3a4ff17c..a901cdad98 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java
@@ -77,9 +77,8 @@ public interface BaseColumn extends NamedColumn
*/
boolean tableNameIsInvalid();
- //TODO not sure we really need/want this to be public. This
- //is used by ColumnComposite to get a list of possible associated tables, but
- //right now that list isn't going to update in the UI except when we repopulate
+ //TODO This is used by ColumnComposite to get a list of possible associated tables,
+ //but right now that list isn't going to update in the UI except when we repopulate
/**
* Return a list of table names that are valid for this column
*/
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java
index c7dc93dfa7..0085268ea6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 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.
@@ -94,7 +94,7 @@ public interface OrmXmlContextNodeFactory
OrmAttributeOverrideContainer buildOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner, XmlAttributeOverrideContainer resourceAttributeOverrideContainer);
- OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEntity parent, OrmAssociationOverrideContainer.Owner owner, XmlAssociationOverrideContainer resourceAssociationOverrideContainer);
+ OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner, XmlAssociationOverrideContainer resourceAssociationOverrideContainer);
OrmAttributeOverride buildOrmAttributeOverride(OrmAttributeOverrideContainer parent, AttributeOverride.Owner owner, XmlAttributeOverride xmlAttributeOverride);
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
index f3d8e0a138..62e4a0cf05 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
@@ -329,7 +329,7 @@ public abstract class AbstractJpaFactory
return new GenericJavaAttributeOverrideContainer(parent, owner);
}
- public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEntity parent, AssociationOverrideContainer.Owner owner) {
+ public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaJpaContextNode parent, AssociationOverrideContainer.Owner owner) {
return new GenericJavaAssociationOverrideContainer(parent, owner);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java
index 7ba5cba56f..7a69eed780 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.core.internal.context;
import java.util.Iterator;
import org.eclipse.jpt.core.context.AttributeMapping;
+import org.eclipse.jpt.core.context.Column;
import org.eclipse.jpt.core.context.ColumnMapping;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.JoinColumn;
@@ -26,6 +27,7 @@ import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
import org.eclipse.jpt.core.jpa2.context.ElementCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.context.MetamodelField;
import org.eclipse.jpt.db.Table;
+import org.eclipse.jpt.utility.internal.CollectionTools;
/**
* Gather some of the behavior common to the Java and XML models. :-(
@@ -248,6 +250,29 @@ public class MappingTools {
return mapKeyMapping.getMetamodelTypeName();
}
+ public static Column resolveOverridenColumn(TypeMapping overridableTypeMapping, String attributeOverrideName) {
+ if (overridableTypeMapping != null) {
+ for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
+ Column column = typeMapping.resolveOverriddenColumn(attributeOverrideName);
+ if (column != null) {
+ return column;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static RelationshipReference resolveRelationshipReference(TypeMapping overridableTypeMapping, String associationOverrideName) {
+ if (overridableTypeMapping != null) {
+ for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
+ RelationshipReference relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
+ if (relationshipReference != null) {
+ return relationshipReference;
+ }
+ }
+ }
+ return null;
+ }
// ********** constructor **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
index c455d67355..3b06e5742b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
@@ -23,11 +23,11 @@ import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaBaseEmbeddedMapping;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.db.Table;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
@@ -197,17 +197,7 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation>
}
public Column resolveOverriddenColumn(String attributeOverrideName) {
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- Column column = null;
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- column = typeMapping.resolveOverriddenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- return column;
+ return MappingTools.resolveOverridenColumn(getOverridableTypeMapping(), attributeOverrideName);
}
public boolean tableNameIsInvalid(String tableName) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
index 2f92d61eb6..56fded5367 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
@@ -46,6 +46,7 @@ import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.java.JavaQueryContainer;
import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
import org.eclipse.jpt.core.context.java.JavaTable;
+import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -1555,16 +1556,7 @@ public abstract class AbstractJavaEntity
}
public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- RelationshipReference relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- return null;
+ return MappingTools.resolveRelationshipReference(getOverridableTypeMapping(), associationOverrideName);
}
public boolean tableNameIsInvalid(String tableName) {
@@ -1596,16 +1588,7 @@ public abstract class AbstractJavaEntity
}
public Column resolveOverriddenColumn(String attributeOverrideName) {
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- Column column = typeMapping.resolveOverriddenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- return null;
+ return MappingTools.resolveOverridenColumn(getOverridableTypeMapping(), attributeOverrideName);
}
public boolean tableNameIsInvalid(String tableName) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
index f0fdb1dd30..64c0e124ec 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
@@ -22,9 +22,9 @@ import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
import org.eclipse.jpt.core.context.orm.OrmBaseEmbeddedMapping;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.resource.orm.AbstractXmlEmbedded;
import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
@@ -185,17 +185,7 @@ public abstract class AbstractOrmBaseEmbeddedMapping<T extends AbstractXmlEmbedd
return javaAttributeOverride.getColumn();
}
}
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- Column column = null;
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- column = typeMapping.resolveOverriddenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- return column;
+ return MappingTools.resolveOverridenColumn(getOverridableTypeMapping(), attributeOverrideName);
}
public XmlColumn buildVirtualXmlColumn(Column overridableColumn, String attributeName, boolean isMetadataComplete) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java
index 74330ec91c..c11d1644e9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java
@@ -22,6 +22,7 @@ import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
@@ -212,23 +213,13 @@ public abstract class AbstractOrmEmbeddedMapping<T extends XmlEmbedded>
}
public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
- RelationshipReference relationshipReference = null;
if (getPersistentAttribute().isVirtual() && !getTypeMapping().isMetadataComplete()) {
JavaAssociationOverride javaAssociationOverride = getJavaAssociationOverrideNamed(associationOverrideName);
if (javaAssociationOverride != null && !javaAssociationOverride.isVirtual()) {
return javaAssociationOverride.getRelationshipReference();
}
}
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- return relationshipReference;
+ return MappingTools.resolveRelationshipReference(getOverridableTypeMapping(), associationOverrideName);
}
public boolean tableNameIsInvalid(String tableName) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
index 456b032873..6e65dd324f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
@@ -52,6 +52,7 @@ import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
import org.eclipse.jpt.core.context.orm.OrmTable;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -1786,16 +1787,7 @@ public abstract class AbstractOrmEntity
}
}
}
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- RelationshipReference relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- return null;
+ return MappingTools.resolveRelationshipReference(getOverridableTypeMapping(), associationOverrideName);
}
public boolean tableNameIsInvalid(String tableName) {
@@ -1836,16 +1828,7 @@ public abstract class AbstractOrmEntity
}
}
}
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- Column column = typeMapping.resolveOverriddenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- return null;
+ return MappingTools.resolveOverridenColumn(getOverridableTypeMapping(), attributeOverrideName);
}
public XmlColumn buildVirtualXmlColumn(Column overridableColumn, String attributeName, boolean isMetadataComplete) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
index b163d46c40..b3f48a2de2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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.
@@ -240,7 +240,7 @@ public abstract class AbstractOrmXmlContextNodeFactory
return new GenericOrmAttributeOverrideContainer(parent, owner, resourceAttributeOverrideContainer);
}
- public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEntity parent, OrmAssociationOverrideContainer.Owner owner, XmlAssociationOverrideContainer resourceAssociationOverrideContainer) {
+ public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner, XmlAssociationOverrideContainer resourceAssociationOverrideContainer) {
return new GenericOrmAssociationOverrideContainer(parent, owner, resourceAssociationOverrideContainer);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
index dc10a4e225..beae2831ab 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
@@ -21,6 +21,7 @@ import org.eclipse.jpt.core.context.RelationshipReference;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
@@ -186,17 +187,7 @@ public class GenericJavaEmbeddedMapping
}
public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- RelationshipReference relationshipReference = null;
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- return relationshipReference;
+ return MappingTools.resolveRelationshipReference(getOverridableTypeMapping(), associationOverrideName);
}
public boolean tableNameIsInvalid(String tableName) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
index 36a6eb51f6..17b3d3547d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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,33 +9,51 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.jpa2.context.java;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
+import org.eclipse.jpt.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.core.context.Column;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.Embeddable;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.Fetchable;
import org.eclipse.jpt.core.context.PersistentType;
+import org.eclipse.jpt.core.context.RelationshipReference;
import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.core.context.java.JavaBaseColumn;
+import org.eclipse.jpt.core.context.java.JavaColumn;
+import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaOrderable;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
+import org.eclipse.jpt.core.jpa2.context.MetamodelField;
import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionTable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
import org.eclipse.jpt.core.resource.java.JPA;
+import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.db.Table;
import org.eclipse.jpt.utility.Filter;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -55,17 +73,36 @@ public class GenericJavaElementCollectionMapping2_0
protected final JavaCollectionTable2_0 collectionTable;
+ protected Type valueType;
+
+ protected final JavaColumn valueColumn;
+
+ protected JavaConverter valueConverter;
+
+ protected final JavaConverter nullConverter;
+
+ protected final JavaAttributeOverrideContainer valueAttributeOverrideContainer;
+
+ protected final JavaAssociationOverrideContainer valueAssociationOverrideContainer;
+
+ protected Type keyType;
+
public GenericJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
super(parent);
this.orderable = getJpaFactory().buildJavaOrderable(this);
this.collectionTable = getJpaFactory().buildJavaCollectionTable(this);
+ this.valueColumn = getJpaFactory().buildJavaColumn(parent, new ValueColumnOwner());
+ this.nullConverter = getJpaFactory().buildJavaNullConverter(this);
+ this.valueConverter = this.nullConverter;
+ this.valueAttributeOverrideContainer = this.getJpaFactory().buildJavaAttributeOverrideContainer(this, new AttributeOverrideContainerOwner());
+ this.valueAssociationOverrideContainer = this.getJpaFactory().buildJavaAssociationOverrideContainer(this, new AssociationOverrideContainerOwner());
}
-
+
@Override
protected JpaFactory2_0 getJpaFactory() {
return (JpaFactory2_0) super.getJpaFactory();
}
-
+
@Override
protected void initialize() {
super.initialize();
@@ -76,8 +113,14 @@ public class GenericJavaElementCollectionMapping2_0
this.resolvedTargetType = this.buildResolvedTargetType();
this.resolvedTargetEmbeddable = this.buildResolvedTargetEmbeddable();
this.initializeCollectionTable();
+ this.initializeValueType();
+ this.initializeValueColumn();
+ this.initializeValueConverter();
+ this.valueAttributeOverrideContainer.initialize(getResourcePersistentAttribute());
+ this.valueAssociationOverrideContainer.initialize(getResourcePersistentAttribute());
+ this.initializeKeyType();
}
-
+
@Override
protected void update() {
super.update();
@@ -88,6 +131,18 @@ public class GenericJavaElementCollectionMapping2_0
this.resolvedTargetType = this.buildResolvedTargetType();//no need for change notification, use resolved target embeddable change notification instead?
this.setResolvedTargetEmbeddable(this.buildResolvedTargetEmbeddable());
this.updateCollectionTable();
+ this.updateValueType();
+ this.updateValueColumn();
+ this.updateValueConverter();
+ this.valueAttributeOverrideContainer.update(getResourcePersistentAttribute());
+ this.valueAssociationOverrideContainer.update(getResourcePersistentAttribute());
+ this.updateKeyType();
+ }
+
+ @Override
+ public void postUpdate() {
+ super.postUpdate();
+ this.valueAssociationOverrideContainer.postUpdate();
}
public Entity getEntity() {
@@ -277,13 +332,162 @@ public class GenericJavaElementCollectionMapping2_0
return (CollectionTable2_0Annotation) this.getResourcePersistentAttribute().
getNonNullAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME);
}
+
+ // ***************** value column **************
+
+ public JavaColumn getValueColumn() {
+ return this.valueColumn;
+ }
+
+ protected void initializeValueColumn() {
+ this.valueColumn.initialize(getColumnAnnotation());
+ }
+
+ protected void updateValueColumn() {
+ getValueColumn().update(getColumnAnnotation());
+ }
+
+ public ColumnAnnotation getColumnAnnotation() {
+ return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ************ value converter ************
+
+ public JavaConverter getConverter() {
+ return this.valueConverter;
+ }
+
+ protected String getValueConverterType() {
+ return this.valueConverter.getType();
+ }
+
+ public void setConverter(String converterType) {
+ if (this.valuesAreEqual(getValueConverterType(), converterType)) {
+ return;
+ }
+ JavaConverter oldConverter = this.valueConverter;
+ JavaConverter newConverter = buildConverter(converterType);
+ this.valueConverter = this.nullConverter;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.valueConverter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
+ protected void setConverter(JavaConverter newConverter) {
+ JavaConverter oldConverter = this.valueConverter;
+ this.valueConverter = newConverter;
+ firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
+
+ protected void initializeValueConverter() {
+ this.valueConverter = this.buildConverter(this.getResourceConverterType());
+ }
+
+ protected void updateValueConverter() {
+ if (this.valuesAreEqual(getResourceConverterType(), getValueConverterType())) {
+ getConverter().update(this.getResourcePersistentAttribute());
+ }
+ else {
+ JavaConverter javaConverter = buildConverter(getResourceConverterType());
+ setConverter(javaConverter);
+ }
+ }
+
+ protected JavaConverter buildConverter(String converterType) {
+ if (this.valuesAreEqual(converterType, Converter.NO_CONVERTER)) {
+ return this.nullConverter;
+ }
+ if (this.valuesAreEqual(converterType, Converter.ENUMERATED_CONVERTER)) {
+ return getJpaFactory().buildJavaEnumeratedConverter(this, this.getResourcePersistentAttribute());
+ }
+ if (this.valuesAreEqual(converterType, Converter.TEMPORAL_CONVERTER)) {
+ return getJpaFactory().buildJavaTemporalConverter(this, this.getResourcePersistentAttribute());
+ }
+ return null;
+ }
+ protected String getResourceConverterType() {
+ if (this.getResourcePersistentAttribute().getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME) != null) {
+ return Converter.ENUMERATED_CONVERTER;
+ }
+ if (this.getResourcePersistentAttribute().getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+ return Converter.NO_CONVERTER;
+ }
+
+
+ // ********** overrides **********
+
+ public JavaAttributeOverrideContainer getValueAttributeOverrideContainer() {
+ return this.valueAttributeOverrideContainer;
+ }
+
+ public JavaAssociationOverrideContainer getValueAssociationOverrideContainer() {
+ return this.valueAssociationOverrideContainer;
+ }
+
+
// ********** ordering **********
public JavaOrderable getOrderable() {
return this.orderable;
}
-
+
+
+ public Type getValueType() {
+ return this.valueType;
+ }
+
+ protected void setValueType(Type newValueType) {
+ Type old = this.valueType;
+ this.valueType = newValueType;
+ firePropertyChanged(VALUE_TYPE_PROPERTY, old, newValueType);
+ }
+
+ protected void initializeValueType() {
+ this.valueType = this.buildValueType();
+ }
+
+ protected Type buildValueType() {
+ if (getResolvedTargetEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ else if (getTargetClass() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+ protected void updateValueType() {
+ this.setValueType(buildValueType());
+ }
+
+ public Type getKeyType() {
+ return this.keyType;
+ }
+
+ protected void setKeyType(Type newKeyType) {
+ Type old = this.keyType;
+ this.keyType = newKeyType;
+ firePropertyChanged(KEY_TYPE_PROPERTY, old, newKeyType);
+ }
+
+ protected void initializeKeyType() {
+ //TODO key type
+ }
+
+ protected void updateKeyType() {
+ //TODO key type
+ }
+
// ********** Java completion proposals **********
@@ -297,10 +501,26 @@ public class GenericJavaElementCollectionMapping2_0
if (result != null) {
return result;
}
+ result = this.getValueColumn().javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = getConverter().javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
result = this.getOrderable().javaCompletionProposals(pos, filter, astRoot);
if (result != null) {
return result;
}
+ result = this.getValueAttributeOverrideContainer().javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getValueAssociationOverrideContainer().javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
// if (this.mapKeyNameTouches(pos, astRoot)) {
// return this.javaCandidateMapKeyNames(filter);
@@ -309,7 +529,34 @@ public class GenericJavaElementCollectionMapping2_0
}
// ********** metamodel **********
- //TODO metamodel support
+ //TODO map metamodel
+ @Override
+ protected String getMetamodelFieldTypeName() {
+ return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName();
+ }
+
+ @Override
+ public String getMetamodelTypeName() {
+ String targetClass = this.getTargetClass();
+ return (targetClass != null) ? targetClass : MetamodelField.DEFAULT_TYPE_NAME;
+ }
+
+ @Override
+ protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
+ this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames);
+ super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
+ }
+
+ protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) {
+// String keyTypeName = ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName();
+// if (keyTypeName != null) {
+// typeArgumentNames.add(keyTypeName);
+// }
+ }
+
+// public String getMetamodelFieldMapKeyTypeName() {
+// return MappingTools.getMetamodelFieldMapKeyTypeName(this);
+// }
// ********** validation **********
@@ -318,8 +565,12 @@ public class GenericJavaElementCollectionMapping2_0
public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
super.validate(messages, reporter, astRoot);
this.validateTargetClass(messages, astRoot);
- this.orderable.validate(messages, reporter, astRoot);
- this.collectionTable.validate(messages, reporter, astRoot);
+ this.getOrderable().validate(messages, reporter, astRoot);
+ this.getCollectionTable().validate(messages, reporter, astRoot);
+ this.getValueColumn().validate(messages, reporter, astRoot);
+ this.getConverter().validate(messages, reporter, astRoot);
+ this.getValueAttributeOverrideContainer().validate(messages, reporter, astRoot);
+ this.getValueAssociationOverrideContainer().validate(messages, reporter, astRoot);
}
protected void validateTargetClass(List<IMessage> messages, CompilationUnit astRoot) {
@@ -358,4 +609,113 @@ public class GenericJavaElementCollectionMapping2_0
return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
}
+ class ValueColumnOwner implements JavaBaseColumn.Owner {
+ public String getDefaultTableName() {
+ return getCollectionTable().getName();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaElementCollectionMapping2_0.this.getTypeMapping();
+ }
+
+ public String getDefaultColumnName() {
+ return GenericJavaElementCollectionMapping2_0.this.getName();
+ }
+
+ public Table getDbTable(String tableName) {
+ if (getCollectionTable().getName().equals(tableName)) {
+ return GenericJavaElementCollectionMapping2_0.this.getCollectionTable().getDbTable();
+ }
+ return null;
+ }
+
+ /**
+ * the default table name is always valid and a specified table name
+ * is prohibited (which will be handled elsewhere)
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ public java.util.Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaElementCollectionMapping2_0.this.getValidationTextRange(astRoot);
+ }
+ }
+
+ // ********** association override container owner **********
+
+ class AssociationOverrideContainerOwner implements AssociationOverrideContainer.Owner {
+
+ public TypeMapping getOverridableTypeMapping() {
+ return GenericJavaElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaElementCollectionMapping2_0.this.getTypeMapping();
+ }
+
+ public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
+ return MappingTools.resolveRelationshipReference(getOverridableTypeMapping(), associationOverrideName);
+ }
+
+ /**
+ * the default table name is always valid and a specified table name
+ * is prohibited (which will be handled elsewhere)
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ public java.util.Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public String getDefaultTableName() {
+ return GenericJavaElementCollectionMapping2_0.this.getCollectionTable().getName();
+ }
+
+ public org.eclipse.jpt.db.Table getDbTable(String tableName) {
+ return GenericJavaElementCollectionMapping2_0.this.getCollectionTable().getDbTable();
+ }
+ }
+
+ //********** AttributeOverrideContainer.Owner implementation *********
+
+ class AttributeOverrideContainerOwner implements AttributeOverrideContainer.Owner {
+ public TypeMapping getOverridableTypeMapping() {
+ return GenericJavaElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
+ }
+
+ public Column resolveOverriddenColumn(String attributeOverrideName) {
+ return MappingTools.resolveOverridenColumn(getOverridableTypeMapping(), attributeOverrideName);
+ }
+
+ public String getDefaultTableName() {
+ return GenericJavaElementCollectionMapping2_0.this.getCollectionTable().getName();
+ }
+
+ public org.eclipse.jpt.db.Table getDbTable(String tableName) {
+ return GenericJavaElementCollectionMapping2_0.this.getCollectionTable().getDbTable();
+ }
+
+ public java.util.Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ /**
+ * the default table name is always valid and a specified table name
+ * is prohibited (which will be handled elsewhere)
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
index 6f0d4d2368..774727265d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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,30 +9,49 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.jpa2.context.orm;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.AttributeMapping;
+import org.eclipse.jpt.core.context.Column;
+import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.Embeddable;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.Fetchable;
import org.eclipse.jpt.core.context.PersistentType;
+import org.eclipse.jpt.core.context.RelationshipReference;
import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.core.context.orm.OrmColumn;
+import org.eclipse.jpt.core.context.orm.OrmConverter;
import org.eclipse.jpt.core.context.orm.OrmOrderable;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
+import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeOverrideColumn;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.context.ElementCollectionMapping2_0;
+import org.eclipse.jpt.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmCollectionTable2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
import org.eclipse.jpt.core.resource.orm.Attributes;
+import org.eclipse.jpt.core.resource.orm.OrmFactory;
import org.eclipse.jpt.core.resource.orm.XmlCollectionTable;
+import org.eclipse.jpt.core.resource.orm.XmlColumn;
import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.db.Table;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -52,6 +71,20 @@ public class GenericOrmElementCollectionMapping2_0
protected final OrmOrderable orderable;
protected final OrmCollectionTable2_0 collectionTable;
+
+ protected Type valueType;
+
+ protected final OrmColumn valueColumn;
+
+ protected OrmConverter valueConverter;
+
+ protected final OrmConverter nullValueConverter;
+
+ protected final OrmAttributeOverrideContainer valueAttributeOverrideContainer;
+
+ protected final OrmAssociationOverrideContainer valueAssociationOverrideContainer;
+
+ protected Type keyType;
public GenericOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, XmlElementCollection resourceMapping) {
super(parent, resourceMapping);
@@ -62,6 +95,12 @@ public class GenericOrmElementCollectionMapping2_0
this.resolvedTargetType = this.buildResolvedTargetType();
this.resolvedTargetEmbeddable = buildResolvedTargetEmbeddable();
this.collectionTable = getXmlContextNodeFactory().buildOrmCollectionTable(this, getResourceCollectionTable());
+ this.valueType = this.buildValueType();
+ this.valueColumn = getXmlContextNodeFactory().buildOrmColumn(this, new ValueColumnOwner());
+ this.nullValueConverter = this.getXmlContextNodeFactory().buildOrmNullConverter(this);
+ this.valueConverter = this.buildConverter(this.getResourceConverterType());
+ this.valueAssociationOverrideContainer = buildValueAssociationOverrideContainer();
+ this.valueAttributeOverrideContainer = buildValueAttributeOverrideContainer();
}
@Override
@@ -74,6 +113,18 @@ public class GenericOrmElementCollectionMapping2_0
this.setSpecifiedFetch_(this.getResourceFetch());
this.orderable.update();
this.collectionTable.update();
+ this.setValueType(buildValueType());
+ this.valueColumn.update(getResourceColumn());
+ this.valueAttributeOverrideContainer.update();
+ this.valueAssociationOverrideContainer.update();
+ this.updateValueConverter();
+ this.setKeyType(buildKeyType());
+ }
+
+ @Override
+ public void postUpdate() {
+ super.postUpdate();
+ this.valueAssociationOverrideContainer.postUpdate();
}
@Override
@@ -162,7 +213,7 @@ public class GenericOrmElementCollectionMapping2_0
}
protected String buildDefaultTargetClass() {
- ElementCollectionMapping2_0 javaMapping = getJavaElementCollectionMapping();
+ JavaElementCollectionMapping2_0 javaMapping = getJavaElementCollectionMapping();
if (javaMapping != null) {
if (getPersistentAttribute().isVirtual() && !getTypeMapping().isMetadataComplete()) {
return javaMapping.getTargetClass();
@@ -174,13 +225,13 @@ public class GenericOrmElementCollectionMapping2_0
return null;
}
- protected ElementCollectionMapping2_0 getJavaElementCollectionMapping() {
+ protected JavaElementCollectionMapping2_0 getJavaElementCollectionMapping() {
if (this.getJavaPersistentAttribute() == null) {
return null;
}
AttributeMapping javaAttributeMapping = this.getJavaPersistentAttribute().getMapping();
- if (javaAttributeMapping instanceof ElementCollectionMapping2_0) {
- return ((ElementCollectionMapping2_0) javaAttributeMapping);
+ if (javaAttributeMapping.getKey() == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
+ return ((JavaElementCollectionMapping2_0) javaAttributeMapping);
}
return null;
}
@@ -267,15 +318,195 @@ public class GenericOrmElementCollectionMapping2_0
return this.resourceAttributeMapping.getCollectionTable();
}
+
+ // ************** value column ********************************************
+
+ public OrmColumn getValueColumn() {
+ return this.valueColumn;
+ }
+
+ protected XmlColumn getResourceColumn() {
+ return this.resourceAttributeMapping.getColumn();
+ }
+
+
+ // *********** value converter *************
+
+ public OrmConverter getConverter() {
+ return this.valueConverter;
+ }
+
+ protected String getConverterType() {
+ return this.valueConverter.getType();
+ }
+
+ public void setConverter(String converterType) {
+ if (this.valuesAreEqual(getConverterType(), converterType)) {
+ return;
+ }
+ OrmConverter oldConverter = this.valueConverter;
+ OrmConverter newConverter = buildConverter(converterType);
+ this.valueConverter = this.nullValueConverter;
+ if (oldConverter != null) {
+ oldConverter.removeFromResourceModel();
+ }
+ this.valueConverter = newConverter;
+ if (newConverter != null) {
+ newConverter.addToResourceModel();
+ }
+ firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
+ protected void setConverter(OrmConverter newConverter) {
+ OrmConverter oldConverter = this.valueConverter;
+ this.valueConverter = newConverter;
+ firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
+ }
+
+ protected OrmConverter buildConverter(String converterType) {
+ if (this.valuesAreEqual(converterType, Converter.NO_CONVERTER)) {
+ return this.nullValueConverter;
+ }
+ if (this.valuesAreEqual(converterType, Converter.ENUMERATED_CONVERTER)) {
+ return getXmlContextNodeFactory().buildOrmEnumeratedConverter(this, this.resourceAttributeMapping);
+ }
+ if (this.valuesAreEqual(converterType, Converter.TEMPORAL_CONVERTER)) {
+ return getXmlContextNodeFactory().buildOrmTemporalConverter(this, this.resourceAttributeMapping);
+ }
+ if (this.valuesAreEqual(converterType, Converter.LOB_CONVERTER)) {
+ return getXmlContextNodeFactory().buildOrmLobConverter(this, this.resourceAttributeMapping);
+ }
+ return null;
+ }
+
+ protected String getResourceConverterType() {
+ if (this.resourceAttributeMapping.getEnumerated() != null) {
+ return Converter.ENUMERATED_CONVERTER;
+ }
+ else if (this.resourceAttributeMapping.getTemporal() != null) {
+ return Converter.TEMPORAL_CONVERTER;
+ }
+ else if (this.resourceAttributeMapping.isLob()) {
+ return Converter.LOB_CONVERTER;
+ }
+
+ return Converter.NO_CONVERTER;
+ }
+
+ protected void updateValueConverter() {
+ if (this.valuesAreEqual(getResourceConverterType(), getConverterType())) {
+ getConverter().update();
+ }
+ else {
+ setConverter(buildConverter(getResourceConverterType()));
+ }
+ }
+
+
+ public Type getValueType() {
+ return this.valueType;
+ }
+
+ protected void setValueType(Type newValueType) {
+ Type old = this.valueType;
+ this.valueType = newValueType;
+ firePropertyChanged(VALUE_TYPE_PROPERTY, old, newValueType);
+ }
+
+ protected Type buildValueType() {
+ if (getResolvedTargetEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ else if (getTargetClass() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+ public Type getKeyType() {
+ return this.keyType;
+ }
+
+ protected void setKeyType(Type newKeyType) {
+ Type old = this.keyType;
+ this.keyType = newKeyType;
+ firePropertyChanged(KEY_TYPE_PROPERTY, old, newKeyType);
+ }
+
+ protected Type buildKeyType() {
+ return null;//TODO
+ }
+
// **************** ordering ***********************************************
public OrmOrderable getOrderable() {
return this.orderable;
}
+
+
+ // **************** overrides ***********************************************
+
+ public OrmAttributeOverrideContainer getValueAttributeOverrideContainer() {
+ return this.valueAttributeOverrideContainer;
+ }
+
+ protected OrmAttributeOverrideContainer buildValueAttributeOverrideContainer() {
+ return getXmlContextNodeFactory().buildOrmAttributeOverrideContainer(this, new AttributeOverrideContainerOwner(), this.getResourceAttributeMapping());
+ }
+
+ protected JavaAttributeOverride getJavaValueAttributeOverrideNamed(String attributeName) {
+ if (getJavaElementCollectionMapping() != null) {
+ return getJavaElementCollectionMapping().getValueAttributeOverrideContainer().getAttributeOverrideNamed(attributeName);
+ }
+ return null;
+ }
+
+ public OrmAssociationOverrideContainer getValueAssociationOverrideContainer() {
+ return this.valueAssociationOverrideContainer;
+ }
+
+ protected OrmAssociationOverrideContainer buildValueAssociationOverrideContainer() {
+ return getXmlContextNodeFactory().buildOrmAssociationOverrideContainer(this, new AssociationOverrideContainerOwner(), this.getResourceAttributeMapping());
+ }
+
+ protected JavaAssociationOverride getJavaValueAssociationOverrideNamed(String attributeName) {
+ if (getJavaElementCollectionMapping() != null) {
+ return getJavaElementCollectionMapping().getValueAssociationOverrideContainer().getAssociationOverrideNamed(attributeName);
+ }
+ return null;
+ }
-
+
+
// ********** metamodel **********
- //TODO metamodel support
+ //TODO map metamodel
+ @Override
+ protected String getMetamodelFieldTypeName() {
+ return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName();
+ }
+
+ @Override
+ public String getMetamodelTypeName() {
+ String targetClass = this.getTargetClass();
+ return (targetClass != null) ? targetClass : MetamodelField.DEFAULT_TYPE_NAME;
+ }
+
+ @Override
+ protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
+ this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames);
+ super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
+ }
+
+ protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) {
+// String keyTypeName = ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName();
+// if (keyTypeName != null) {
+// typeArgumentNames.add(keyTypeName);
+// }
+ }
+
+// public String getMetamodelFieldMapKeyTypeName() {
+// return MappingTools.getMetamodelFieldMapKeyTypeName(this);
+// }
// ********** validation **********
@@ -284,8 +515,13 @@ public class GenericOrmElementCollectionMapping2_0
public void validate(List<IMessage> messages, IReporter reporter) {
super.validate(messages, reporter);
this.validateTargetClass(messages);
- this.orderable.validate(messages, reporter);
- this.collectionTable.validate(messages, reporter);
+ this.getOrderable().validate(messages, reporter);
+ this.getCollectionTable().validate(messages, reporter);
+ this.getValueColumn().validate(messages, reporter);
+ this.getConverter().validate(messages, reporter);
+ this.getValueAttributeOverrideContainer().validate(messages, reporter);
+ this.getValueAssociationOverrideContainer().validate(messages, reporter);
+
}
protected void validateTargetClass(List<IMessage> messages) {
@@ -345,4 +581,140 @@ public class GenericOrmElementCollectionMapping2_0
protected TextRange getTargetClassTextRange() {
return this.resourceAttributeMapping.getTargetClassTextRange();
}
+
+ class ValueColumnOwner implements OrmColumn.Owner {
+
+ public XmlColumn getResourceColumn() {
+ return GenericOrmElementCollectionMapping2_0.this.resourceAttributeMapping.getColumn();
+ }
+
+ public void addResourceColumn() {
+ GenericOrmElementCollectionMapping2_0.this.resourceAttributeMapping.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
+ }
+
+ public void removeResourceColumn() {
+ GenericOrmElementCollectionMapping2_0.this.resourceAttributeMapping.setColumn(null);
+ }
+
+ public String getDefaultTableName() {
+ return getCollectionTable().getName();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericOrmElementCollectionMapping2_0.this.getTypeMapping();
+ }
+
+ public String getDefaultColumnName() {
+ return GenericOrmElementCollectionMapping2_0.this.getName();
+ }
+
+ public Table getDbTable(String tableName) {
+ if (getCollectionTable().getName().equals(tableName)) {
+ return GenericOrmElementCollectionMapping2_0.this.getCollectionTable().getDbTable();
+ }
+ return null;
+ }
+
+ public java.util.Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ /**
+ * the default table name is always valid and a specified table name
+ * is prohibited (which will be handled elsewhere)
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmElementCollectionMapping2_0.this.getValidationTextRange();
+ }
+ }
+
+ class AssociationOverrideContainerOwner implements OrmAssociationOverrideContainer.Owner {
+ public TypeMapping getOverridableTypeMapping() {
+ return GenericOrmElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
+ }
+
+ public OrmTypeMapping getTypeMapping() {
+ return GenericOrmElementCollectionMapping2_0.this.getTypeMapping();
+ }
+
+ public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
+ if (getPersistentAttribute().isVirtual() && !getTypeMapping().isMetadataComplete()) {
+ JavaAssociationOverride javaAssociationOverride = getJavaValueAssociationOverrideNamed(associationOverrideName);
+ if (javaAssociationOverride != null && !javaAssociationOverride.isVirtual()) {
+ return javaAssociationOverride.getRelationshipReference();
+ }
+ }
+ return MappingTools.resolveRelationshipReference(getOverridableTypeMapping(), associationOverrideName);
+ }
+
+ public java.util.Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ /**
+ * the default table name is always valid and a specified table name
+ * is prohibited (which will be handled elsewhere)
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ public String getDefaultTableName() {
+ return GenericOrmElementCollectionMapping2_0.this.getCollectionTable().getName();
+ }
+
+ public org.eclipse.jpt.db.Table getDbTable(String tableName) {
+ return GenericOrmElementCollectionMapping2_0.this.getCollectionTable().getDbTable();
+ }
+ }
+
+ //********** OrmAttributeOverrideContainer.Owner implementation *********
+
+ class AttributeOverrideContainerOwner implements OrmAttributeOverrideContainer.Owner {
+ public TypeMapping getOverridableTypeMapping() {
+ return GenericOrmElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
+ }
+
+ public OrmTypeMapping getTypeMapping() {
+ return GenericOrmElementCollectionMapping2_0.this.getTypeMapping();
+ }
+
+ public Column resolveOverriddenColumn(String attributeOverrideName) {
+ if (getPersistentAttribute().isVirtual() && !getTypeMapping().isMetadataComplete()) {
+ JavaAttributeOverride javaAttributeOverride = getJavaValueAttributeOverrideNamed(attributeOverrideName);
+ if (javaAttributeOverride != null && !javaAttributeOverride.isVirtual()) {
+ return javaAttributeOverride.getColumn();
+ }
+ }
+ return MappingTools.resolveOverridenColumn(getOverridableTypeMapping(), attributeOverrideName);
+ }
+
+ public XmlColumn buildVirtualXmlColumn(Column overridableColumn, String attributeName, boolean isMetadataComplete) {
+ return new VirtualXmlAttributeOverrideColumn(overridableColumn);
+ }
+
+ public String getDefaultTableName() {
+ return GenericOrmElementCollectionMapping2_0.this.getCollectionTable().getName();
+ }
+
+ public org.eclipse.jpt.db.Table getDbTable(String tableName) {
+ return GenericOrmElementCollectionMapping2_0.this.getCollectionTable().getDbTable();
+ }
+
+ public java.util.Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ /**
+ * the default table name is always valid and a specified table name
+ * is prohibited (which will be handled elsewhere)
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
index 5ffa633019..6fcb50ab15 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
@@ -58,6 +58,7 @@ public interface JpaFactory2_0
// ********** Java Context Model **********
+ //overloaded because the 2.0 JPA spec supports association overrides on an embedded mapping while the 1.0 spec did not
JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEmbeddedMapping2_0 parent, AssociationOverrideContainer.Owner owner);
JavaDerivedIdentity2_0 buildJavaDerivedIdentity(JavaSingleRelationshipMapping2_0 parent);
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/ElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/ElementCollectionMapping2_0.java
index ae81598817..cf7de8964e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/ElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/ElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 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
@@ -10,12 +10,16 @@
*******************************************************************************/
package org.eclipse.jpt.core.jpa2.context;
+import org.eclipse.jpt.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.core.context.AttributeOverrideContainer;
import org.eclipse.jpt.core.context.CollectionMapping;
+import org.eclipse.jpt.core.context.Column;
+import org.eclipse.jpt.core.context.ConvertibleMapping;
import org.eclipse.jpt.core.context.Embeddable;
import org.eclipse.jpt.core.context.Entity;
public interface ElementCollectionMapping2_0
- extends AttributeMapping2_0, CollectionMapping
+ extends AttributeMapping2_0, CollectionMapping, ConvertibleMapping
{
/**
* Return the entity that owns the mapping. This is
@@ -40,17 +44,46 @@ public interface ElementCollectionMapping2_0
*/
Embeddable getResolvedTargetEmbeddable();
String RESOLVED_TARGET_EMBEDDABLE_PROPERTY = "resolvedTargetEmbeddable"; //$NON-NLS-1$
+
/**
* Return the char to be used for browsing or creating the target class IType.
* @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char)
*/
char getTargetClassEnclosingTypeSeparator();
-
- // **************** table **************************************
+
+ Type getValueType();
+ String VALUE_TYPE_PROPERTY = "valueType"; //$NON-NLS-1$
+
+ Type getKeyType();
+ String KEY_TYPE_PROPERTY = "keyType"; //$NON-NLS-1$
+
+ public enum Type {
+ EMBEDDABLE_TYPE,
+ BASIC_TYPE,
+ NO_TYPE
+ }
+
+
+ // **************** collection table **************************************
/**
* Return the collection table for this element collection mapping.
* This will not be null.
*/
CollectionTable2_0 getCollectionTable();
+
+
+ // **************** value column **************************************
+
+ /**
+ * Return the value column for this element collection mapping.
+ */
+ Column getValueColumn();
+
+
+ // ******************* overrides **************************************
+ AttributeOverrideContainer getValueAttributeOverrideContainer();
+
+ AssociationOverrideContainer getValueAssociationOverrideContainer();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaElementCollectionMapping2_0.java
index c1017b9433..5ac5938071 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 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
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.jpt.core.jpa2.context.java;
+import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.core.context.java.JavaColumn;
import org.eclipse.jpt.core.jpa2.context.ElementCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
@@ -30,4 +33,11 @@ public interface JavaElementCollectionMapping2_0
JavaCollectionTable2_0 getCollectionTable();
CollectionTable2_0Annotation getCollectionTableAnnotation();
+
+ JavaColumn getValueColumn();
+
+ JavaAttributeOverrideContainer getValueAttributeOverrideContainer();
+
+ JavaAssociationOverrideContainer getValueAssociationOverrideContainer();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java
index 15b779d310..fb3d81ac4d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 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
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.jpt.core.jpa2.context.orm;
+import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.core.context.orm.OrmColumn;
import org.eclipse.jpt.core.jpa2.context.ElementCollectionMapping2_0;
import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
@@ -28,7 +31,13 @@ public interface OrmElementCollectionMapping2_0
extends OrmAttributeMapping, ElementCollectionMapping2_0
{
OrmCollectionTable2_0 getCollectionTable();
-
+
XmlElementCollection getResourceAttributeMapping();
+ OrmColumn getValueColumn();
+
+ OrmAttributeOverrideContainer getValueAttributeOverrideContainer();
+
+ OrmAssociationOverrideContainer getValueAssociationOverrideContainer();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java
index 5793895405..e46bb951d5 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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.
@@ -36,6 +36,7 @@ public interface OrmXml2_0ContextNodeFactory extends OrmXmlContextNodeFactory
{
// ********** ORM Context Model **********
+ //overloaded because the 2.0 JPA spec supports association overrides on an embedded mapping while the 1.0 spec did not
OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(
OrmEmbeddedMapping2_0 parent,
OrmAssociationOverrideContainer.Owner owner,
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
index 8398d335d6..5780e9aa8c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 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,10 +11,8 @@
package org.eclipse.jpt.core.resource.orm;
-import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
@@ -1742,112 +1740,112 @@ public class OrmPackage extends EPackageImpl
public static final int XML_ELEMENT_COLLECTION__ORDER_BY = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
/**
- * The feature id for the '<em><b>Target Class</b></em>' attribute.
+ * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION__TARGET_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+ public static final int XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
/**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION__FETCH = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
+ public static final int XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_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__MAP_KEY = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
+ public static final int XML_ELEMENT_COLLECTION__TARGET_CLASS = ABSTRACT_XML_ATTRIBUTE_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__MAP_KEY_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 8;
+ public static final int XML_ELEMENT_COLLECTION__FETCH = ABSTRACT_XML_ATTRIBUTE_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__MAP_KEY_TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 9;
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY = ABSTRACT_XML_ATTRIBUTE_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__MAP_KEY_ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10;
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10;
/**
- * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * 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__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 11;
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 11;
/**
- * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * 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__MAP_KEY_COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 12;
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 12;
/**
- * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 13;
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 13;
/**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 14;
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 14;
/**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 15;
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 15;
/**
- * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 16;
+ public static final int XML_ELEMENT_COLLECTION__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 16;
/**
* The feature id for the '<em><b>Collection Table</b></em>' containment reference.
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlElementCollection.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlElementCollection.java
index 6662a21b83..0d485edacd 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlElementCollection.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlElementCollection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 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
@@ -127,6 +127,26 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
protected String orderBy = ORDER_BY_EDEFAULT;
/**
+ * The cached value of the '{@link #getAttributeOverrides() <em>Attribute Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAttributeOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlAttributeOverride> attributeOverrides;
+
+ /**
+ * The cached value of the '{@link #getAssociationOverrides() <em>Association Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAssociationOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlAssociationOverride> associationOverrides;
+
+ /**
* The default value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -255,26 +275,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
protected XmlColumn column;
/**
- * The cached value of the '{@link #getAttributeOverrides() <em>Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<XmlAttributeOverride> attributeOverrides;
-
- /**
- * The cached value of the '{@link #getAssociationOverrides() <em>Association Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAssociationOverrides()
- * @generated
- * @ordered
- */
- protected EList<XmlAssociationOverride> associationOverrides;
-
- /**
* The cached value of the '{@link #getCollectionTable() <em>Collection Table</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -525,6 +525,52 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
}
/**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.resource.orm.XmlAttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlAttributeOverrideContainer_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAttributeOverride> getAttributeOverrides()
+ {
+ if (attributeOverrides == null)
+ {
+ attributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES);
+ }
+ return attributeOverrides;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Association Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.resource.orm.XmlAssociationOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Association Overrides</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Association Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlAssociationOverrideContainer_AssociationOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAssociationOverride> getAssociationOverrides()
+ {
+ if (associationOverrides == null)
+ {
+ associationOverrides = new EObjectContainmentEList<XmlAssociationOverride>(XmlAssociationOverride.class, this, OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES);
+ }
+ return associationOverrides;
+ }
+
+ /**
* Returns the value of the '<em><b>Order Column</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
@@ -947,52 +993,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
}
/**
- * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.resource.orm.XmlAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_AttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<XmlAttributeOverride> getAttributeOverrides()
- {
- if (attributeOverrides == null)
- {
- attributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES);
- }
- return attributeOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.resource.orm.XmlAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Association Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_AssociationOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<XmlAssociationOverride> getAssociationOverrides()
- {
- if (associationOverrides == null)
- {
- associationOverrides = new EObjectContainmentEList<XmlAssociationOverride>(XmlAssociationOverride.class, this, OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES);
- }
- return associationOverrides;
- }
-
- /**
* Returns the value of the '<em><b>Collection Table</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
@@ -1064,6 +1064,10 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
{
case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN:
return basicSetOrderColumn(null, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ return ((InternalEList<?>)getAttributeOverrides()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ return ((InternalEList<?>)getAssociationOverrides()).basicRemove(otherEnd, msgs);
case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY:
return basicSetMapKey(null, msgs);
case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS:
@@ -1076,10 +1080,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
return ((InternalEList<?>)getMapKeyJoinColumns()).basicRemove(otherEnd, msgs);
case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
return basicSetColumn(null, msgs);
- case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
- return ((InternalEList<?>)getAttributeOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
- return ((InternalEList<?>)getAssociationOverrides()).basicRemove(otherEnd, msgs);
case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
return basicSetCollectionTable(null, msgs);
}
@@ -1106,6 +1106,10 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
return getOrderColumn();
case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY:
return getOrderBy();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ return getAttributeOverrides();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ return getAssociationOverrides();
case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS:
return getTargetClass();
case OrmPackage.XML_ELEMENT_COLLECTION__FETCH:
@@ -1126,10 +1130,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
return getMapKeyJoinColumns();
case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
return getColumn();
- case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
- return getAttributeOverrides();
- case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
- return getAssociationOverrides();
case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
return getCollectionTable();
}
@@ -1162,6 +1162,14 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY:
setOrderBy((String)newValue);
return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ getAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ getAssociationOverrides().addAll((Collection<? extends XmlAssociationOverride>)newValue);
+ return;
case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS:
setTargetClass((String)newValue);
return;
@@ -1194,14 +1202,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
setColumn((XmlColumn)newValue);
return;
- case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
- getAttributeOverrides().clear();
- getAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)newValue);
- return;
- case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
- getAssociationOverrides().clear();
- getAssociationOverrides().addAll((Collection<? extends XmlAssociationOverride>)newValue);
- return;
case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
setCollectionTable((XmlCollectionTable)newValue);
return;
@@ -1234,6 +1234,12 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY:
setOrderBy(ORDER_BY_EDEFAULT);
return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ return;
case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS:
setTargetClass(TARGET_CLASS_EDEFAULT);
return;
@@ -1264,12 +1270,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
setColumn((XmlColumn)null);
return;
- case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
- getAttributeOverrides().clear();
- return;
- case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
- getAssociationOverrides().clear();
- return;
case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
setCollectionTable((XmlCollectionTable)null);
return;
@@ -1297,6 +1297,10 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
return orderColumn != null;
case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY:
return ORDER_BY_EDEFAULT == null ? orderBy != null : !ORDER_BY_EDEFAULT.equals(orderBy);
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ return attributeOverrides != null && !attributeOverrides.isEmpty();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ return associationOverrides != null && !associationOverrides.isEmpty();
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:
@@ -1317,10 +1321,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
return mapKeyJoinColumns != null && !mapKeyJoinColumns.isEmpty();
case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
return column != null;
- case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
- return attributeOverrides != null && !attributeOverrides.isEmpty();
- case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
- return associationOverrides != null && !associationOverrides.isEmpty();
case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
return collectionTable != null;
}
@@ -1361,6 +1361,22 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
default: return -1;
}
}
+ if (baseClass == XmlAttributeOverrideContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAssociationOverrideContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES: return OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES;
+ default: return -1;
+ }
+ }
if (baseClass == XmlElementCollection_2_0.class)
{
switch (derivedFeatureID)
@@ -1375,8 +1391,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
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;
- case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__ATTRIBUTE_OVERRIDES;
- case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__ASSOCIATION_OVERRIDES;
case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__COLLECTION_TABLE;
default: return -1;
}
@@ -1418,6 +1432,22 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
default: return -1;
}
}
+ if (baseClass == XmlAttributeOverrideContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAssociationOverrideContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES: return OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES;
+ default: return -1;
+ }
+ }
if (baseClass == XmlElementCollection_2_0.class)
{
switch (baseFeatureID)
@@ -1432,8 +1462,6 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
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;
- case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES;
- case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__ASSOCIATION_OVERRIDES: return OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES;
case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__COLLECTION_TABLE: return OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE;
default: return -1;
}
@@ -1523,8 +1551,8 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
buildTemporalTranslator(),
buildEnumeratedTranslator(),
buildLobTranslator(),
- XmlAttributeOverride.buildTranslator(JPA.ATTRIBUTE_OVERRIDE, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_AttributeOverrides()),
- XmlAssociationOverride.buildTranslator(JPA.ASSOCIATION_OVERRIDE, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_AssociationOverrides()),
+ buildAttributeOverrideTranslator(),
+ buildAssociationOverrideTranslator(),
XmlCollectionTable.buildTranslator(JPA2_0.COLLECTION_TABLE, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_CollectionTable())
};
}
@@ -1575,5 +1603,13 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
protected static Translator buildMapKeyEnumeratedTranslator() {
return new Translator(JPA2_0.MAP_KEY_ENUMERATED, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKeyEnumerated());
+ }
+
+ protected static Translator buildAttributeOverrideTranslator() {
+ return XmlAttributeOverride.buildTranslator(JPA.ATTRIBUTE_OVERRIDE, OrmPackage.eINSTANCE.getXmlAttributeOverrideContainer_AttributeOverrides());
+ }
+
+ protected static Translator buildAssociationOverrideTranslator() {
+ return XmlAssociationOverride.buildTranslator(JPA.ASSOCIATION_OVERRIDE, OrmPackage.eINSTANCE.getXmlAssociationOverrideContainer_AssociationOverrides());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/OrmV2_0Package.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/OrmV2_0Package.java
index 875d621ce8..09dd81b321 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/OrmV2_0Package.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/OrmV2_0Package.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 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
@@ -315,112 +315,112 @@ public class OrmV2_0Package extends EPackageImpl
public static final int XML_ELEMENT_COLLECTION_20__ORDER_BY = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 1;
/**
- * The feature id for the '<em><b>Target Class</b></em>' attribute.
+ * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION_20__TARGET_CLASS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 2;
+ public static final int XML_ELEMENT_COLLECTION_20__ATTRIBUTE_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 2;
/**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION_20__FETCH = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 3;
+ public static final int XML_ELEMENT_COLLECTION_20__ASSOCIATION_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 3;
/**
- * 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 + 4;
+ public static final int XML_ELEMENT_COLLECTION_20__TARGET_CLASS = OrmPackage.XML_CONVERTIBLE_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>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 + 5;
+ public static final int XML_ELEMENT_COLLECTION_20__FETCH = OrmPackage.XML_CONVERTIBLE_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</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 + 6;
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY = OrmPackage.XML_CONVERTIBLE_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 XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 7;
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 7;
/**
- * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * 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__MAP_KEY_ATTRIBUTE_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 8;
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 8;
/**
- * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * 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__MAP_KEY_COLUMN = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 9;
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 9;
/**
- * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 10;
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_ATTRIBUTE_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 10;
/**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION_20__COLUMN = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 11;
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 11;
/**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION_20__ATTRIBUTE_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 12;
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 12;
/**
- * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- public static final int XML_ELEMENT_COLLECTION_20__ASSOCIATION_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 13;
+ public static final int XML_ELEMENT_COLLECTION_20__COLUMN = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 13;
/**
* The feature id for the '<em><b>Collection Table</b></em>' containment reference.
@@ -1912,36 +1912,6 @@ public class OrmV2_0Package extends EPackageImpl
/**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getAttributeOverrides <em>Attribute Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Attribute Overrides</em>'.
- * @see org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getAttributeOverrides()
- * @see #getXmlElementCollection_2_0()
- * @generated
- */
- public EReference getXmlElementCollection_2_0_AttributeOverrides()
- {
- return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(10);
- }
-
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getAssociationOverrides <em>Association Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Association Overrides</em>'.
- * @see org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getAssociationOverrides()
- * @see #getXmlElementCollection_2_0()
- * @generated
- */
- public EReference getXmlElementCollection_2_0_AssociationOverrides()
- {
- return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(11);
- }
-
-
- /**
* Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getCollectionTable <em>Collection Table</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1952,7 +1922,7 @@ public class OrmV2_0Package extends EPackageImpl
*/
public EReference getXmlElementCollection_2_0_CollectionTable()
{
- return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(12);
+ return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(10);
}
@@ -2846,8 +2816,6 @@ public class OrmV2_0Package extends EPackageImpl
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);
- createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__ATTRIBUTE_OVERRIDES);
- createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__ASSOCIATION_OVERRIDES);
createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__COLLECTION_TABLE);
xmlEmbedded_2_0EClass = createEClass(XML_EMBEDDED_20);
@@ -2970,6 +2938,8 @@ public class OrmV2_0Package extends EPackageImpl
xmlCollectionTable_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlReferenceTable());
xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlConvertibleMapping());
xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlOrderable());
+ xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAttributeOverrideContainer());
+ xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAssociationOverrideContainer());
xmlEmbedded_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAssociationOverrideContainer());
xmlEntity_2_0EClass.getESuperTypes().add(this.getXmlCacheable_2_0());
xmlManyToMany_2_0EClass.getESuperTypes().add(this.getXmlOrderable_2_0());
@@ -3010,8 +2980,6 @@ public class OrmV2_0Package extends EPackageImpl
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);
- initEReference(getXmlElementCollection_2_0_AttributeOverrides(), theOrmPackage.getXmlAttributeOverride(), null, "attributeOverrides", 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_AssociationOverrides(), theOrmPackage.getXmlAssociationOverride(), null, "associationOverrides", 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_CollectionTable(), theOrmPackage.getXmlCollectionTable(), null, "collectionTable", 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);
initEClass(xmlEmbedded_2_0EClass, XmlEmbedded_2_0.class, "XmlEmbedded_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -3318,22 +3286,6 @@ public class OrmV2_0Package extends EPackageImpl
public static final EReference XML_ELEMENT_COLLECTION_20__COLUMN = eINSTANCE.getXmlElementCollection_2_0_Column();
/**
- * The meta object literal for the '<em><b>Attribute Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ELEMENT_COLLECTION_20__ATTRIBUTE_OVERRIDES = eINSTANCE.getXmlElementCollection_2_0_AttributeOverrides();
-
- /**
- * The meta object literal for the '<em><b>Association Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ELEMENT_COLLECTION_20__ASSOCIATION_OVERRIDES = eINSTANCE.getXmlElementCollection_2_0_AssociationOverrides();
-
- /**
* The meta object literal for the '<em><b>Collection Table</b></em>' containment reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/XmlElementCollection_2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/XmlElementCollection_2_0.java
index f933bc373d..bdc2ec3b51 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/XmlElementCollection_2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/v2_0/XmlElementCollection_2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 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
@@ -16,8 +16,9 @@ import org.eclipse.jpt.core.resource.orm.EnumType;
import org.eclipse.jpt.core.resource.orm.FetchType;
import org.eclipse.jpt.core.resource.orm.MapKey;
import org.eclipse.jpt.core.resource.orm.TemporalType;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
+import org.eclipse.jpt.core.resource.orm.XmlAssociationOverrideContainer;
import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.jpt.core.resource.orm.XmlAttributeOverrideContainer;
import org.eclipse.jpt.core.resource.orm.XmlCollectionTable;
import org.eclipse.jpt.core.resource.orm.XmlColumn;
import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
@@ -44,8 +45,6 @@ import org.eclipse.jpt.core.utility.TextRange;
* <li>{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyColumn <em>Map Key Column</em>}</li>
* <li>{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyJoinColumns <em>Map Key Join Columns</em>}</li>
* <li>{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getColumn <em>Column</em>}</li>
- * <li>{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getAttributeOverrides <em>Attribute Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getAssociationOverrides <em>Association Overrides</em>}</li>
* <li>{@link org.eclipse.jpt.core.resource.orm.v2_0.XmlElementCollection_2_0#getCollectionTable <em>Collection Table</em>}</li>
* </ul>
* </p>
@@ -54,7 +53,7 @@ import org.eclipse.jpt.core.utility.TextRange;
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface XmlElementCollection_2_0 extends XmlConvertibleMapping, XmlOrderable
+public interface XmlElementCollection_2_0 extends XmlConvertibleMapping, XmlOrderable, XmlAttributeOverrideContainer, XmlAssociationOverrideContainer
{
/**
* Returns the value of the '<em><b>Target Class</b></em>' attribute.
@@ -306,38 +305,6 @@ public interface XmlElementCollection_2_0 extends XmlConvertibleMapping, XmlOrde
void setColumn(XmlColumn value);
/**
- * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.resource.orm.XmlAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_AttributeOverrides()
- * @model containment="true"
- * @generated
- */
- EList<XmlAttributeOverride> getAttributeOverrides();
-
- /**
- * Returns the value of the '<em><b>Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.resource.orm.XmlAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Association Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_AssociationOverrides()
- * @model containment="true"
- * @generated
- */
- EList<XmlAssociationOverride> getAssociationOverrides();
-
- /**
* Returns the value of the '<em><b>Collection Table</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java
index 86332273c1..ead18e08ca 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 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.
@@ -1228,6 +1228,22 @@ public class EclipseLinkOrmPackage extends EPackageImpl
*/
public static final int XML_ELEMENT_COLLECTION__ORDER_BY = OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY;
/**
+ * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES = OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES;
+ /**
+ * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES = OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES;
+ /**
* The feature id for the '<em><b>Target Class</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1308,22 +1324,6 @@ public class EclipseLinkOrmPackage extends EPackageImpl
*/
public static final int XML_ELEMENT_COLLECTION__COLUMN = OrmPackage.XML_ELEMENT_COLLECTION__COLUMN;
/**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES = OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES;
- /**
- * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES = OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES;
- /**
* The feature id for the '<em><b>Collection Table</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/XmlElementCollection.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/XmlElementCollection.java
index d3381a493f..6fd3f235e3 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/XmlElementCollection.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/orm/XmlElementCollection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 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
@@ -1191,8 +1191,8 @@ public class XmlElementCollection extends org.eclipse.jpt.core.resource.orm.XmlE
buildEnumeratedTranslator(),
buildLobTranslator(),
buildConvertTranslator(),
- XmlAttributeOverride.buildTranslator(JPA.ATTRIBUTE_OVERRIDE, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_AttributeOverrides()),
- XmlAssociationOverride.buildTranslator(JPA.ASSOCIATION_OVERRIDE, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_AssociationOverrides()),
+ buildAttributeOverrideTranslator(),
+ buildAssociationOverrideTranslator(),
XmlConverter.buildTranslator(EclipseLink.CONVERTER, EclipseLinkOrmPackage.eINSTANCE.getXmlConverterHolder_Converter()),
XmlConverter.buildTranslator(EclipseLink.TYPE_CONVERTER, EclipseLinkOrmPackage.eINSTANCE.getXmlConverterHolder_TypeConverter()),
XmlConverter.buildTranslator(EclipseLink.OBJECT_TYPE_CONVERTER, EclipseLinkOrmPackage.eINSTANCE.getXmlConverterHolder_ObjectTypeConverter()),
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_details2_0.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_details2_0.properties
index b3720236fb..ea75f042fb 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_details2_0.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_details2_0.properties
@@ -23,7 +23,7 @@ DerivedIdentity_mapsIdUnspecifiedValue=<undetermined value>
ElementCollectionMapping2_0_label=Element Collection
ElementCollectionMapping2_0_linkLabel=element collection
-
+AbstractElementCollectionMapping2_0_Composite_valueSectionTitle=Value
Entity_cacheableLabel=Cacheable
Entity_cacheableWithDefaultLabel=Cacheable ({0})
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0Composite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0Composite.java
index 9d5572b187..9ced1196ea 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0Composite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0Composite.java
@@ -9,15 +9,36 @@
******************************************************************************/
package org.eclipse.jpt.ui.internal.jpa2.details;
+import org.eclipse.jpt.core.context.BasicMapping;
+import org.eclipse.jpt.core.context.Column;
+import org.eclipse.jpt.core.context.Converter;
+import org.eclipse.jpt.core.context.ConvertibleMapping;
+import org.eclipse.jpt.core.context.EnumeratedConverter;
+import org.eclipse.jpt.core.context.TemporalConverter;
import org.eclipse.jpt.core.jpa2.context.CollectionTable2_0;
import org.eclipse.jpt.core.jpa2.context.ElementCollectionMapping2_0;
import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.internal.details.ColumnComposite;
+import org.eclipse.jpt.ui.internal.details.EnumTypeComposite;
import org.eclipse.jpt.ui.internal.details.FetchTypeComposite;
+import org.eclipse.jpt.ui.internal.details.JptUiDetailsMessages;
+import org.eclipse.jpt.ui.internal.details.TemporalTypeComposite;
+import org.eclipse.jpt.ui.internal.util.ControlSwitcher;
import org.eclipse.jpt.ui.internal.widgets.Pane;
+import org.eclipse.jpt.utility.internal.Transformer;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.PageBook;
/**
* Here the layout of this pane:
@@ -63,13 +84,18 @@ import org.eclipse.swt.widgets.Composite;
* @see OptionalComposite
* @see TemporalTypeComposite
*
- * @version 2.0
- * @since 1.0
+ * @version 2.3
+ * @since 2.3
*/
public abstract class AbstractElementCollectionMapping2_0Composite<T extends ElementCollectionMapping2_0>
extends Pane<T>
implements JpaComposite
{
+
+ private Composite basicValueComposite;
+
+ private Composite embeddableValueComposite;
+
/**
* Creates a new <code>BasicMappingComposite</code>.
*
@@ -87,6 +113,9 @@ public abstract class AbstractElementCollectionMapping2_0Composite<T extends Ele
@Override
protected void initializeLayout(Composite container) {
initializeGeneralPane(container);
+ this.initializeValuePane(container);
+ this.initializeKeyPane(container);
+ new Ordering2_0Composite(this, container);
}
protected void initializeGeneralPane(Composite container) {
@@ -94,7 +123,123 @@ public abstract class AbstractElementCollectionMapping2_0Composite<T extends Ele
new TargetClassComposite(this, this.addPane(container, groupBoxMargin));
new FetchTypeComposite(this, this.addPane(container, groupBoxMargin));
new CollectionTable2_0Composite(this, buildCollectionTableHolder(), container);
- new Ordering2_0Composite(this, container);
+ }
+
+ protected void initializeValuePane(Composite container) {
+ Composite valueSection = addCollapsibleSection(
+ container,
+ JptUiDetailsMessages2_0.AbstractElementCollectionMapping2_0_Composite_valueSectionTitle
+ );
+ PageBook pageBook = new PageBook(valueSection, SWT.NULL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalIndent = 5;
+ pageBook.setLayoutData(gd);
+
+ this.initializeBasicValueSection(pageBook);
+ this.initializeEmbeddableValueSection(pageBook);
+
+ installValueControlSwitcher(pageBook);
+ }
+
+ protected void initializeBasicValueSection(Composite container) {
+ this.basicValueComposite = addSubPane(container);
+
+ new ColumnComposite(this, buildValueColumnHolder(), this.basicValueComposite);
+
+ // type section
+ Composite converterSection = addCollapsibleSubSection(
+ this.basicValueComposite,
+ JptUiDetailsMessages.TypeSection_type,
+ new SimplePropertyValueModel<Boolean>(Boolean.FALSE)
+ );
+ ((GridLayout) converterSection.getLayout()).numColumns = 2;
+
+ // No converter
+ Button noConverterButton = addRadioButton(
+ converterSection,
+ JptUiDetailsMessages.TypeSection_default,
+ buildNoConverterHolder(),
+ null);
+ ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2;
+
+ // Lob
+ Button lobButton = addRadioButton(
+ converterSection,
+ JptUiDetailsMessages.TypeSection_lob,
+ buildLobConverterHolder(),
+ null);
+ ((GridData) lobButton.getLayoutData()).horizontalSpan = 2;
+
+
+ PropertyValueModel<Converter> converterHolder = buildConverterHolder();
+ // Temporal
+ addRadioButton(
+ converterSection,
+ JptUiDetailsMessages.TypeSection_temporal,
+ buildTemporalBooleanHolder(),
+ null);
+ registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(converterHolder), converterSection, getWidgetFactory()));
+
+
+ // Enumerated
+ addRadioButton(
+ converterSection,
+ JptUiDetailsMessages.TypeSection_enumerated,
+ buildEnumeratedBooleanHolder(),
+ null);
+ registerSubPane(new EnumTypeComposite(buildEnumeratedConverterHolder(converterHolder), converterSection, getWidgetFactory()));
+ }
+
+ protected void initializeEmbeddableValueSection(Composite container) {
+ this.embeddableValueComposite = new ElementCollectionValueOverridesComposite(this, container).getControl();
+ }
+
+ private void installValueControlSwitcher(PageBook pageBook) {
+
+ new ControlSwitcher(
+ buildValueHolder(),
+ buildPaneTransformer(),
+ pageBook
+ );
+ }
+
+ protected PropertyValueModel<ElementCollectionMapping2_0.Type> buildValueHolder() {
+ return new PropertyAspectAdapter<T, ElementCollectionMapping2_0.Type>(
+ this.getSubjectHolder(), ElementCollectionMapping2_0.VALUE_TYPE_PROPERTY) {
+ @Override
+ protected ElementCollectionMapping2_0.Type buildValue_() {
+ return this.subject.getValueType();
+ }
+ };
+ }
+
+ private Transformer<ElementCollectionMapping2_0.Type, Control> buildPaneTransformer() {
+ return new Transformer<ElementCollectionMapping2_0.Type, Control>() {
+ public Control transform(ElementCollectionMapping2_0.Type type) {
+ return AbstractElementCollectionMapping2_0Composite.this.transformValueType(type);
+ }
+ };
+ }
+
+ /**
+ * Given the selected override, return the control that will be displayed
+ */
+ protected Control transformValueType(ElementCollectionMapping2_0.Type type) {
+ if (type == null) {
+ return null;
+ }
+ switch (type) {
+ case BASIC_TYPE :
+ return this.basicValueComposite;
+ case EMBEDDABLE_TYPE :
+ return this.embeddableValueComposite;
+ default :
+ return null;
+ }
+ }
+
+ protected void initializeKeyPane(Composite container) {
+
}
protected PropertyValueModel<CollectionTable2_0> buildCollectionTableHolder() {
@@ -105,7 +250,109 @@ public abstract class AbstractElementCollectionMapping2_0Composite<T extends Ele
}
};
}
+
+ protected PropertyValueModel<Column> buildValueColumnHolder() {
+ return new PropertyAspectAdapter<ElementCollectionMapping2_0, Column>(getSubjectHolder()) {
+ @Override
+ protected Column buildValue_() {
+ return this.subject.getValueColumn();
+ }
+ };
+ }
+ private WritablePropertyValueModel<Boolean> buildNoConverterHolder() {
+ return new PropertyAspectAdapter<T, Boolean>(getSubjectHolder(), ConvertibleMapping.CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.getConverter().getType() == Converter.NO_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setConverter(Converter.NO_CONVERTER);
+ }
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildLobConverterHolder() {
+ return new PropertyAspectAdapter<T, Boolean>(getSubjectHolder(), ConvertibleMapping.CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ Converter converter = this.subject.getConverter();
+ return Boolean.valueOf(converter.getType() == Converter.LOB_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setConverter(Converter.LOB_CONVERTER);
+ }
+ }
+ };
+ }
+
+ private PropertyValueModel<Converter> buildConverterHolder() {
+ return new PropertyAspectAdapter<T, Converter>(getSubjectHolder(), ConvertibleMapping.CONVERTER_PROPERTY) {
+ @Override
+ protected Converter buildValue_() {
+ return this.subject.getConverter();
+ }
+ };
+ }
+
+ private PropertyValueModel<TemporalConverter> buildTemporalConverterHolder(PropertyValueModel<Converter> converterHolder) {
+ return new TransformationPropertyValueModel<Converter, TemporalConverter>(converterHolder) {
+ @Override
+ protected TemporalConverter transform_(Converter converter) {
+ return converter.getType() == Converter.TEMPORAL_CONVERTER ? (TemporalConverter) converter : null;
+ }
+ };
+ }
+
+ private PropertyValueModel<EnumeratedConverter> buildEnumeratedConverterHolder(PropertyValueModel<Converter> converterHolder) {
+ return new TransformationPropertyValueModel<Converter, EnumeratedConverter>(converterHolder) {
+ @Override
+ protected EnumeratedConverter transform_(Converter converter) {
+ return converter.getType() == Converter.ENUMERATED_CONVERTER ? (EnumeratedConverter) converter : null;
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildTemporalBooleanHolder() {
+ return new PropertyAspectAdapter<T, Boolean>(getSubjectHolder(), ConvertibleMapping.CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ Converter converter = this.subject.getConverter();
+ return Boolean.valueOf(converter.getType() == Converter.TEMPORAL_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setConverter(Converter.TEMPORAL_CONVERTER);
+ }
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildEnumeratedBooleanHolder() {
+ return new PropertyAspectAdapter<T, Boolean>(getSubjectHolder(), ConvertibleMapping.CONVERTER_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ Converter converter = this.subject.getConverter();
+ return Boolean.valueOf(converter.getType() == Converter.ENUMERATED_CONVERTER);
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value.booleanValue()) {
+ this.subject.setConverter(Converter.ENUMERATED_CONVERTER);
+ }
+ }
+ };
+ }
protected Composite addPane(Composite container, int groupBoxMargin) {
return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AssociationOverride2_0Composite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AssociationOverride2_0Composite.java
index 83b5286d4c..7c7b09b4ff 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AssociationOverride2_0Composite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/AssociationOverride2_0Composite.java
@@ -24,7 +24,8 @@ import org.eclipse.swt.widgets.Composite;
* <pre>
* -----------------------------------------------------------------------------
* | |
- * | JoinColumnsComposite |
+ * | JoinColumnJoiningStrategyPane |
+ * | JoinTableJoiningStrategyPane |
* | |
* -----------------------------------------------------------------------------</pre>
*
@@ -32,7 +33,7 @@ import org.eclipse.swt.widgets.Composite;
* @see EntityOverridesComposite - The parent container
* @see JoinColumnsComposite
*
- * @version 2.2
+ * @version 2.3
* @since 1.0
*/
public class AssociationOverride2_0Composite
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionMapping2_0Composite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionMapping2_0Composite.java
index 730ec20195..9d00a0c650 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionMapping2_0Composite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionMapping2_0Composite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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.
@@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Composite;
* -----------------------------------------------------------------------------
* | ------------------------------------------------------------------------- |
* | | | |
- * | | ColumnComposite | |
+ * | | TargetClassComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
@@ -31,12 +31,12 @@ import org.eclipse.swt.widgets.Composite;
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
- * | | TemporalTypeComposite | |
+ * | | CollectionTableComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
- * | | EnumTypeComposite | |
+ * | | ColumnComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionValueOverridesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionValueOverridesComposite.java
new file mode 100644
index 0000000000..9230cc9596
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/ElementCollectionValueOverridesComposite.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.ui.internal.jpa2.details;
+
+import org.eclipse.jpt.core.context.AssociationOverride;
+import org.eclipse.jpt.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.core.jpa2.context.ElementCollectionMapping2_0;
+import org.eclipse.jpt.ui.internal.details.AbstractOverridesComposite;
+import org.eclipse.jpt.ui.internal.details.AssociationOverrideComposite;
+import org.eclipse.jpt.ui.internal.widgets.Pane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.PageBook;
+
+/**
+ * Here is the layout of this pane:
+ * <pre>
+ * --------------------------------------------------------------------------------
+ * | |
+ * | - Attribute Overrides ------------------------------------------------------ |
+ * | | ------------------------------------------------------------------------ | |
+ * | | | | | |
+ * | | | AddRemoveListPane | | |
+ * | | | | | |
+ * | | ------------------------------------------------------------------------ | |
+ * | | | |
+ * | | x Override Default | |
+ * | | | |
+ * | | ------------------------------------------------------------------------ | |
+ * | | | | | |
+ * | | | PageBook (AttributeOverrideComposite/AssociationOverride2_0Composite)| | |
+ * | | | | | |
+ * | | ------------------------------------------------------------------------ | |
+ * | ---------------------------------------------------------------------------- |
+ * --------------------------------------------------------------------------------</pre>
+ *
+ * @see ElementCollectionMapping2_0
+ * @see AbstractElementCollectionMapping2_0Composite - The parent container
+ * @see AttributeOverrideComposite
+ * @see AssociationOverride2_0Composite
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public final class ElementCollectionValueOverridesComposite extends AbstractOverridesComposite<ElementCollectionMapping2_0>
+{
+
+ /**
+ * Creates a new <code>OverridesComposite</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param parent The parent container
+ */
+ public ElementCollectionValueOverridesComposite(Pane<? extends ElementCollectionMapping2_0> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ @Override
+ protected boolean supportsAssociationOverrides() {
+ return true;
+ }
+
+ @Override
+ protected Pane<AssociationOverride> buildAssociationOverridePane(PageBook pageBook, PropertyValueModel<AssociationOverride> associationOverrideHolder) {
+ return new AssociationOverrideComposite(this, associationOverrideHolder, pageBook);
+ }
+
+ @Override
+ protected PropertyValueModel<AttributeOverrideContainer> buildAttributeOverrideContainerHolder() {
+ return new PropertyAspectAdapter<ElementCollectionMapping2_0, AttributeOverrideContainer>(getSubjectHolder()) {
+ @Override
+ protected AttributeOverrideContainer buildValue_() {
+ return this.subject.getValueAttributeOverrideContainer();
+ }
+ };
+ }
+
+ @Override
+ protected PropertyValueModel<AssociationOverrideContainer> buildAssociationOverrideContainerHolder() {
+ return new PropertyAspectAdapter<ElementCollectionMapping2_0, AssociationOverrideContainer>(getSubjectHolder()) {
+ @Override
+ protected AssociationOverrideContainer buildValue_() {
+ return this.subject.getValueAssociationOverrideContainer();
+ }
+ };
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/JptUiDetailsMessages2_0.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/JptUiDetailsMessages2_0.java
index a0bab86d22..2227252428 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/JptUiDetailsMessages2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/JptUiDetailsMessages2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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.
@@ -35,6 +35,8 @@ public class JptUiDetailsMessages2_0
public static String ElementCollectionMapping2_0_label;
public static String ElementCollectionMapping2_0_linkLabel;
+ public static String AbstractElementCollectionMapping2_0_Composite_valueSectionTitle;
+
public static String Entity_cacheableLabel;
public static String Entity_cacheableWithDefaultLabel;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/orm/OrmElementCollectionMapping2_0Composite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/orm/OrmElementCollectionMapping2_0Composite.java
index 78699cbf4e..a7c6c8df87 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/orm/OrmElementCollectionMapping2_0Composite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/details/orm/OrmElementCollectionMapping2_0Composite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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.
@@ -16,7 +16,6 @@ import org.eclipse.jpt.ui.internal.details.AccessTypeComposite;
import org.eclipse.jpt.ui.internal.details.FetchTypeComposite;
import org.eclipse.jpt.ui.internal.jpa2.details.AbstractElementCollectionMapping2_0Composite;
import org.eclipse.jpt.ui.internal.jpa2.details.CollectionTable2_0Composite;
-import org.eclipse.jpt.ui.internal.jpa2.details.Ordering2_0Composite;
import org.eclipse.jpt.ui.internal.jpa2.details.TargetClassComposite;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
@@ -45,7 +44,6 @@ public class OrmElementCollectionMapping2_0Composite extends AbstractElementColl
new AccessTypeComposite(this, buildAccessHolderHolder(), this.addPane(container, groupBoxMargin));
new FetchTypeComposite(this, this.addPane(container, groupBoxMargin));
new CollectionTable2_0Composite(this, buildCollectionTableHolder(), container);
- new Ordering2_0Composite(this, container);
}
protected PropertyValueModel<AccessHolder> buildAccessHolderHolder() {
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0Tests.java
index 6e5b8b7719..3dfc995bea 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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.
@@ -68,7 +68,7 @@ public class GenericJavaElementCollectionMapping2_0Tests extends Generic2_0Conte
});
}
- private ICompilationUnit createTestEntityWithGenericElementCollectionMapping() throws Exception {
+ private ICompilationUnit createTestEntityWithGenericEmbeddableElementCollectionMapping() throws Exception {
return this.createTestType(new DefaultAnnotationWriter() {
@Override
public Iterator<String> imports() {
@@ -90,6 +90,28 @@ public class GenericJavaElementCollectionMapping2_0Tests extends Generic2_0Conte
});
}
+ private ICompilationUnit createTestEntityWithGenericBasicElementCollectionMapping() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA2_0.ELEMENT_COLLECTION, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ElementCollection").append(CR);
+ sb.append(" private java.util.Collection<String> addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
private ICompilationUnit createTestEntityWithNonGenericElementCollectionMapping() throws Exception {
return this.createTestType(new DefaultAnnotationWriter() {
@Override
@@ -446,7 +468,7 @@ public class GenericJavaElementCollectionMapping2_0Tests extends Generic2_0Conte
}
public void testDefaultTargetClass() throws Exception {
- createTestEntityWithGenericElementCollectionMapping();
+ createTestEntityWithGenericEmbeddableElementCollectionMapping();
createTestTargetEmbeddableAddress();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
@@ -487,7 +509,7 @@ public class GenericJavaElementCollectionMapping2_0Tests extends Generic2_0Conte
}
public void testDefaultTargetClassGenericCollection() throws Exception {
- createTestEntityWithGenericElementCollectionMapping();
+ createTestEntityWithGenericEmbeddableElementCollectionMapping();
createTestTargetEmbeddableAddress();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".Address");
@@ -523,7 +545,7 @@ public class GenericJavaElementCollectionMapping2_0Tests extends Generic2_0Conte
}
public void testTargetClass() throws Exception {
- createTestEntityWithGenericElementCollectionMapping();
+ createTestEntityWithGenericEmbeddableElementCollectionMapping();
createTestTargetEmbeddableAddress();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
@@ -540,7 +562,7 @@ public class GenericJavaElementCollectionMapping2_0Tests extends Generic2_0Conte
}
public void testResolvedTargetEmbeddable() throws Exception {
- createTestEntityWithGenericElementCollectionMapping();
+ createTestEntityWithGenericEmbeddableElementCollectionMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
@@ -639,4 +661,41 @@ public class GenericJavaElementCollectionMapping2_0Tests extends Generic2_0Conte
assertNull(elementCollectionMapping.getSpecifiedFetch());
assertNull(elementCollection.getFetch());
}
+
+ public void testGetValueTypeEmbeddable() throws Exception {
+ createTestEntityWithGenericEmbeddableElementCollectionMapping();
+ createTestTargetEmbeddableAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ ElementCollectionMapping2_0 elementCollectionMapping = (ElementCollectionMapping2_0) persistentAttribute.getMapping();
+
+ assertEquals(ElementCollectionMapping2_0.Type.EMBEDDABLE_TYPE, elementCollectionMapping.getValueType());
+ }
+
+ public void testGetValueTypeNone() throws Exception {
+ createTestEntityWithNonGenericElementCollectionMapping();
+ createTestTargetEmbeddableAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ ElementCollectionMapping2_0 elementCollectionMapping = (ElementCollectionMapping2_0) persistentAttribute.getMapping();
+
+ assertEquals(ElementCollectionMapping2_0.Type.NO_TYPE, elementCollectionMapping.getValueType());
+
+ elementCollectionMapping.setSpecifiedTargetClass("Address");
+ assertEquals(ElementCollectionMapping2_0.Type.EMBEDDABLE_TYPE, elementCollectionMapping.getValueType());
+ }
+
+ public void testGetValueTypeBasic() throws Exception {
+ createTestEntityWithGenericBasicElementCollectionMapping();
+ createTestTargetEmbeddableAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ ElementCollectionMapping2_0 elementCollectionMapping = (ElementCollectionMapping2_0) persistentAttribute.getMapping();
+
+ assertEquals(ElementCollectionMapping2_0.Type.BASIC_TYPE, elementCollectionMapping.getValueType());
+ }
+
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
index f54d3855c9..339a266f17 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 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.
@@ -54,7 +54,7 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
getPersistenceXmlResource().save(null);
}
- private ICompilationUnit createTestEntityElementCollectionMapping() throws Exception {
+ private ICompilationUnit createTestEntityWithElementCollectionMapping() throws Exception {
return this.createTestType(new DefaultAnnotationWriter() {
@Override
public Iterator<String> imports() {
@@ -90,7 +90,7 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
sb.append(";");
sb.append(CR);
sb.append(CR);
- sb.append("@Entity");
+ sb.append("@Embeddable");
sb.append(CR);
sb.append("public class ").append("Address").append(" ");
sb.append("{").append(CR);
@@ -109,7 +109,73 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
};
this.javaProject.createCompilationUnit(PACKAGE_NAME, "Address.java", sourceWriter);
}
-
+
+ private ICompilationUnit createTestEntityWithEmbeddableElementCollectionMapping() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA2_0.ELEMENT_COLLECTION, JPA.FETCH_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ElementCollection");
+ sb.append(CR);
+ sb.append(" private java.util.Collection<Address> addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id");
+ }
+ });
+ }
+
+ private ICompilationUnit createTestEntityWithNonGenericElementCollectionMapping() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA2_0.ELEMENT_COLLECTION, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ElementCollection").append(CR);
+ sb.append(" private java.util.Collection addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ private ICompilationUnit createTestEntityWithGenericBasicElementCollectionMapping() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA2_0.ELEMENT_COLLECTION, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ElementCollection").append(CR);
+ sb.append(" private java.util.Collection<String> addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
@@ -152,7 +218,7 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
}
public void testMappingNoUnderylingJavaAttribute() throws Exception {
- createTestEntityElementCollectionMapping();
+ createTestEntityWithElementCollectionMapping();
createTestTargetEmbeddableAddress();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
@@ -171,7 +237,7 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
public void testVirtualMappingMetadataCompleteFalse() throws Exception {
- createTestEntityElementCollectionMapping();
+ createTestEntityWithElementCollectionMapping();
createTestTargetEmbeddableAddress();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
@@ -195,7 +261,7 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
}
public void testVirtualMappingMetadataCompleteTrue() throws Exception {
- createTestEntityElementCollectionMapping();
+ createTestEntityWithElementCollectionMapping();
createTestTargetEmbeddableAddress();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
@@ -215,7 +281,7 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
}
public void testSpecifiedMapping() throws Exception {
- createTestEntityElementCollectionMapping();
+ createTestEntityWithElementCollectionMapping();
createTestTargetEmbeddableAddress();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
@@ -470,4 +536,55 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
}
+ public void testGetValueTypeEmbeddable() throws Exception {
+ createTestEntityWithEmbeddableElementCollectionMapping();
+ createTestTargetEmbeddableAddress();
+ OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "test.Address");
+
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY, "addresses");
+ ElementCollectionMapping2_0 elementCollectionMapping = (ElementCollectionMapping2_0) ormPersistentAttribute.getMapping();
+
+ assertEquals(ElementCollectionMapping2_0.Type.EMBEDDABLE_TYPE, elementCollectionMapping.getValueType());
+ }
+
+ public void testGetValueTypeEntity() throws Exception {
+ createTestEntityWithEmbeddableElementCollectionMapping();
+ createTestTargetEmbeddableAddress();
+ OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "test.Address");
+
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY, "addresses");
+ ElementCollectionMapping2_0 elementCollectionMapping = (ElementCollectionMapping2_0) ormPersistentAttribute.getMapping();
+
+ assertEquals(ElementCollectionMapping2_0.Type.BASIC_TYPE, elementCollectionMapping.getValueType());
+ }
+
+ public void testGetValueTypeNone() throws Exception {
+ createTestEntityWithNonGenericElementCollectionMapping();
+ createTestTargetEmbeddableAddress();
+ OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "test.Address");
+
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY, "addresses");
+ ElementCollectionMapping2_0 elementCollectionMapping = (ElementCollectionMapping2_0) ormPersistentAttribute.getMapping();
+
+ assertEquals(ElementCollectionMapping2_0.Type.NO_TYPE, elementCollectionMapping.getValueType());
+
+ elementCollectionMapping.setSpecifiedTargetClass("test.Address");
+ assertEquals(ElementCollectionMapping2_0.Type.EMBEDDABLE_TYPE, elementCollectionMapping.getValueType());
+ }
+
+ public void testGetValueTypeBasic() throws Exception {
+ createTestEntityWithGenericBasicElementCollectionMapping();
+ createTestTargetEmbeddableAddress();
+ OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "test.Address");
+
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY, "addresses");
+ ElementCollectionMapping2_0 elementCollectionMapping = (ElementCollectionMapping2_0) ormPersistentAttribute.getMapping();
+
+ assertEquals(ElementCollectionMapping2_0.Type.BASIC_TYPE, elementCollectionMapping.getValueType());
+ }
+
} \ No newline at end of file

Back to the top