Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins')
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java18
5 files changed, 55 insertions, 16 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java
index 2278497b80..0c4238e616 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java
@@ -79,9 +79,8 @@ final class Catalog extends DTPWrapper implements Comparable<Catalog> {
// ***** schemata
- @SuppressWarnings("unchecked")
synchronized Set<Schema> buildSchemata() {
- EList<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata = this.dtpCatalog.getSchemas();
+ EList<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata = this.dtpSchemata();
Set<Schema> result = new HashSet<Schema>( dtpSchemata.size());
for (org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema : dtpSchemata) {
@@ -89,7 +88,12 @@ final class Catalog extends DTPWrapper implements Comparable<Catalog> {
}
return result;
}
-
+
+ @SuppressWarnings("unchecked")
+ private EList<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata() {
+ return this.dtpCatalog.getSchemas();
+ }
+
private Schema wrap( org.eclipse.datatools.modelbase.sql.schema.Schema schema) {
return new Schema( this.database, schema);
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java
index c35b6b1366..4fd0f20a79 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java
@@ -147,13 +147,17 @@ public final class DTPDatabaseWrapper extends Database {
}
@SuppressWarnings("unchecked")
+ private EList<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata() {
+ return this.dtpDatabase.getSchemas();
+ }
+
private Set<Schema> buildSchemata() {
Set<Schema> result;
if( this.supportsCatalogs()) {
result = this.getSchemataForCatalogNamed( this.profile.getCatalogName());
}
else {
- EList<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata = this.dtpDatabase.getSchemas();
+ EList<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata = this.dtpSchemata();
result = new HashSet<Schema>( dtpSchemata.size());
for (org.eclipse.datatools.modelbase.sql.schema.Schema dtpSchema : dtpSchemata) {
result.add( this.wrap(dtpSchema));
@@ -164,14 +168,17 @@ public final class DTPDatabaseWrapper extends Database {
// ***** catalogs
- @SuppressWarnings("unchecked")
@Override
public boolean supportsCatalogs() {
- EList<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata = this.dtpDatabase.getSchemas();
+ EList<org.eclipse.datatools.modelbase.sql.schema.Schema> dtpSchemata = this.dtpSchemata();
return ( dtpSchemata == null || dtpSchemata.size() == 0);
}
@SuppressWarnings("unchecked")
+ private EList<org.eclipse.datatools.modelbase.sql.schema.Catalog> dtpCatalogs() {
+ return this.dtpDatabase.getCatalogs();
+ }
+
@Override
public String getDefaultCatalogName() {
@@ -179,7 +186,7 @@ public final class DTPDatabaseWrapper extends Database {
return "";
}
String userName = this.profile.getUserName();
- for (org.eclipse.datatools.modelbase.sql.schema.Catalog dtpCatalog : (EList<org.eclipse.datatools.modelbase.sql.schema.Catalog>) this.dtpDatabase.getCatalogs()) {
+ for (org.eclipse.datatools.modelbase.sql.schema.Catalog dtpCatalog : this.dtpCatalogs()) {
if( dtpCatalog.getName().length() == 0) { // special catalog that contains all schemata
return "";
}
@@ -198,10 +205,9 @@ public final class DTPDatabaseWrapper extends Database {
return this.catalogs;
}
- @SuppressWarnings("unchecked")
private Set<Catalog> buildCatalogs() {
- EList<org.eclipse.datatools.modelbase.sql.schema.Catalog> dtpCatalogs = this.dtpDatabase.getCatalogs();
+ EList<org.eclipse.datatools.modelbase.sql.schema.Catalog> dtpCatalogs = this.dtpCatalogs();
if( dtpCatalogs == null) {
return Collections.emptySet();
}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java
index a617bf4271..6fc0501d6a 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java
@@ -187,10 +187,19 @@ public final class ForeignKey extends DTPWrapper implements Comparable<ForeignKe
}
@SuppressWarnings("unchecked")
+ private List<org.eclipse.datatools.modelbase.sql.tables.Column> dtpBaseColumns() {
+ return this.dtpForeignKey.getMembers();
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<org.eclipse.datatools.modelbase.sql.tables.Column> dtpRefColumns() {
+ return this.dtpForeignKey.getUniqueConstraint().getMembers();
+ }
+
private Set<ColumnPair> buildColumnPairs() {
- List<org.eclipse.datatools.modelbase.sql.tables.Column> baseColumns = this.dtpForeignKey.getMembers();
+ List<org.eclipse.datatools.modelbase.sql.tables.Column> baseColumns = this.dtpBaseColumns();
int size = baseColumns.size();
- List<org.eclipse.datatools.modelbase.sql.tables.Column> refColumns = this.dtpForeignKey.getUniqueConstraint().getMembers();
+ List<org.eclipse.datatools.modelbase.sql.tables.Column> refColumns = this.dtpRefColumns();
if (refColumns.size() != size) {
throw new IllegalStateException("mismatched sizes: " + size + " vs. " + refColumns.size());
}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java
index 012f3df52d..9ef2c7fb04 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java
@@ -136,8 +136,12 @@ public final class Schema extends DTPWrapper implements Comparable<Schema> {
}
@SuppressWarnings("unchecked")
+ private Collection<org.eclipse.datatools.modelbase.sql.tables.Table> dtpTables() {
+ return this.dtpSchema.getTables();
+ }
+
private Set<Table> buildTables() {
- Collection<org.eclipse.datatools.modelbase.sql.tables.Table> dtpTables = this.dtpSchema.getTables();
+ Collection<org.eclipse.datatools.modelbase.sql.tables.Table> dtpTables = this.dtpTables();
Set<Table> result = new HashSet<Table>( dtpTables.size());
for (org.eclipse.datatools.modelbase.sql.tables.Table dtpTable : dtpTables) {
result.add( this.wrap(dtpTable));
@@ -220,8 +224,12 @@ public final class Schema extends DTPWrapper implements Comparable<Schema> {
}
@SuppressWarnings("unchecked")
+ private Collection<org.eclipse.datatools.modelbase.sql.schema.Sequence> dtpSequences() {
+ return this.dtpSchema.getSequences();
+ }
+
private Set<Sequence> buildSequences() {
- Collection<org.eclipse.datatools.modelbase.sql.schema.Sequence> dtpSequences = this.dtpSchema.getSequences();
+ Collection<org.eclipse.datatools.modelbase.sql.schema.Sequence> dtpSequences = this.dtpSequences();
Set<Sequence> result = new HashSet<Sequence>( dtpSequences.size());
for (org.eclipse.datatools.modelbase.sql.schema.Sequence dtpSequence : dtpSequences) {
result.add( this.wrap(dtpSequence));
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java
index d06d2ebb51..7b49b72f8c 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java
@@ -161,8 +161,12 @@ public final class Table extends DTPWrapper implements Comparable<Table> {
}
@SuppressWarnings("unchecked")
+ private Collection<org.eclipse.datatools.modelbase.sql.tables.Column> dtpColumns() {
+ return this.dtpTable.getColumns();
+ }
+
private Set<Column> buildColumns() {
- Collection<org.eclipse.datatools.modelbase.sql.tables.Column> dtpColumns = this.dtpTable.getColumns();
+ Collection<org.eclipse.datatools.modelbase.sql.tables.Column> dtpColumns = this.dtpColumns();
Set<Column> result = new HashSet<Column>(dtpColumns.size());
for (org.eclipse.datatools.modelbase.sql.tables.Column c : dtpColumns) {
result.add(new Column(this, c));
@@ -246,6 +250,10 @@ public final class Table extends DTPWrapper implements Comparable<Table> {
}
@SuppressWarnings("unchecked")
+ private Collection<org.eclipse.datatools.modelbase.sql.tables.Column> columns(PrimaryKey pk) {
+ return pk.getMembers();
+ }
+
private Set<Column> buildPrimaryKeyColumns() {
if ( ! (this.dtpTable instanceof BaseTable)) {
return Collections.emptySet();
@@ -255,7 +263,7 @@ public final class Table extends DTPWrapper implements Comparable<Table> {
// no PK was defined
return Collections.emptySet();
}
- Collection<org.eclipse.datatools.modelbase.sql.tables.Column> pkColumns = pk.getMembers();
+ Collection<org.eclipse.datatools.modelbase.sql.tables.Column> pkColumns = this.columns(pk);
Set<Column> result = new HashSet<Column>(pkColumns.size());
for (org.eclipse.datatools.modelbase.sql.tables.Column pkColumn : pkColumns) {
result.add(this.column(pkColumn));
@@ -286,11 +294,15 @@ public final class Table extends DTPWrapper implements Comparable<Table> {
}
@SuppressWarnings("unchecked")
+ private Collection<org.eclipse.datatools.modelbase.sql.constraints.ForeignKey> dtpForeignKeys() {
+ return ((BaseTable) this.dtpTable).getForeignKeys();
+ }
+
private Set<ForeignKey> buildForeignKeys() {
if ( ! (this.dtpTable instanceof BaseTable)) {
return Collections.emptySet();
}
- Collection<org.eclipse.datatools.modelbase.sql.constraints.ForeignKey> dtpForeignKeys = ((BaseTable) this.dtpTable).getForeignKeys();
+ Collection<org.eclipse.datatools.modelbase.sql.constraints.ForeignKey> dtpForeignKeys = this.dtpForeignKeys();
Set<ForeignKey> result = new HashSet<ForeignKey>(dtpForeignKeys.size());
for (org.eclipse.datatools.modelbase.sql.constraints.ForeignKey dtpForeignKey : dtpForeignKeys) {
result.add(new ForeignKey(this, dtpForeignKey));

Back to the top