Search in sources :

Example 16 with IncludeTable

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

the class FiltersConfigBuilderTest method includeTable.

protected IncludeTable includeTable(String name, String incCol, String excCol) {
    IncludeTable incTable01 = new IncludeTable(name);
    incTable01.addIncludeColumn(new IncludeColumn(incCol));
    incTable01.addExcludeColumn(new ExcludeColumn(excCol));
    return incTable01;
}
Also used : IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) ExcludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn) IncludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn)

Example 17 with IncludeTable

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

the class FiltersConfigBuilderTest method testCompact_02.

@Test
public void testCompact_02() {
    ReverseEngineering engineering = new ReverseEngineering();
    engineering.addCatalog(new Catalog("catalogName"));
    engineering.addSchema(new Schema("schemaName01"));
    engineering.addSchema(new Schema("schemaName02"));
    engineering.addIncludeTable(new IncludeTable("table1"));
    engineering.addExcludeTable(new ExcludeTable("table2"));
    engineering.addIncludeColumn(new IncludeColumn("includeColumn"));
    FiltersConfigBuilder builder = new FiltersConfigBuilder(engineering);
    builder.compact();
    assertEquals("ReverseEngineering: \n" + "  Catalog: catalogName\n" + "    Schema: schemaName01\n" + "      IncludeTable: table1\n" + "        IncludeColumn: includeColumn\n" + "      ExcludeTable: table2\n" + "    Schema: schemaName02\n" + "      IncludeTable: table1\n" + "        IncludeColumn: includeColumn\n" + "      ExcludeTable: table2\n\n" + "  Use primitives", engineering.toString());
}
Also used : ReverseEngineering(org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering) Schema(org.apache.cayenne.dbsync.reverse.dbimport.Schema) IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) IncludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog) ExcludeTable(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable) Test(org.junit.Test)

Example 18 with IncludeTable

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

the class DatabaseSchemaLoader method addColumn.

private void addColumn(FilterContainer filterContainer, IncludeTable table, String columnName) {
    if (columnName == null) {
        return;
    }
    filterContainer = filterContainer == null ? databaseReverseEngineering : filterContainer;
    IncludeTable foundTable = getTableByName(filterContainer.getIncludeTables(), table.getPattern());
    table = foundTable != null ? foundTable : table;
    IncludeColumn includeColumn = new IncludeColumn(columnName);
    table.addIncludeColumn(includeColumn);
}
Also used : IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) IncludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn)

Example 19 with IncludeTable

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

the class DatabaseSchemaLoader method packTable.

private void packTable(String tableName, String catalogName, String schemaName, String columnName) {
    IncludeTable table = new IncludeTable();
    table.setPattern(tableName);
    if (catalogName == null && schemaName == null) {
        if (!databaseReverseEngineering.getIncludeTables().contains(table)) {
            databaseReverseEngineering.addIncludeTable(table);
        }
        addColumn(null, table, columnName);
        return;
    }
    FilterContainer filterContainer = packFilterContainer(catalogName, schemaName);
    addTable(filterContainer, table);
    addColumn(filterContainer, table, columnName);
}
Also used : IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) FilterContainer(org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer)

Example 20 with IncludeTable

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

the class DbImportTree method printCatalogs.

private void printCatalogs(Collection<Catalog> catalogs, DbImportTreeNode parent) {
    for (Catalog catalog : catalogs) {
        DbImportTreeNode node = !isTransferable ? new DbImportTreeNode(catalog) : new TransferableNode(catalog);
        if (!"".equals(node.getSimpleNodeName())) {
            if (isTransferable && catalog.getSchemas().isEmpty() && catalog.getIncludeTables().isEmpty() && catalog.getExcludeTables().isEmpty()) {
                printParams(Collections.singletonList(new IncludeTable("Loading...")), node);
            }
            printSchemas(catalog.getSchemas(), node);
            printChildren(catalog, node);
            parent.add(node);
        }
    }
}
Also used : DbImportTreeNode(org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode) IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) TransferableNode(org.apache.cayenne.modeler.dialog.db.load.TransferableNode) 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