use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class DbImportTree method findNodeInParent.
DbImportTreeNode findNodeInParent(DbImportTreeNode parent, Object object) {
for (int i = 0; i < parent.getChildCount(); i++) {
DbImportTreeNode node = (DbImportTreeNode) parent.getChildAt(i);
Object userObject = node.getUserObject();
if (object instanceof Catalog) {
Catalog catalog = (Catalog) object;
if (!(userObject instanceof Catalog)) {
continue;
}
Catalog currentCatalog = (Catalog) userObject;
if (currentCatalog.getName().equals(catalog.getName())) {
return node;
}
}
if (object instanceof Schema) {
Schema schema = (Schema) object;
if (!(userObject instanceof Schema)) {
continue;
}
Schema currentSchema = (Schema) userObject;
if (currentSchema.getName().equals(schema.getName())) {
return node;
}
}
if (object instanceof IncludeTable) {
IncludeTable table = (IncludeTable) object;
if (!(userObject instanceof IncludeTable)) {
continue;
}
IncludeTable currentTable = (IncludeTable) userObject;
if (currentTable.getPattern().equals(table.getPattern())) {
return node;
}
}
if (object instanceof ExcludeTable) {
ExcludeTable table = (ExcludeTable) object;
if (!(userObject instanceof ExcludeTable)) {
continue;
}
ExcludeTable currentTable = (ExcludeTable) userObject;
if (currentTable.getPattern().equals(table.getPattern())) {
return node;
}
}
}
return null;
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class DbImportTree method printSchemas.
private void printSchemas(Collection<Schema> schemas, DbImportTreeNode parent) {
for (Schema schema : schemas) {
DbImportTreeNode node = !isTransferable ? new DbImportTreeNode(schema) : new TransferableNode(schema);
if (!"".equals(node.getSimpleNodeName())) {
if (isTransferable && schema.getIncludeTables().isEmpty() && schema.getExcludeTables().isEmpty()) {
printParams(Collections.singletonList(new IncludeTable("Loading...")), node);
}
printChildren(schema, node);
parent.add(node);
}
}
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class FiltersConfigBuilder method compactTableFilter.
private void compactTableFilter() {
Collection<IncludeTable> engIncludeTables = engineering.getIncludeTables();
Collection<ExcludeTable> engExcludeTables = engineering.getExcludeTables();
for (Catalog catalog : engineering.getCatalogs()) {
Collection<IncludeTable> catalogIncludeTables = catalog.getIncludeTables();
Collection<ExcludeTable> catalogExcludeTables = catalog.getExcludeTables();
for (Schema schema : catalog.getSchemas()) {
schema.getIncludeTables().addAll(engIncludeTables);
schema.getIncludeTables().addAll(catalogIncludeTables);
schema.getExcludeTables().addAll(engExcludeTables);
schema.getExcludeTables().addAll(catalogExcludeTables);
}
}
for (Schema schema : engineering.getSchemas()) {
schema.getIncludeTables().addAll(engIncludeTables);
schema.getExcludeTables().addAll(engExcludeTables);
}
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class FiltersConfigBuilder method compactRelationshipFilters.
private void compactRelationshipFilters() {
Collection<ExcludeRelationship> engExcludeRelationship = engineering.getExcludeRelationship();
for (Catalog catalog : engineering.getCatalogs()) {
Collection<ExcludeRelationship> catalogExcludeRelationship = catalog.getExcludeRelationship();
for (Schema schema : catalog.getSchemas()) {
Collection<ExcludeRelationship> schemaExcludeRelationship = schema.getExcludeRelationship();
for (IncludeTable includeTable : schema.getIncludeTables()) {
includeTable.getExcludeRelationship().addAll(engExcludeRelationship);
includeTable.getExcludeRelationship().addAll(catalogExcludeRelationship);
includeTable.getExcludeRelationship().addAll(schemaExcludeRelationship);
}
}
for (IncludeTable includeTable : catalog.getIncludeTables()) {
includeTable.getExcludeRelationship().addAll(engExcludeRelationship);
includeTable.getExcludeRelationship().addAll(catalogExcludeRelationship);
}
}
for (Schema schema : engineering.getSchemas()) {
Collection<ExcludeRelationship> schemaExcludeRelationship = schema.getExcludeRelationship();
for (IncludeTable includeTable : schema.getIncludeTables()) {
includeTable.getExcludeRelationship().addAll(engExcludeRelationship);
includeTable.getExcludeRelationship().addAll(schemaExcludeRelationship);
}
}
for (IncludeTable includeTable : engineering.getIncludeTables()) {
includeTable.getExcludeRelationship().addAll(engExcludeRelationship);
}
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class FiltersConfigBuilder method compactColumnFilters.
private void compactColumnFilters() {
Collection<IncludeColumn> engIncludeColumns = engineering.getIncludeColumns();
Collection<ExcludeColumn> engExcludeColumns = engineering.getExcludeColumns();
for (Catalog catalog : engineering.getCatalogs()) {
Collection<IncludeColumn> catalogIncludeColumns = catalog.getIncludeColumns();
Collection<ExcludeColumn> catalogExcludeColumns = catalog.getExcludeColumns();
for (Schema schema : catalog.getSchemas()) {
Collection<IncludeColumn> schemaIncludeColumns = schema.getIncludeColumns();
Collection<ExcludeColumn> schemaExcludeColumns = schema.getExcludeColumns();
for (IncludeTable includeTable : schema.getIncludeTables()) {
includeTable.getIncludeColumns().addAll(engIncludeColumns);
includeTable.getIncludeColumns().addAll(catalogIncludeColumns);
includeTable.getIncludeColumns().addAll(schemaIncludeColumns);
includeTable.getExcludeColumns().addAll(engExcludeColumns);
includeTable.getExcludeColumns().addAll(catalogExcludeColumns);
includeTable.getExcludeColumns().addAll(schemaExcludeColumns);
}
}
for (IncludeTable includeTable : catalog.getIncludeTables()) {
includeTable.getIncludeColumns().addAll(engIncludeColumns);
includeTable.getIncludeColumns().addAll(catalogIncludeColumns);
includeTable.getExcludeColumns().addAll(engExcludeColumns);
includeTable.getExcludeColumns().addAll(catalogExcludeColumns);
}
}
for (Schema schema : engineering.getSchemas()) {
Collection<IncludeColumn> schemaIncludeColumns = schema.getIncludeColumns();
Collection<ExcludeColumn> schemaExcludeColumns = schema.getExcludeColumns();
for (IncludeTable includeTable : schema.getIncludeTables()) {
includeTable.getIncludeColumns().addAll(engIncludeColumns);
includeTable.getIncludeColumns().addAll(schemaIncludeColumns);
includeTable.getExcludeColumns().addAll(engExcludeColumns);
includeTable.getExcludeColumns().addAll(schemaExcludeColumns);
}
}
for (IncludeTable includeTable : engineering.getIncludeTables()) {
includeTable.getIncludeColumns().addAll(engIncludeColumns);
includeTable.getExcludeColumns().addAll(engExcludeColumns);
}
}
Aggregations