Search in sources :

Example 6 with Catalog

use of org.apache.cayenne.dbsync.reverse.dbimport.Catalog 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 7 with Catalog

use of org.apache.cayenne.dbsync.reverse.dbimport.Catalog 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)

Example 8 with Catalog

use of org.apache.cayenne.dbsync.reverse.dbimport.Catalog in project cayenne by apache.

the class AddCatalogAction method performAction.

@Override
public void performAction(ActionEvent e) {
    ReverseEngineering reverseEngineeringOld = prepareElements();
    Catalog newCatalog = new Catalog(name);
    if (canBeInserted(selectedElement)) {
        ((ReverseEngineering) selectedElement.getUserObject()).addCatalog(newCatalog);
        selectedElement.add(new DbImportTreeNode(newCatalog));
        updateSelected = true;
    } else if (canInsert()) {
        ((ReverseEngineering) parentElement.getUserObject()).addCatalog(newCatalog);
        parentElement.add(new DbImportTreeNode(newCatalog));
        updateSelected = false;
    }
    completeInserting(reverseEngineeringOld);
}
Also used : ReverseEngineering(org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering) DbImportTreeNode(org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog)

Example 9 with Catalog

use of org.apache.cayenne.dbsync.reverse.dbimport.Catalog in project cayenne by apache.

the class DbImporterMojoConfigurationTest method testLoadCatalog.

@Test
public void testLoadCatalog() throws Exception {
    Map<String, Catalog> catalogs = new HashMap<>();
    for (Catalog c : getCdbImport("pom-catalog.xml").getReverseEngineering().getCatalogs()) {
        catalogs.put(c.getName(), c);
    }
    assertEquals(3, catalogs.size());
    Catalog c3 = catalogs.get("catalog-name-03");
    assertNotNull(c3);
    assertCatalog(c3);
}
Also used : HashMap(java.util.HashMap) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog) Test(org.junit.Test)

Example 10 with Catalog

use of org.apache.cayenne.dbsync.reverse.dbimport.Catalog in project cayenne by apache.

the class SchemaTableNode method getContainers.

@Override
List<FilterContainer> getContainers(ReverseEngineering config) {
    List<FilterContainer> containers = new ArrayList<>();
    if (getParent() != null && getParent().getParent() != null) {
        Catalog catalog = getParent().getParent().getCatalog(config);
        if (catalog != null) {
            containers.add(getParent().getSchema(catalog));
            containers.add(catalog);
        }
        containers.add(getParent().getSchema(config));
    }
    containers.add(config);
    return containers;
}
Also used : FilterContainer(org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer) ArrayList(java.util.ArrayList) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog)

Aggregations

Catalog (org.apache.cayenne.dbsync.reverse.dbimport.Catalog)30 Schema (org.apache.cayenne.dbsync.reverse.dbimport.Schema)18 IncludeTable (org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable)11 ExcludeTable (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable)7 ReverseEngineering (org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering)7 Test (org.junit.Test)7 DbImportTreeNode (org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode)6 ResultSet (java.sql.ResultSet)4 IncludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn)4 ArrayList (java.util.ArrayList)3 ExcludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn)3 FilterContainer (org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer)3 IncludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure)3 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 HashMap (java.util.HashMap)2 TreePath (javax.swing.tree.TreePath)2 ExcludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeProcedure)2 TransferableNode (org.apache.cayenne.modeler.dialog.db.load.TransferableNode)2 DbImportView (org.apache.cayenne.modeler.editor.dbimport.DbImportView)2