diff options
author | kmoore | 2007-05-09 22:43:59 +0000 |
---|---|---|
committer | kmoore | 2007-05-09 22:43:59 +0000 |
commit | 448d7a3164ba375a3263e7fc84ec4fe428456b4d (patch) | |
tree | 0c04e05061ecef7063532f67bfc34fecba6ad144 /jpa/plugins | |
parent | e82d09db3e726261c86fd608f0f96cde920ec065 (diff) | |
download | webtools.dali-448d7a3164ba375a3263e7fc84ec4fe428456b4d.tar.gz webtools.dali-448d7a3164ba375a3263e7fc84ec4fe428456b4d.tar.xz webtools.dali-448d7a3164ba375a3263e7fc84ec4fe428456b4d.zip |
186271 - MapKey model support for 1-m and m-m mappings , no default or validation
Diffstat (limited to 'jpa/plugins')
49 files changed, 481 insertions, 52 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/core.ecore b/jpa/plugins/org.eclipse.jpt.core/model/core.ecore index 8c93cfb890..eb6031a316 100644 --- a/jpa/plugins/org.eclipse.jpt.core/model/core.ecore +++ b/jpa/plugins/org.eclipse.jpt.core/model/core.ecore @@ -304,6 +304,7 @@ eType="#//mappings/IJoinTable" changeable="false" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="orderBy" lowerBound="1" eType="#//mappings/IOrderBy" changeable="false" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="mapKey" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="IOneToMany" abstract="true" interface="true" eSuperTypes="#//mappings/IMultiRelationshipMapping"/> diff --git a/jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel b/jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel index 8850b7a79d..290a7137d0 100644 --- a/jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel +++ b/jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel @@ -271,6 +271,7 @@ <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference core.ecore#//mappings/IMultiRelationshipMapping/joinTable"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference core.ecore#//mappings/IMultiRelationshipMapping/orderBy"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute core.ecore#//mappings/IMultiRelationshipMapping/mapKey"/> </genClasses> <genClasses ecoreClass="core.ecore#//mappings/IOneToMany"/> <genClasses ecoreClass="core.ecore#//mappings/IManyToMany"/> diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java index 5aca5d495c..5281ba5080 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java @@ -12,7 +12,6 @@ package org.eclipse.jpt.core.internal; import java.util.Collection; import java.util.Iterator; import java.util.List; - import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping; import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping; import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit; @@ -57,13 +56,12 @@ public interface IJpaPlatform void setProject(IJpaProject jpaProject); // ********** Persistence Unit ********** - boolean containsPersistenceUnitNamed(String name); - + PersistenceUnit persistenceUnitNamed(String name); - + Iterator<PersistenceUnit> persistenceUnits(); - + int persistenceUnitSize(); // ********** @@ -71,7 +69,7 @@ public interface IJpaPlatform * Get the valid persistence XML files from the project */ Iterator<IJpaFile> validPersistenceXmlFiles(); - + /** * Return a collection of IJpaFileContentProviders. These will be used to * determine which files will be read from an IProject based on contentType. diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCorePackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCorePackage.java index 9b2feb4f36..0be500a7e0 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCorePackage.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCorePackage.java @@ -1478,6 +1478,8 @@ public class JpaCorePackage extends EPackageImpl // Create resource createResource(eNS_URI); } + + /** * <!-- begin-user-doc --> * Defines literals for the meta objects that represent diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XmlEObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XmlEObject.java index 8bedf0c98c..9fc814d05e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XmlEObject.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XmlEObject.java @@ -89,6 +89,8 @@ public abstract class XmlEObject extends JpaEObject implements IXmlEObject public IDOMNode getNode() { return this.node; } + + protected class XmlEAdapterList extends EAdapterList { public XmlEAdapterList(Notifier notifier) { @@ -202,6 +204,8 @@ public abstract class XmlEObject extends JpaEObject implements IXmlEObject // when you override this method, don't forget to include: // super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds); } + + /** * Implementation of ITextRange that adapts a IDOMNode. */ @@ -250,12 +254,11 @@ public abstract class XmlEObject extends JpaEObject implements IXmlEObject if (o == this) { return true; } - if ( ! (o instanceof ITextRange)) { + if (!(o instanceof ITextRange)) { return false; } ITextRange r = (ITextRange) o; - return (r.getOffset() == this.getOffset()) - && (r.getLength() == this.getLength()); + return (r.getOffset() == this.getOffset()) && (r.getLength() == this.getLength()); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaPackage.java index d8ed72742c..33ea8c9570 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaPackage.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaPackage.java @@ -662,6 +662,8 @@ public class JpaJavaPackage extends EPackageImpl // Create resource createResource(eNS_URI); } + + /** * <!-- begin-user-doc --> * Defines literals for the meta objects that represent diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java index 75d5b5a258..5b770407d8 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java @@ -21,7 +21,6 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jpt.core.internal.ITextRange; import org.eclipse.jpt.core.internal.content.java.JavaEObject; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; @@ -875,7 +874,7 @@ public abstract class AbstractJavaTable extends JavaEObject implements ITable this.setSpecifiedCatalog((String) this.catalogAdapter.getValue(astRoot)); this.updateUniqueConstraintsFromJava(astRoot); } - + /** * here we just worry about getting the unique constraints lists the same size; * then we delegate to the unique constraints to synch themselves up @@ -918,7 +917,6 @@ public abstract class AbstractJavaTable extends JavaEObject implements ITable } } - public ITextRange getTextRange() { ITextRange textRange = this.member.annotationTextRange(this.daa); return (textRange != null) ? textRange : this.getOwner().getTextRange(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeMapping.java index 5459e9d7d8..4537661960 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeMapping.java @@ -141,6 +141,8 @@ public abstract class JavaAttributeMapping extends JavaEObject public boolean isIdMapping() { return false; } + + /** * mapping implementation of column owner */ diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java index 230f631966..9f74256e82 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java @@ -224,6 +224,8 @@ public class JavaAttributeOverride extends JavaOverride private static IndexedDeclarationAnnotationAdapter buildAnnotationAdapter(int index) { return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.ATTRIBUTE_OVERRIDE); } + + // ********** member class ********** public class ColumnOwner implements INamedColumn.Owner { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java index c78b801a66..1896c2b8ee 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java @@ -1260,11 +1260,11 @@ public class JavaEntity extends JavaTypeMapping implements IEntity public boolean containsSecondaryTable(String name) { return containsSecondaryTable(name, getSecondaryTables()); } - + public boolean containsSpecifiedSecondaryTable(String name) { return containsSecondaryTable(name, getSpecifiedSecondaryTables()); } - + private boolean containsSecondaryTable(String name, List<ISecondaryTable> secondaryTables) { for (ISecondaryTable secondaryTable : secondaryTables) { String secondaryTableName = secondaryTable.getName(); @@ -2255,12 +2255,12 @@ public class JavaEntity extends JavaTypeMapping implements IEntity } return null; } - + @Override public Schema dbSchema() { return getTable().dbSchema(); } - + @Override public void updateFromJava(CompilationUnit astRoot) { this.setSpecifiedName((String) this.getType().annotationElementValue(NAME_ADAPTER, astRoot)); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMultiRelationshipMapping.java index aa4ea47f5b..6ceaad0052 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMultiRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMultiRelationshipMapping.java @@ -19,9 +19,15 @@ import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.internal.ITextRange; import org.eclipse.jpt.core.internal.ITypeMapping; +import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; +import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; +import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter; +import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; +import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; +import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType; import org.eclipse.jpt.core.internal.mappings.IJoinTable; import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping; @@ -106,6 +112,34 @@ public abstract class JavaMultiRelationshipMapping */ protected IOrderBy orderBy; + /** + * The default value of the '{@link #getMapKey() <em>Map Key</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMapKey() + * @generated + * @ordered + */ + protected static final String MAP_KEY_EDEFAULT = null; + + /** + * The cached value of the '{@link #getMapKey() <em>Map Key</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMapKey() + * @generated + * @ordered + */ + protected String mapKey = MAP_KEY_EDEFAULT; + + private final AnnotationAdapter mapKeyAnnotationAdapter; + + private final AnnotationElementAdapter mapKeyNameAdapter; + + public static final DeclarationAnnotationAdapter MAP_KEY_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.MAP_KEY); + + private static final DeclarationAnnotationElementAdapter MAP_KEY_NAME_ADAPTER = buildMapKeyNameAdapter(); + protected JavaMultiRelationshipMapping() { throw new UnsupportedOperationException("Use JavaMultiRelationshipMapping(Attribute) instead"); } @@ -113,6 +147,8 @@ public abstract class JavaMultiRelationshipMapping protected JavaMultiRelationshipMapping(Attribute attribute) { super(attribute); this.mappedByAdapter = this.buildAnnotationElementAdapter(this.mappedByAdapter()); + this.mapKeyAnnotationAdapter = new MemberAnnotationAdapter(this.getAttribute(), MAP_KEY_ADAPTER); + this.mapKeyNameAdapter = new ShortCircuitAnnotationElementAdapter(attribute, MAP_KEY_NAME_ADAPTER); this.joinTable = JpaJavaMappingsFactory.eINSTANCE.createJavaJoinTable(buildOwner(), attribute); ((InternalEObject) this.joinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE, null, null); this.orderBy = JpaJavaMappingsFactory.eINSTANCE.createJavaOrderBy(attribute); @@ -123,6 +159,15 @@ public abstract class JavaMultiRelationshipMapping protected void notifyChanged(Notification notification) { super.notifyChanged(notification); switch (notification.getFeatureID(IMultiRelationshipMapping.class)) { + case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY : + String mapKey = (String) notification.getNewValue(); + if (mapKey == null) { + this.mapKeyAnnotationAdapter.removeAnnotation(); + } + else { + this.mapKeyNameAdapter.setValue(mapKey); + } + break; case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH : this.getFetchAdapter().setValue(((DefaultLazyFetchType) notification.getNewValue()).convertToJavaAnnotationValue()); break; @@ -305,6 +350,39 @@ public abstract class JavaMultiRelationshipMapping } /** + * Returns the value of the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Map Key</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Map Key</em>' attribute. + * @see #setMapKey(String) + * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIMultiRelationshipMapping_MapKey() + * @model + * @generated + */ + public String getMapKey() { + return mapKey; + } + + /** + * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping#getMapKey <em>Map Key</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Map Key</em>' attribute. + * @see #getMapKey() + * @generated + */ + public void setMapKey(String newMapKey) { + String oldMapKey = mapKey; + mapKey = newMapKey; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY, oldMapKey, mapKey)); + } + + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -336,6 +414,8 @@ public abstract class JavaMultiRelationshipMapping return getJoinTable(); case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY : return getOrderBy(); + case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY : + return getMapKey(); } return super.eGet(featureID, resolve, coreType); } @@ -354,6 +434,9 @@ public abstract class JavaMultiRelationshipMapping case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH : setFetch((DefaultLazyFetchType) newValue); return; + case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY : + setMapKey((String) newValue); + return; } super.eSet(featureID, newValue); } @@ -372,6 +455,9 @@ public abstract class JavaMultiRelationshipMapping case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH : setFetch(FETCH_EDEFAULT); return; + case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY : + setMapKey(MAP_KEY_EDEFAULT); + return; } super.eUnset(featureID); } @@ -392,6 +478,8 @@ public abstract class JavaMultiRelationshipMapping return joinTable != null; case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY : return orderBy != null; + case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY : + return MAP_KEY_EDEFAULT == null ? mapKey != null : !MAP_KEY_EDEFAULT.equals(mapKey); } return super.eIsSet(featureID); } @@ -419,6 +507,8 @@ public abstract class JavaMultiRelationshipMapping return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE; case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY : return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY; + case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY : + return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY; default : return -1; } @@ -449,6 +539,8 @@ public abstract class JavaMultiRelationshipMapping return JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE; case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY : return JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY; + case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY : + return JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY; default : return -1; } @@ -470,6 +562,8 @@ public abstract class JavaMultiRelationshipMapping result.append(mappedBy); result.append(", fetch: "); result.append(fetch); + result.append(", mapKey: "); + result.append(mapKey); result.append(')'); return result.toString(); } @@ -480,6 +574,16 @@ public abstract class JavaMultiRelationshipMapping setMappedBy((String) this.mappedByAdapter.getValue(astRoot)); this.getJavaOrderBy().updateFromJava(astRoot); this.getJavaJoinTable().updateFromJava(astRoot); + updateMapKeyFromJava(astRoot); + } + + private void updateMapKeyFromJava(CompilationUnit astRoot) { + if (this.mapKeyAnnotationAdapter.getAnnotation(astRoot) == null) { + this.setMapKey(null); + } + else { + this.setMapKey((String) this.mapKeyNameAdapter.getValue(astRoot)); + } } private JavaJoinTable getJavaJoinTable() { @@ -529,4 +633,9 @@ public abstract class JavaMultiRelationshipMapping String elementTypeName = buildReferenceEntityTypeName(elementSignature, jdtType()); return typeNamedIsContainer(elementTypeName) ? null : elementTypeName; } + + // ********** static methods ********** + private static DeclarationAnnotationElementAdapter buildMapKeyNameAdapter() { + return new EnumDeclarationAnnotationElementAdapter(MAP_KEY_ADAPTER, JPA.MAP_KEY__NAME, false); + } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java index 651461299b..6b24a37507 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java @@ -332,12 +332,12 @@ public class JavaSecondaryTable extends AbstractJavaTable return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } - @Override protected void updateFromJava(CompilationUnit astRoot) { super.updateFromJava(astRoot); this.updateSpecifiedPrimaryKeyJoinColumnsFromJava(astRoot); } + /** * here we just worry about getting the join column lists the same size; * then we delegate to the join columns to synch themselves up @@ -380,7 +380,6 @@ public class JavaSecondaryTable extends AbstractJavaTable } } - /** * allow owners to verify the annotation */ @@ -414,7 +413,7 @@ public class JavaSecondaryTable extends AbstractJavaTable } private JavaPrimaryKeyJoinColumn createJavaPrimaryKeyJoinColumn(int index) { - return JavaPrimaryKeyJoinColumn.createSecondaryTableJoinColumn(this, buildPkJoinColumnOwner(), this.getMember(), index); + return JavaPrimaryKeyJoinColumn.createSecondaryTableJoinColumn(this, buildPkJoinColumnOwner(), this.getMember(), index); } protected IAbstractJoinColumn.Owner buildPkJoinColumnOwner() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSingleRelationshipMapping.java index 7b06ef891a..31979c4e48 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSingleRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSingleRelationshipMapping.java @@ -142,7 +142,7 @@ public abstract class JavaSingleRelationshipMapping specifiedJoinColumnsChanged(notification); break; case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__FETCH : - this.getFetchAdapter().setValue(((DefaultEagerFetchType) notification.getNewValue()).convertToJavaAnnotationValue()); + this.getFetchAdapter().setValue(((DefaultEagerFetchType) notification.getNewValue()).convertToJavaAnnotationValue()); break; default : break; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTypeMapping.java index 8b36d3ff94..fe1b06b438 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTypeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTypeMapping.java @@ -222,7 +222,7 @@ public abstract class JavaTypeMapping extends JavaEObject public Table dbTable(String tableName) { return null; } - + public Schema dbSchema() { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java index d4b882e965..4e9ac63620 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java @@ -16,7 +16,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.jdt.core.dom.Annotation; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.StringLiteral; import org.eclipse.jpt.core.internal.ITextRange; import org.eclipse.jpt.core.internal.content.java.JavaEObject; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; @@ -29,12 +28,9 @@ import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdap import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitArrayAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.StringArrayExpressionConverter; -import org.eclipse.jpt.core.internal.jdtutility.StringExpressionConverter; -import org.eclipse.jpt.core.internal.mappings.INonOwningMapping; import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint; import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage; import org.eclipse.jpt.utility.internal.CollectionTools; @@ -71,9 +67,8 @@ public class JavaUniqueConstraint extends JavaEObject private final IndexedAnnotationAdapter annotationAdapter; private final DeclarationAnnotationElementAdapter columnNamesDeclarationAdapter; - + private final AnnotationElementAdapter columnNamesAdapter; - protected JavaUniqueConstraint() { super(); @@ -88,7 +83,7 @@ public class JavaUniqueConstraint extends JavaEObject this.columnNamesDeclarationAdapter = buildArrayAnnotationElementAdapter(idaa, JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES); this.columnNamesAdapter = this.buildAnnotationElementAdapter(this.columnNamesDeclarationAdapter); } - + protected AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { return new ShortCircuitArrayAnnotationElementAdapter(this.member, daea); } @@ -101,7 +96,6 @@ public class JavaUniqueConstraint extends JavaEObject return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, false, converter); } - @Override protected void notifyChanged(Notification notification) { super.notifyChanged(notification); @@ -271,10 +265,9 @@ public class JavaUniqueConstraint extends JavaEObject public void updateFromJava(CompilationUnit astRoot) { updateColumnNamesFromJava(astRoot); } - + private void updateColumnNamesFromJava(CompilationUnit astRoot) { String[] javaColumnNames = (String[]) this.columnNamesAdapter.getValue(astRoot); - CollectionTools.retainAll(getColumnNames(), javaColumnNames); for (int i = 0; i < javaColumnNames.length; i++) { String columnName = javaColumnNames[i]; @@ -283,7 +276,7 @@ public class JavaUniqueConstraint extends JavaEObject } } } - + // ********** persistence model -> java annotations ********** void moveAnnotation(int newIndex) { this.annotationAdapter.moveAnnotation(newIndex); @@ -321,7 +314,7 @@ public class JavaUniqueConstraint extends JavaEObject private static IndexedDeclarationAnnotationAdapter buildTableUniqueConstraintAnnotationAdapter(int index) { return new NestedIndexedDeclarationAnnotationAdapter(JavaTable.DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT); } - + static JavaUniqueConstraint createTableGeneratorUniqueConstraint(Member member, int index) { return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(member, buildTableGeneratorUniqueConstraintAnnotationAdapter(index)); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsPackage.java index 47deb6cd09..53d32db2f7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsPackage.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsPackage.java @@ -1186,13 +1186,22 @@ public class JpaJavaMappingsPackage extends EPackageImpl public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 3; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4; + + /** * The number of structural features of the '<em>Java Multi Relationship Mapping</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int JAVA_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4; + public static final int JAVA_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5; /** * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany <em>Java One To Many</em>}' class. @@ -1277,6 +1286,15 @@ public class JpaJavaMappingsPackage extends EPackageImpl public static final int JAVA_ONE_TO_MANY__ORDER_BY = JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int JAVA_ONE_TO_MANY__MAP_KEY = JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY; + + /** * The number of structural features of the '<em>Java One To Many</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1368,6 +1386,15 @@ public class JpaJavaMappingsPackage extends EPackageImpl public static final int JAVA_MANY_TO_MANY__ORDER_BY = JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int JAVA_MANY_TO_MANY__MAP_KEY = JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY; + + /** * The number of structural features of the '<em>Java Many To Many</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -4527,6 +4554,8 @@ public class JpaJavaMappingsPackage extends EPackageImpl initEClass(javaQueryHintEClass, JavaQueryHint.class, "JavaQueryHint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(javaUniqueConstraintEClass, JavaUniqueConstraint.class, "JavaUniqueConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); } + + /** * <!-- begin-user-doc --> * Defines literals for the meta objects that represent diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsInternal.java index 9e99298c60..ad83a90531 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsInternal.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsInternal.java @@ -1649,6 +1649,8 @@ public class EntityMappingsInternal extends XmlEObject setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY)); setDefaultAccess((AccessType) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_ACCESS_KEY)); } + + private class TypeMappingsList<E> extends EObjectContainmentEList<XmlTypeMapping> { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmPackage.java index 37d411a8c7..b9c8d8c0cc 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmPackage.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmPackage.java @@ -1911,13 +1911,22 @@ public class OrmPackage extends EPackageImpl public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 3; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4; + + /** * The feature id for the '<em><b>Join Table For Xml</b></em>' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4; + public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5; /** * The feature id for the '<em><b>Order By For Xml</b></em>' reference. @@ -1926,7 +1935,7 @@ public class OrmPackage extends EPackageImpl * @generated * @ordered */ - public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY_FOR_XML = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5; + public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY_FOR_XML = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 6; /** * The number of structural features of the '<em>Xml Multi Relationship Mapping Internal</em>' class. @@ -1935,7 +1944,7 @@ public class OrmPackage extends EPackageImpl * @generated * @ordered */ - public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL_FEATURE_COUNT = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 6; + public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL_FEATURE_COUNT = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 7; /** * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml <em>Xml Multi Relationship Mapping For Xml</em>}' class. @@ -2057,6 +2066,15 @@ public class OrmPackage extends EPackageImpl public static final int XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY; + + /** * The number of structural features of the '<em>Xml Multi Relationship Mapping</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -2157,6 +2175,15 @@ public class OrmPackage extends EPackageImpl public static final int XML_ONE_TO_MANY__ORDER_BY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_ONE_TO_MANY__MAP_KEY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY; + + /** * The feature id for the '<em><b>Join Table For Xml</b></em>' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -2275,6 +2302,15 @@ public class OrmPackage extends EPackageImpl public static final int XML_MANY_TO_MANY__ORDER_BY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_MANY_TO_MANY__MAP_KEY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY; + + /** * The feature id for the '<em><b>Join Table For Xml</b></em>' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -8237,6 +8273,8 @@ public class OrmPackage extends EPackageImpl // Create resource createResource(eNS_URI); } + + /** * <!-- begin-user-doc --> * Defines literals for the meta objects that represent diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeMapping.java index eac0594af4..86b8edb828 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeMapping.java @@ -354,6 +354,8 @@ public abstract class XmlAttributeMapping extends XmlEObject public boolean isIdMapping() { return false; } + + public class ColumnOwner implements INamedColumn.Owner { public ITextRange getTextRange() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeOverride.java index 3b188f5704..bce810719b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeOverride.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeOverride.java @@ -308,6 +308,8 @@ public class XmlAttributeOverride extends XmlOverride } return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } + + public class ColumnOwner implements INamedColumn.Owner { public ITextRange getTextRange() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java index 502444646b..8544bb7ba9 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java @@ -479,11 +479,11 @@ public class XmlEntityInternal extends XmlTypeMapping public boolean containsSecondaryTable(String name) { return containsSecondaryTable(name, getSecondaryTables()); } - + public boolean containsSpecifiedSecondaryTable(String name) { return containsSecondaryTable(name, getSpecifiedSecondaryTables()); } - + private boolean containsSecondaryTable(String name, List<ISecondaryTable> secondaryTables) { for (ISecondaryTable secondaryTable : secondaryTables) { String secondaryTableName = secondaryTable.getName(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingInternal.java index 48fb7df386..502caf0250 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingInternal.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingInternal.java @@ -97,6 +97,26 @@ public abstract class XmlMultiRelationshipMappingInternal */ protected IOrderBy orderBy; + /** + * The default value of the '{@link #getMapKey() <em>Map Key</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMapKey() + * @generated + * @ordered + */ + protected static final String MAP_KEY_EDEFAULT = null; + + /** + * The cached value of the '{@link #getMapKey() <em>Map Key</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMapKey() + * @generated + * @ordered + */ + protected String mapKey = MAP_KEY_EDEFAULT; + protected XmlMultiRelationshipMappingInternal() { super(); this.joinTable = OrmFactory.eINSTANCE.createXmlJoinTable(buildJoinTableOwner()); @@ -266,6 +286,39 @@ public abstract class XmlMultiRelationshipMappingInternal return msgs; } + /** + * Returns the value of the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Map Key</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Map Key</em>' attribute. + * @see #setMapKey(String) + * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIMultiRelationshipMapping_MapKey() + * @model + * @generated + */ + public String getMapKey() { + return mapKey; + } + + /** + * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal#getMapKey <em>Map Key</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Map Key</em>' attribute. + * @see #getMapKey() + * @generated + */ + public void setMapKey(String newMapKey) { + String oldMapKey = mapKey; + mapKey = newMapKey; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY, oldMapKey, mapKey)); + } + private XmlJoinTable getJoinTableInternal() { return (XmlJoinTable) getJoinTable(); } @@ -339,6 +392,8 @@ public abstract class XmlMultiRelationshipMappingInternal return getJoinTable(); case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY : return getOrderBy(); + case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY : + return getMapKey(); case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML : return getJoinTableForXml(); case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY_FOR_XML : @@ -361,6 +416,9 @@ public abstract class XmlMultiRelationshipMappingInternal case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH : setFetch((DefaultLazyFetchType) newValue); return; + case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY : + setMapKey((String) newValue); + return; case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML : setJoinTableForXml((XmlJoinTable) newValue); return; @@ -385,6 +443,9 @@ public abstract class XmlMultiRelationshipMappingInternal case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH : setFetch(FETCH_EDEFAULT); return; + case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY : + setMapKey(MAP_KEY_EDEFAULT); + return; case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML : setJoinTableForXml((XmlJoinTable) null); return; @@ -411,6 +472,8 @@ public abstract class XmlMultiRelationshipMappingInternal return joinTable != null; case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY : return orderBy != null; + case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY : + return MAP_KEY_EDEFAULT == null ? mapKey != null : !MAP_KEY_EDEFAULT.equals(mapKey); case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML : return getJoinTableForXml() != null; case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY_FOR_XML : @@ -442,6 +505,8 @@ public abstract class XmlMultiRelationshipMappingInternal return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE; case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY : return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY; + case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY : + return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY; default : return -1; } @@ -488,6 +553,8 @@ public abstract class XmlMultiRelationshipMappingInternal return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE; case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY : return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY; + case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY : + return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY; default : return -1; } @@ -525,6 +592,8 @@ public abstract class XmlMultiRelationshipMappingInternal result.append(mappedBy); result.append(", fetch: "); result.append(fetch); + result.append(", mapKey: "); + result.append(mapKey); result.append(')'); return result.toString(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentType.java index 7fc8e074d9..d3806ecd4c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentType.java @@ -897,6 +897,8 @@ public class XmlPersistentType extends XmlEObject implements IPersistentType public ITextRange getAttributesTextRange() { return getMapping().getAttributesTextRange(); } + + private abstract class AttributeMappingsList<E> extends EObjectContainmentEList<XmlAttributeMapping> { @@ -940,6 +942,8 @@ public class XmlPersistentType extends XmlEObject implements IPersistentType persistentAttributes().set(index, newObject.getPersistentAttribute()); } } + + private class SpecifiedAttributeMappingsList<E> extends AttributeMappingsList<XmlAttributeMapping> { @@ -952,6 +956,8 @@ public class XmlPersistentType extends XmlEObject implements IPersistentType return getSpecifiedPersistentAttributes(); } } + + private class VirtualAttributeMappingsList<E> extends AttributeMappingsList<XmlAttributeMapping> { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTableGenerator.java index ab51bb665d..43e1c93aae 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTableGenerator.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTableGenerator.java @@ -1048,7 +1048,7 @@ public class XmlTableGenerator extends XmlGenerator implements ITableGenerator public void refreshDefaults(DefaultsContext defaultsContext) { setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_GENERATOR_SCHEMA_KEY)); } - + public IUniqueConstraint createUniqueConstraint(int index) { return createXmlJavaUniqueConstraint(index); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTypeMapping.java index 2be619c62e..192e807afe 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTypeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTypeMapping.java @@ -609,7 +609,7 @@ public abstract class XmlTypeMapping extends XmlEObject implements ITypeMapping public Table dbTable(String tableName) { return null; } - + public Schema dbSchema() { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToManyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToManyTranslator.java index 21f1530e53..3170cc3b5b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToManyTranslator.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToManyTranslator.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.core.internal.content.orm.resource; import org.eclipse.emf.ecore.EObject; import org.eclipse.jpt.core.internal.content.orm.XmlManyToMany; -import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage; import org.eclipse.wst.common.internal.emf.resource.IDTranslator; import org.eclipse.wst.common.internal.emf.resource.Translator; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MapKeyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MapKeyTranslator.java new file mode 100644 index 0000000000..4587f54b94 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MapKeyTranslator.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2007 Oracle. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Oracle. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jpt.core.internal.content.orm.resource; + +import java.util.Collections; +import java.util.List; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jpt.core.internal.mappings.EnumType; +import org.eclipse.wst.common.internal.emf.resource.Translator; + +/** + * There is a bug in the translator framework that causes + * enumerators in xml elements and enumerators in xml attributes + * to be treated differently. When the enumerator is an attribute + * setting the model to the default causes the attribute to be removed. + * With an element is causes the default literal to be placed in + * the tag. + * + * The problem is wrapped up in the emf unsettable attribute as well. + * For attributes the eIsSet method returns false for the default value + * For elements the eIsSet method returns true for the default value. + * I don't want to have to use the unsettable option in emf since that would + * require that I call different api. I am not sure yet what the bug is in + * the translator, so I have entered one ~KFM + */ +public class MapKeyTranslator extends Translator +{ + + public MapKeyTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) { + super(domNameAndPath, aFeature, style); + } + + @Override + public Object getMOFValue(EObject mofObject) { + EnumType type = (EnumType) super.getMOFValue(mofObject); + if (type == EnumType.DEFAULT) { + return null; + } + return type; + } + + @Override + public List getMOFChildren(EObject mofObject) { + List result = super.getMOFChildren(mofObject); + if(result != null && result.size() > 0) { + EnumType type = (EnumType) result.get(0); + if(type.getValue() == EnumType.DEFAULT_VALUE) + result = Collections.EMPTY_LIST; + } + return result; + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiRelationshipTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiRelationshipTranslator.java index 171c3a8c7e..811fa21867 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiRelationshipTranslator.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiRelationshipTranslator.java @@ -53,7 +53,7 @@ public abstract class MultiRelationshipTranslator extends RelationshipTranslator //placeholder until we support in our model, this allow us //to keep the elements in the proper order protected Translator createMapKeyTranslator() { - return new Translator(MAP_KEY , (EStructuralFeature) null); + return new Translator(MAP_KEY + "/" + MAP_KEY__NAME, JpaCoreMappingsPackage.eINSTANCE.getIMultiRelationshipMapping_MapKey(), DOM_ATTRIBUTE); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToManyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToManyTranslator.java index 0d644ca82d..10b7e41f96 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToManyTranslator.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToManyTranslator.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.core.internal.content.orm.resource; import org.eclipse.emf.ecore.EObject; import org.eclipse.jpt.core.internal.content.orm.XmlOneToMany; -import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage; import org.eclipse.wst.common.internal.emf.resource.IDTranslator; import org.eclipse.wst.common.internal.emf.resource.Translator; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmXmlMapper.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmXmlMapper.java index d53a981fa0..10e36d470e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmXmlMapper.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmXmlMapper.java @@ -113,6 +113,8 @@ public interface OrmXmlMapper String MANY_TO_MANY = "many-to-many"; //$NON-NLS-1$ String MANY_TO_ONE = "many-to-one"; //$NON-NLS-1$ String MAP_KEY = "map-key"; //$NON-NLS-1$ + String MAP_KEY__NAME = "name"; //$NON-NLS-1$ + String MAPPED_BY = "mapped-by"; //$NON-NLS-1$ String MAPPED_SUPERCLASS = "mapped-superclass"; //$NON-NLS-1$ String METADATA_COMPLETE = "metadata-complete"; //$NON-NLS-1$ diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java index 62f6bda811..25c2591487 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java @@ -1102,6 +1102,8 @@ public class PersistencePackage extends EPackageImpl // Create resource createResource(eNS_URI); } + + /** * <!-- begin-user-doc --> * Defines literals for the meta objects that represent diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractJoinColumn.java index 14325eafce..125e31dfb8 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractJoinColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractJoinColumn.java @@ -2,7 +2,7 @@ * <copyright> * </copyright> * - * $Id: IAbstractJoinColumn.java,v 1.5 2007/05/08 17:21:41 kmoore Exp $ + * $Id: IAbstractJoinColumn.java,v 1.6 2007/05/09 22:43:58 kmoore Exp $ */ package org.eclipse.jpt.core.internal.mappings; @@ -108,6 +108,8 @@ public interface IAbstractJoinColumn extends INamedColumn * Re-declared to return INamedColumn.Owner. */ Owner getOwner(); + + interface Owner extends INamedColumn.Owner { /** diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAssociationOverride.java index 3c515b735e..65c9a86d13 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAssociationOverride.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAssociationOverride.java @@ -88,6 +88,8 @@ public interface IAssociationOverride extends IOverride boolean containsSpecifiedJoinColumns(); ITypeMapping typeMapping(); + + public class JoinColumnOwner implements IJoinColumn.Owner { private IAssociationOverride associationOverride; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java index 2e884d0422..2e826535b7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java @@ -131,6 +131,8 @@ public interface IDiscriminatorColumn extends INamedColumn * @generated */ int getLength(); + + class Owner implements INamedColumn.Owner { private IEntity entity; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbedded.java index aaf7dde765..34a841c41d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbedded.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbedded.java @@ -100,6 +100,8 @@ public interface IEmbedded extends IAttributeMapping boolean containsAttributeOverride(String name); boolean containsSpecifiedAttributeOverride(String name); + + class AttributeOverrideOwner implements Owner { private IEmbedded embedded; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEntity.java index 75b0ce3985..81e657157a 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEntity.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEntity.java @@ -543,7 +543,7 @@ public interface IEntity extends ITypeMapping boolean containsSpecifiedAssociationOverride(String name); boolean containsSecondaryTable(String name); - + boolean containsSpecifiedSecondaryTable(String name); ISecondaryTable createSecondaryTable(int index); @@ -555,6 +555,8 @@ public interface IEntity extends ITypeMapping INamedQuery createNamedQuery(int index); INamedNativeQuery createNamedNativeQuery(int index); + + abstract class OverrideOwner implements IOverride.Owner { protected IEntity entity; @@ -571,6 +573,8 @@ public interface IEntity extends ITypeMapping return entity.getTextRange(); } } + + class AttributeOverrideOwner extends OverrideOwner { public AttributeOverrideOwner(IEntity entity) { @@ -597,6 +601,8 @@ public interface IEntity extends ITypeMapping return entity.getDefaultAttributeOverrides().contains(override); } } + + class AssociationOverrideOwner extends OverrideOwner { public AssociationOverrideOwner(IEntity entity) { @@ -619,6 +625,8 @@ public interface IEntity extends ITypeMapping return entity.getDefaultAssociationOverrides().contains(override); } } + + class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner { private IEntity entity; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinColumn.java index 9ecc78897c..c066e46982 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinColumn.java @@ -24,6 +24,8 @@ import java.util.List; public interface IJoinColumn extends IAbstractColumn, IAbstractJoinColumn { IJoinColumn.Owner getOwner(); + + /** * interface allowing join columns to be used in multiple places * (e.g. 1:1 mappings and join tables) diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java index 3aa7f773da..bfb48bfdfa 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java @@ -146,6 +146,8 @@ public interface IJoinTable extends ITable boolean containsSpecifiedInverseJoinColumns(); IRelationshipMapping relationshipMapping(); + + /** * just a little common behavior */ @@ -193,6 +195,8 @@ public interface IJoinTable extends ITable return (joinTable.getName().equals(tableName)) ? joinTable.dbTable() : null; } } + + /** * owner for "forward-pointer" JoinColumns; * these point at the target/inverse entity @@ -229,6 +233,8 @@ public interface IJoinTable extends ITable return (targetEntity == null) ? null : targetEntity.primaryDbTable(); } } + + /** * owner for "back-pointer" JoinColumns; * these point at the source/owning entity diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMultiRelationshipMapping.java index 9eb6c02805..eda92d59f2 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMultiRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMultiRelationshipMapping.java @@ -20,6 +20,7 @@ package org.eclipse.jpt.core.internal.mappings; * <li>{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getFetch <em>Fetch</em>}</li> * <li>{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getJoinTable <em>Join Table</em>}</li> * <li>{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getOrderBy <em>Order By</em>}</li> + * <li>{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getMapKey <em>Map Key</em>}</li> * </ul> * </p> * @@ -87,4 +88,30 @@ public interface IMultiRelationshipMapping extends INonOwningMapping * @generated */ IOrderBy getOrderBy(); + + /** + * Returns the value of the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Map Key</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Map Key</em>' attribute. + * @see #setMapKey(String) + * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMultiRelationshipMapping_MapKey() + * @model + * @generated + */ + String getMapKey(); + + /** + * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getMapKey <em>Map Key</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Map Key</em>' attribute. + * @see #getMapKey() + * @generated + */ + void setMapKey(String value); } // IMultiRelationshipMapping diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedColumn.java index 97a629c05c..ac2ea28848 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedColumn.java @@ -148,6 +148,8 @@ public interface INamedColumn extends IJpaSourceObject * and provides its context. */ Owner getOwner(); + + /** * interface allowing columns to be used in multiple places * (e.g. basic mappings and attribute overrides) diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOverride.java index 9df9e50293..3348aa86fb 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOverride.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOverride.java @@ -65,6 +65,8 @@ public interface IOverride extends IJpaSourceObject boolean isVirtual(); Owner getOwner(); + + interface Owner { ITypeMapping getTypeMapping(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISecondaryTable.java index c9f4abcbe8..502f3e6db9 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISecondaryTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISecondaryTable.java @@ -94,8 +94,10 @@ public interface ISecondaryTable extends ITable * Create a primary key join column with the given index */ IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index); - + boolean containsSpecifiedPrimaryKeyJoinColumns(); + + class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner { private ISecondaryTable secondaryTable; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISingleRelationshipMapping.java index fa001673dd..07ff23f366 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISingleRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISingleRelationshipMapping.java @@ -146,6 +146,8 @@ public interface ISingleRelationshipMapping extends IRelationshipMapping boolean containsSpecifiedJoinColumns(); IJoinColumn createJoinColumn(int index); + + public class JoinColumnOwner implements IJoinColumn.Owner { private ISingleRelationshipMapping singleRelationshipMapping; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java index 9a4ebd7a68..0884679d0c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java @@ -256,6 +256,8 @@ public interface ITable extends IJpaSourceObject Owner getOwner(); IUniqueConstraint createUniqueConstraint(int index); + + /** * interface allowing tables to be owned by various objects */ diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java index 758d7f6d7e..b39c55093e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java @@ -401,6 +401,6 @@ public interface ITableGenerator extends IGenerator EList<IUniqueConstraint> getUniqueConstraints(); void refreshDefaults(DefaultsContext defaultsContext); - + IUniqueConstraint createUniqueConstraint(int index); } // ITableGenerator diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsPackage.java index e9851f882d..0acb92c816 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsPackage.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsPackage.java @@ -1315,13 +1315,22 @@ public class JpaCoreMappingsPackage extends EPackageImpl public static final int IMULTI_RELATIONSHIP_MAPPING__ORDER_BY = INON_OWNING_MAPPING_FEATURE_COUNT + 2; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int IMULTI_RELATIONSHIP_MAPPING__MAP_KEY = INON_OWNING_MAPPING_FEATURE_COUNT + 3; + + /** * The number of structural features of the '<em>IMulti Relationship Mapping</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - public static final int IMULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = INON_OWNING_MAPPING_FEATURE_COUNT + 3; + public static final int IMULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = INON_OWNING_MAPPING_FEATURE_COUNT + 4; /** * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}' class. @@ -1406,6 +1415,15 @@ public class JpaCoreMappingsPackage extends EPackageImpl public static final int IONE_TO_MANY__ORDER_BY = IMULTI_RELATIONSHIP_MAPPING__ORDER_BY; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int IONE_TO_MANY__MAP_KEY = IMULTI_RELATIONSHIP_MAPPING__MAP_KEY; + + /** * The number of structural features of the '<em>IOne To Many</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1497,6 +1515,15 @@ public class JpaCoreMappingsPackage extends EPackageImpl public static final int IMANY_TO_MANY__ORDER_BY = IMULTI_RELATIONSHIP_MAPPING__ORDER_BY; /** + * The feature id for the '<em><b>Map Key</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int IMANY_TO_MANY__MAP_KEY = IMULTI_RELATIONSHIP_MAPPING__MAP_KEY; + + /** * The number of structural features of the '<em>IMany To Many</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -5023,6 +5050,19 @@ public class JpaCoreMappingsPackage extends EPackageImpl } /** + * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getMapKey <em>Map Key</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Map Key</em>'. + * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getMapKey() + * @see #getIMultiRelationshipMapping() + * @generated + */ + public EAttribute getIMultiRelationshipMapping_MapKey() { + return (EAttribute) iMultiRelationshipMappingEClass.getEStructuralFeatures().get(3); + } + + /** * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -6395,6 +6435,7 @@ public class JpaCoreMappingsPackage extends EPackageImpl createEAttribute(iMultiRelationshipMappingEClass, IMULTI_RELATIONSHIP_MAPPING__FETCH); createEReference(iMultiRelationshipMappingEClass, IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE); createEReference(iMultiRelationshipMappingEClass, IMULTI_RELATIONSHIP_MAPPING__ORDER_BY); + createEAttribute(iMultiRelationshipMappingEClass, IMULTI_RELATIONSHIP_MAPPING__MAP_KEY); iOneToManyEClass = createEClass(IONE_TO_MANY); iManyToManyEClass = createEClass(IMANY_TO_MANY); iSingleRelationshipMappingEClass = createEClass(ISINGLE_RELATIONSHIP_MAPPING); @@ -6669,6 +6710,7 @@ public class JpaCoreMappingsPackage extends EPackageImpl initEAttribute(getIMultiRelationshipMapping_Fetch(), this.getDefaultLazyFetchType(), "fetch", null, 0, 1, IMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getIMultiRelationshipMapping_JoinTable(), this.getIJoinTable(), null, "joinTable", null, 1, 1, IMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getIMultiRelationshipMapping_OrderBy(), this.getIOrderBy(), null, "orderBy", null, 1, 1, IMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIMultiRelationshipMapping_MapKey(), theEcorePackage.getEString(), "mapKey", null, 0, 1, IMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(iOneToManyEClass, IOneToMany.class, "IOneToMany", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(iManyToManyEClass, IManyToMany.class, "IManyToMany", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(iSingleRelationshipMappingEClass, ISingleRelationshipMapping.class, "ISingleRelationshipMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -6806,6 +6848,8 @@ public class JpaCoreMappingsPackage extends EPackageImpl addEEnumLiteral(orderingTypeEEnum, OrderingType.PRIMARY_KEY); addEEnumLiteral(orderingTypeEEnum, OrderingType.CUSTOM); } + + /** * <!-- begin-user-doc --> * Defines literals for the meta objects that represent @@ -7569,6 +7613,14 @@ public class JpaCoreMappingsPackage extends EPackageImpl public static final EReference IMULTI_RELATIONSHIP_MAPPING__ORDER_BY = eINSTANCE.getIMultiRelationshipMapping_OrderBy(); /** + * The meta object literal for the '<em><b>Map Key</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final EAttribute IMULTI_RELATIONSHIP_MAPPING__MAP_KEY = eINSTANCE.getIMultiRelationshipMapping_MapKey(); + + /** * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaPlatform.java index 367e29bce5..64e2de8a64 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaPlatform.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaPlatform.java @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; - import org.eclipse.jpt.core.internal.IJpaFile; import org.eclipse.jpt.core.internal.IJpaFileContentProvider; import org.eclipse.jpt.core.internal.IJpaPlatform; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PersistenceUnitContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PersistenceUnitContext.java index 366ca4d58b..1f02236f8e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PersistenceUnitContext.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PersistenceUnitContext.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; - import org.eclipse.jdt.core.IType; import org.eclipse.jem.java.JavaClass; import org.eclipse.jpt.core.internal.AccessType; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/SecondaryTableContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/SecondaryTableContext.java index 80f4eed606..673d36b310 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/SecondaryTableContext.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/SecondaryTableContext.java @@ -14,7 +14,6 @@ import java.util.List; import org.eclipse.jpt.core.internal.IPersistentType; import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn; import org.eclipse.jpt.core.internal.mappings.ISecondaryTable; -import org.eclipse.jpt.core.internal.mappings.ITable; import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages; import org.eclipse.jpt.core.internal.validation.JpaValidationMessages; import org.eclipse.wst.validation.internal.provisional.core.IMessage; |