Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jpa
diff options
context:
space:
mode:
authorbvosburgh2007-05-15 05:06:37 +0000
committerbvosburgh2007-05-15 05:06:37 +0000
commit6e99b381c456ecb9d9600dde0610ccaf14276d96 (patch)
treed95afd4cc691a97d4c9811c59678444e2fc4cf06 /jpa
parent18d1f88a4e6ad79b8cd02e5cab50c51038feeb62 (diff)
downloadwebtools.dali-6e99b381c456ecb9d9600dde0610ccaf14276d96.tar.gz
webtools.dali-6e99b381c456ecb9d9600dde0610ccaf14276d96.tar.xz
webtools.dali-6e99b381c456ecb9d9600dde0610ccaf14276d96.zip
[181471] added more code-completion
Diffstat (limited to 'jpa')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTable.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java67
-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/XmlTableGenerator.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java12
14 files changed, 151 insertions, 33 deletions
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 6f86e91312..d9e9b6c8e3 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
@@ -974,6 +974,12 @@ public abstract class AbstractJavaTable extends JavaEObject implements ITable
if (this.catalogTouches(pos, astRoot)) {
return this.quotedCandidateCatalogs(filter);
}
+ for (IUniqueConstraint constraint : this.getUniqueConstraints()) {
+ result = ((JavaUniqueConstraint) constraint).connectedCandidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
return null;
}
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 6ef2c47006..462c868876 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
@@ -2913,13 +2913,19 @@ public class JavaEntity extends JavaTypeMapping implements IEntity
if (result != null) {
return result;
}
- result = this.getJavaTableGenerator().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
+ JavaTableGenerator jtg = this.getJavaTableGenerator();
+ if (jtg != null) {
+ result = jtg.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
}
- result = this.getJavaSequenceGenerator().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
+ JavaSequenceGenerator jsg = this.getJavaSequenceGenerator();
+ if (jsg != null) {
+ result = jsg.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
}
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java
index a3098641de..42c33be4f1 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java
@@ -792,7 +792,7 @@ public class JavaJoinTable extends AbstractJavaTable implements IJoinTable
@Override
protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
- return JavaUniqueConstraint.createJoinTableUniqueConstraint(getMember(), index);
+ return JavaUniqueConstraint.createJoinTableUniqueConstraint(new UniqueConstraintOwner(this), this.getMember(), index);
}
// ********** IJoinTable implementation **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java
index 39e7a9886d..7f124ad360 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java
@@ -501,9 +501,6 @@ public abstract class JavaNamedColumn extends JavaEObject
return this.dbColumn() != null;
}
- /**
- * called if the database is connected
- */
@Override
public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
@@ -518,7 +515,7 @@ public abstract class JavaNamedColumn extends JavaEObject
private Iterator<String> candidateNames() {
Table dbTable = this.dbTable();
- return (dbTable != null) ? dbTable.columnNames() : EmptyIterator.<String> instance();
+ return (dbTable != null) ? dbTable.columnNames() : EmptyIterator.<String>instance();
}
private Iterator<String> candidateNames(Filter<String> filter) {
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 7dda449087..90ea29fcef 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
@@ -429,7 +429,7 @@ public class JavaSecondaryTable extends AbstractJavaTable
@Override
protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
- return JavaUniqueConstraint.createSecondaryTableUniqueConstraint(this, getMember(), index);
+ return JavaUniqueConstraint.createSecondaryTableUniqueConstraint(new UniqueConstraintOwner(this), this.getDeclarationAnnotationAdapter(), getMember(), index);
}
// ********** persistence model -> java annotations **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTable.java
index 6db2416d94..85f8693b50 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTable.java
@@ -83,6 +83,6 @@ public class JavaTable extends AbstractJavaTable
@Override
protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
- return JavaUniqueConstraint.createTableUniqueConstraint(getMember(), index);
+ return JavaUniqueConstraint.createTableUniqueConstraint(new UniqueConstraintOwner(this), this.getMember(), index);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java
index f42a7ab6b1..d6377e8463 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java
@@ -30,6 +30,8 @@ import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
import org.eclipse.jpt.core.internal.platform.DefaultsContext;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
/**
* <!-- begin-user-doc -->
@@ -1242,7 +1244,16 @@ public class JavaTableGenerator extends JavaGenerator
}
protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
- return JavaUniqueConstraint.createTableGeneratorUniqueConstraint(getMember(), index);
+ return JavaUniqueConstraint.createTableGeneratorUniqueConstraint(new UniqueConstraintOwner(this), this.getMember(), index);
+ }
+
+ public Table dbTable() {
+ Schema schema = this.dbSchema();
+ return (schema == null) ? null : schema.tableNamed(this.getTable());
+ }
+
+ public Schema dbSchema() {
+ return this.database().schemaNamed(this.getSchema());
}
// ********** jpa model -> java annotations **********
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 e5b573e9c5..a3cd6e981f 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
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.internal.content.java.mappings;
import java.util.Collection;
+import java.util.Iterator;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
@@ -35,6 +36,9 @@ import org.eclipse.jpt.core.internal.jdtutility.StringArrayExpressionConverter;
import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
/**
* <!-- begin-user-doc -->
@@ -59,6 +63,8 @@ public class JavaUniqueConstraint extends JavaEObject
*/
protected EList<String> columnNames;
+ private final IUniqueConstraint.Owner owner;
+
private final Member member;
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.UNIQUE_CONSTRAINT);
@@ -73,11 +79,12 @@ public class JavaUniqueConstraint extends JavaEObject
protected JavaUniqueConstraint() {
super();
- throw new UnsupportedOperationException("Use JavaUniqueConstraint(Member) instead");
+ throw new UnsupportedOperationException("Use JavaUniqueConstraint(IUniqueConstraint.Owner, Member, IndexedDeclarationAnnotationAdapter) instead");
}
- protected JavaUniqueConstraint(Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ protected JavaUniqueConstraint(IUniqueConstraint.Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
super();
+ this.owner = owner;
this.member = member;
this.idaa = idaa;
this.annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
@@ -252,10 +259,46 @@ public class JavaUniqueConstraint extends JavaEObject
return result.toString();
}
+ public IUniqueConstraint.Owner getOwner() {
+ return this.owner;
+ }
+
public ITextRange validationTextRange() {
return this.member.annotationTextRange(this.idaa);
}
+ protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.member.annotationElementTextRange(elementAdapter, astRoot), pos);
+ }
+
+ private boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.columnNamesDeclarationAdapter, pos, astRoot);
+ }
+
+ private Iterator<String> candidateColumnNames() {
+ return this.getOwner().candidateUniqueConstraintColumnNames();
+ }
+
+ private Iterator<String> candidateColumnNames(Filter<String> filter) {
+ return new FilteringIterator<String>(this.candidateColumnNames(), filter);
+ }
+
+ private Iterator<String> quotedCandidateColumnNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateColumnNames(filter));
+ }
+
+ @Override
+ public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.columnNamesTouches(pos, astRoot)) {
+ return this.quotedCandidateColumnNames(filter);
+ }
+ return null;
+ }
+
/**
* allow owners to verify the annotation
*/
@@ -292,32 +335,32 @@ public class JavaUniqueConstraint extends JavaEObject
}
// ********** static methods **********
- static JavaUniqueConstraint createSecondaryTableUniqueConstraint(JavaSecondaryTable secondaryTable, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(member, buildSecondaryTableUniqueConstraintAnnotationAdapter(secondaryTable, index));
+ static JavaUniqueConstraint createSecondaryTableUniqueConstraint(IUniqueConstraint.Owner owner, DeclarationAnnotationAdapter declarationAnnotationAdapter, Member member, int index) {
+ return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(owner, member, buildSecondaryTableUniqueConstraintAnnotationAdapter(declarationAnnotationAdapter, index));
}
- private static IndexedDeclarationAnnotationAdapter buildSecondaryTableUniqueConstraintAnnotationAdapter(JavaSecondaryTable secondaryTable, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(secondaryTable.getDeclarationAnnotationAdapter(), JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
+ private static IndexedDeclarationAnnotationAdapter buildSecondaryTableUniqueConstraintAnnotationAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
}
- static JavaUniqueConstraint createJoinTableUniqueConstraint(Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(member, buildJoinTableUniqueConstraintAnnotationAdapter(index));
+ static JavaUniqueConstraint createJoinTableUniqueConstraint(IUniqueConstraint.Owner owner, Member member, int index) {
+ return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(owner, member, buildJoinTableUniqueConstraintAnnotationAdapter(index));
}
private static IndexedDeclarationAnnotationAdapter buildJoinTableUniqueConstraintAnnotationAdapter(int index) {
return new NestedIndexedDeclarationAnnotationAdapter(JavaJoinTable.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
}
- static JavaUniqueConstraint createTableUniqueConstraint(Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(member, buildTableUniqueConstraintAnnotationAdapter(index));
+ static JavaUniqueConstraint createTableUniqueConstraint(IUniqueConstraint.Owner owner, Member member, int index) {
+ return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(owner, member, buildTableUniqueConstraintAnnotationAdapter(index));
}
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));
+ static JavaUniqueConstraint createTableGeneratorUniqueConstraint(IUniqueConstraint.Owner owner, Member member, int index) {
+ return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(owner, member, buildTableGeneratorUniqueConstraintAnnotationAdapter(index));
}
private static IndexedDeclarationAnnotationAdapter buildTableGeneratorUniqueConstraintAnnotationAdapter(int index) {
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 550203d3bd..6c7a045177 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
@@ -26,6 +26,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.IUniqueConstraint;
import org.eclipse.jpt.core.internal.mappings.INamedColumn.Owner;
/**
@@ -411,8 +412,8 @@ public class JpaJavaMappingsFactory extends EFactoryImpl
return javaCascade;
}
- public JavaUniqueConstraint createJavaUniqueConstraint(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaUniqueConstraint javaUniqueConstraint = new JavaUniqueConstraint(member, idaa);
+ public JavaUniqueConstraint createJavaUniqueConstraint(IUniqueConstraint.Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ JavaUniqueConstraint javaUniqueConstraint = new JavaUniqueConstraint(owner, member, idaa);
return javaUniqueConstraint;
}
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 43e1c93aae..cf10c7787c 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
@@ -23,6 +23,8 @@ import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
import org.eclipse.jpt.core.internal.platform.DefaultsContext;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
/**
* <!-- begin-user-doc -->
@@ -1056,4 +1058,13 @@ public class XmlTableGenerator extends XmlGenerator implements ITableGenerator
protected XmlUniqueConstraint createXmlJavaUniqueConstraint(int index) {
return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
}
-} // XmlTableGenerator
+
+ public Table dbTable() {
+ Schema schema = this.dbSchema();
+ return (schema == null) ? null : schema.tableNamed(this.getTable());
+ }
+
+ public Schema dbSchema() {
+ return this.database().schemaNamed(this.getSchema());
+ }
+}
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 4806261cd7..858d767e9b 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
@@ -201,7 +201,7 @@ public interface IJoinTable extends ITable
* owner for "forward-pointer" JoinColumns;
* these point at the target/inverse entity
*/
- public class InverseJoinColumnOwner extends AbstractJoinColumnOwner
+ class InverseJoinColumnOwner extends AbstractJoinColumnOwner
{
public InverseJoinColumnOwner(IJoinTable joinTable) {
super(joinTable);
@@ -219,6 +219,7 @@ public interface IJoinTable extends ITable
return getJoinTable().relationshipMapping().getPersistentAttribute().getName();
}
+ @Override
public Table dbTable(String tableName) {
Table dbTable = super.dbTable(tableName);
if (dbTable != null) {
@@ -239,7 +240,7 @@ public interface IJoinTable extends ITable
* owner for "back-pointer" JoinColumns;
* these point at the source/owning entity
*/
- public class JoinColumnOwner extends AbstractJoinColumnOwner
+ class JoinColumnOwner extends AbstractJoinColumnOwner
{
public JoinColumnOwner(IJoinTable joinTable) {
super(joinTable);
@@ -272,6 +273,7 @@ public interface IJoinTable extends ITable
return null;
}
+ @Override
public Table dbTable(String tableName) {
Table dbTable = super.dbTable(tableName);
if (dbTable != null) {
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 02abad32b6..96735757f3 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
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.mappings;
+import java.util.Iterator;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jpt.core.internal.IJpaSourceObject;
import org.eclipse.jpt.core.internal.ITextRange;
@@ -267,4 +268,15 @@ public interface ITable extends IJpaSourceObject
ITypeMapping getTypeMapping();
}
+
+ class UniqueConstraintOwner implements IUniqueConstraint.Owner {
+ private final ITable table;
+ public UniqueConstraintOwner(ITable table) {
+ super();
+ this.table = table;
+ }
+ public Iterator<String> candidateUniqueConstraintColumnNames() {
+ return this.table.dbTable().columnNames();
+ }
+ }
}
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 b39c55093e..11c42856d6 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
@@ -9,8 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.mappings;
+import java.util.Iterator;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jpt.core.internal.platform.DefaultsContext;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
/**
* <!-- begin-user-doc -->
@@ -403,4 +406,20 @@ public interface ITableGenerator extends IGenerator
void refreshDefaults(DefaultsContext defaultsContext);
IUniqueConstraint createUniqueConstraint(int index);
-} // ITableGenerator
+
+ Schema dbSchema();
+
+ Table dbTable();
+
+
+ class UniqueConstraintOwner implements IUniqueConstraint.Owner {
+ private final ITableGenerator tableGenerator;
+ public UniqueConstraintOwner(ITableGenerator tableGenerator) {
+ super();
+ this.tableGenerator = tableGenerator;
+ }
+ public Iterator<String> candidateUniqueConstraintColumnNames() {
+ return this.tableGenerator.dbTable().columnNames();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java
index c3455b846e..40bc94a14a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java
@@ -8,6 +8,7 @@
*******************************************************************************/
package org.eclipse.jpt.core.internal.mappings;
+import java.util.Iterator;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jpt.core.internal.IJpaSourceObject;
@@ -44,4 +45,13 @@ public interface IUniqueConstraint extends IJpaSourceObject
* @generated
*/
EList<String> getColumnNames();
-} // IUniqueConstraint
+
+
+ /**
+ * All containers must implement this interface.
+ */
+ interface Owner {
+ Iterator<String> candidateUniqueConstraintColumnNames();
+ }
+
+}

Back to the top