Search in sources :

Example 1 with IncludeTable

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;
}
Also used : DbImportTreeNode(org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode) Schema(org.apache.cayenne.dbsync.reverse.dbimport.Schema) IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog) ExcludeTable(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable)

Example 2 with IncludeTable

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);
        }
    }
}
Also used : DbImportTreeNode(org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode) Schema(org.apache.cayenne.dbsync.reverse.dbimport.Schema) IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) TransferableNode(org.apache.cayenne.modeler.dialog.db.load.TransferableNode)

Example 3 with IncludeTable

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);
    }
}
Also used : IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) Schema(org.apache.cayenne.dbsync.reverse.dbimport.Schema) ExcludeTable(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog)

Example 4 with IncludeTable

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);
    }
}
Also used : ExcludeRelationship(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeRelationship) Schema(org.apache.cayenne.dbsync.reverse.dbimport.Schema) IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog)

Example 5 with IncludeTable

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);
    }
}
Also used : Schema(org.apache.cayenne.dbsync.reverse.dbimport.Schema) IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) ExcludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn) IncludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog)

Aggregations

IncludeTable (org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable)26 Catalog (org.apache.cayenne.dbsync.reverse.dbimport.Catalog)10 IncludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn)10 Schema (org.apache.cayenne.dbsync.reverse.dbimport.Schema)10 DbImportTreeNode (org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode)9 ExcludeTable (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable)6 ReverseEngineering (org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering)6 ExcludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn)5 FilterContainer (org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer)5 TransferableNode (org.apache.cayenne.modeler.dialog.db.load.TransferableNode)4 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 IncludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure)2 DbImportView (org.apache.cayenne.modeler.editor.dbimport.DbImportView)2 DBConnectionInfo (org.apache.cayenne.modeler.pref.DBConnectionInfo)2 SQLException (java.sql.SQLException)1 TreePath (javax.swing.tree.TreePath)1 DbImportConfiguration (org.apache.cayenne.dbsync.reverse.dbimport.DbImportConfiguration)1 ExcludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeProcedure)1 ExcludeRelationship (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeRelationship)1