Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2007-05-07 20:09:51 +0000
committerkmoore2007-05-07 20:09:51 +0000
commitd832acb26a24fa89f5ccca43b5137193135e2e8f (patch)
tree3796781384a3d0bdbc49ab66d355d4fea9e9c7e8 /jpa/plugins
parentb8aa9807444c959b5d359db12374a7859fb16dff (diff)
downloadwebtools.dali-d832acb26a24fa89f5ccca43b5137193135e2e8f.tar.gz
webtools.dali-d832acb26a24fa89f5ccca43b5137193135e2e8f.tar.xz
webtools.dali-d832acb26a24fa89f5ccca43b5137193135e2e8f.zip
moved IDiscriminatorColumn to the INamedColumn hierarchy
Diffstat (limited to 'jpa/plugins')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java2
8 files changed, 48 insertions, 38 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java
index df94dadd1c..29141098ee 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java
@@ -48,7 +48,7 @@ public class JavaDiscriminatorColumn extends JavaNamedColumn
private IntAnnotationElementAdapter lengthAdapter;
- private static final DeclarationAnnotationAdapter ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.DISCRIMINATOR_COLUMN);
+ public static final DeclarationAnnotationAdapter ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.DISCRIMINATOR_COLUMN);
private static final DeclarationAnnotationElementAdapter DISCRIMINATOR_TYPE_ADAPTER = buildDiscriminatorTypeAdapter();
@@ -134,8 +134,8 @@ public class JavaDiscriminatorColumn extends JavaNamedColumn
throw new UnsupportedOperationException();
}
- protected JavaDiscriminatorColumn(Type type) {
- super(null, type, ANNOTATION_ADAPTER);
+ protected JavaDiscriminatorColumn(Owner owner, Type type, DeclarationAnnotationAdapter daa) {
+ super(owner, type, daa);
this.type = type;
this.discriminatorTypeAdapter = new ShortCircuitAnnotationElementAdapter(this.type, DISCRIMINATOR_TYPE_ADAPTER);
this.lengthAdapter = new IntAnnotationElementAdapter(new ShortCircuitAnnotationElementAdapter(this.type, LENGTH_ADAPTER));
@@ -451,14 +451,6 @@ public class JavaDiscriminatorColumn extends JavaNamedColumn
return this.type.textRange();
}
- public Table dbTable() {
- return entity().primaryDbTable();
- }
-
- private IEntity entity() {
- return (IEntity) eContainer();
- }
-
// ********** java annotations -> persistence model **********
public void updateFromJava(CompilationUnit astRoot) {
super.updateFromJava(astRoot);
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 960e031b7f..ef1e27dcd8 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
@@ -43,6 +43,7 @@ import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn.DiscriminatorColumnOwner;
import org.eclipse.jpt.core.internal.mappings.IEntity;
import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
import org.eclipse.jpt.core.internal.mappings.INamedQuery;
@@ -342,7 +343,7 @@ public class JavaEntity extends JavaTypeMapping implements IEntity
super(type);
this.table = JpaJavaMappingsFactory.eINSTANCE.createJavaTable(buildTableOwner(), getType());
((InternalEObject) this.table).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ENTITY__TABLE, null, null);
- this.discriminatorColumn = JpaJavaMappingsFactory.eINSTANCE.createJavaDiscriminatorColumn(type);
+ this.discriminatorColumn = JpaJavaMappingsFactory.eINSTANCE.createJavaDiscriminatorColumn(new DiscriminatorColumnOwner(this), type, JavaDiscriminatorColumn.ANNOTATION_ADAPTER);
((InternalEObject) this.discriminatorColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_COLUMN, null, null);
// this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(IPrimaryKeyJoinColumnModelAdapter.DEFAULT));
// this.eAdapters().add(this.buildListener());
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java
index fcc50652d4..e57f25d8d6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java
@@ -25,6 +25,7 @@ import org.eclipse.jpt.core.internal.mappings.IColumn;
import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
import org.eclipse.jpt.core.internal.mappings.IOverride;
import org.eclipse.jpt.core.internal.mappings.ITable;
+import org.eclipse.jpt.core.internal.mappings.INamedColumn.Owner;
/**
* <!-- begin-user-doc -->
@@ -421,8 +422,8 @@ public class JpaJavaMappingsFactory extends EFactoryImpl
return javaSecondaryTable;
}
- public JavaDiscriminatorColumn createJavaDiscriminatorColumn(Type type) {
- JavaDiscriminatorColumn javaDiscriminatorColumn = new JavaDiscriminatorColumn(type);
+ public JavaDiscriminatorColumn createJavaDiscriminatorColumn(Owner owner, Type type, DeclarationAnnotationAdapter daa) {
+ JavaDiscriminatorColumn javaDiscriminatorColumn = new JavaDiscriminatorColumn(owner, type, daa);
return javaDiscriminatorColumn;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java
index a1b2568c35..c56abbbfc6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java
@@ -21,6 +21,7 @@ import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
import org.eclipse.jpt.core.internal.mappings.IColumn;
import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
import org.eclipse.jpt.core.internal.mappings.IJoinTable;
+import org.eclipse.jpt.core.internal.mappings.INamedColumn;
import org.eclipse.jpt.core.internal.mappings.ITable;
/**
@@ -530,13 +531,12 @@ public class OrmFactory extends EFactoryImpl
return xmlAssociationOverride;
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
public XmlDiscriminatorColumn createXmlDiscriminatorColumn() {
- XmlDiscriminatorColumn xmlDiscriminatorColumn = new XmlDiscriminatorColumn();
+ throw new UnsupportedOperationException("Use createXmlDiscriminatorColumn(INamedColumn.Owner) instead");
+ }
+
+ public XmlDiscriminatorColumn createXmlDiscriminatorColumn(INamedColumn.Owner owner) {
+ XmlDiscriminatorColumn xmlDiscriminatorColumn = new XmlDiscriminatorColumn(owner);
return xmlDiscriminatorColumn;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java
index 8cfedf91ca..73da75cf58 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jpt.core.internal.mappings.DiscriminatorType;
import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.mappings.INamedColumn;
import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
import org.eclipse.jpt.db.internal.Table;
@@ -127,15 +128,14 @@ public class XmlDiscriminatorColumn extends AbstractXmlNamedColumn
*/
protected static final int SPECIFIED_LENGTH_FOR_XML_EDEFAULT = 0;
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
protected XmlDiscriminatorColumn() {
- super();
+ throw new UnsupportedOperationException();
}
-
+
+ protected XmlDiscriminatorColumn(INamedColumn.Owner owner) {
+ super(owner);
+ }
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -633,10 +633,6 @@ public class XmlDiscriminatorColumn extends AbstractXmlNamedColumn
return result.toString();
}
- public Table dbTable() {
- return entity().primaryDbTable();
- }
-
private XmlEntityInternal entity() {
return (XmlEntityInternal) eContainer();
}
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 bb103e3623..d34fc2af3f 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
@@ -30,6 +30,7 @@ import org.eclipse.jpt.core.internal.jdtutility.Type;
import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn.DiscriminatorColumnOwner;
import org.eclipse.jpt.core.internal.mappings.IEntity;
import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
import org.eclipse.jpt.core.internal.mappings.INamedQuery;
@@ -316,7 +317,7 @@ public class XmlEntityInternal extends XmlTypeMapping
super();
this.table = OrmFactory.eINSTANCE.createXmlTable(buildTableOwner());
((InternalEObject) this.table).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__TABLE, null, null);
- this.discriminatorColumn = OrmFactory.eINSTANCE.createXmlDiscriminatorColumn();
+ this.discriminatorColumn = OrmFactory.eINSTANCE.createXmlDiscriminatorColumn(new DiscriminatorColumnOwner(this));
((InternalEObject) this.discriminatorColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN, null, null);
this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(0));
}
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 3c9aa72e95..9be95a9aaf 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
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.mappings;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.ITypeMapping;
import org.eclipse.jpt.db.internal.Table;
/**
@@ -129,9 +131,26 @@ public interface IDiscriminatorColumn extends INamedColumn
* @generated
*/
int getLength();
-
- /**
- * return the resolved db table for the discriminatorColumn
- */
- Table dbTable();
+
+ class DiscriminatorColumnOwner implements INamedColumn.Owner {
+
+ private IEntity entity;
+
+ public DiscriminatorColumnOwner(IEntity entity) {
+ super();
+ this.entity = entity;
+ }
+
+ public Table dbTable(String tableName) {
+ return this.entity.dbTable(tableName);
+ }
+
+ public ITextRange getTextRange() {
+ return this.entity.getDiscriminatorColumn().getTextRange();
+ }
+
+ public ITypeMapping getTypeMapping() {
+ return this.entity;
+ }
+ }
} // IDiscriminatorColumn
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java
index 58fe69ec4d..b0eab2d822 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java
@@ -376,7 +376,7 @@ public class InheritanceComposite extends BaseJpaComposite {
}
private Table getDbTable() {
- return this.discriminatorColumn.dbTable();
+ return this.entity.primaryDbTable();
}
private void populateColumnCombo() {

Back to the top