use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class IncludeTableHandler method createIncludeTable.
private void createIncludeTable() {
includeTable = new IncludeTable();
entity.addIncludeTable(includeTable);
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class SchemaHandler method createIncludeTable.
private void createIncludeTable(String includeTableData) {
if (includeTableData.trim().length() == 0) {
return;
}
if (schema != null) {
IncludeTable includeTable = new IncludeTable();
includeTable.setName(includeTableData);
schema.addIncludeTable(includeTable);
}
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class LoadDbSchemaAction method performAction.
public void performAction(ActionEvent e, TreePath tablePath) {
final DbImportView rootParent = ((DbImportView) draggableTreePanel.getParent().getParent());
rootParent.getLoadDbSchemaProgress().setVisible(true);
rootParent.getLoadDbSchemaButton().setEnabled(false);
Thread thread = new Thread(() -> {
LoadDbSchemaAction.this.setEnabled(false);
rootParent.lockToolbarButtons();
draggableTreePanel.getMoveButton().setEnabled(false);
draggableTreePanel.getMoveInvertButton().setEnabled(false);
try {
DBConnectionInfo connectionInfo = getConnectionInfo("Load Db Schema");
if (connectionInfo == null) {
return;
}
if (tablePath != null) {
Object userObject = ((DbImportTreeNode) tablePath.getLastPathComponent()).getUserObject();
if (userObject instanceof Catalog) {
Catalog catalog = (Catalog) userObject;
if (catalog.getSchemas().isEmpty()) {
loadTables(connectionInfo, tablePath, rootParent);
}
} else if (userObject instanceof Schema) {
loadTables(connectionInfo, tablePath, rootParent);
} else if (userObject instanceof IncludeTable) {
loadColumns(connectionInfo, tablePath);
} else {
loadTables(connectionInfo, tablePath, rootParent);
}
} else {
loadDataBase(connectionInfo);
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(Application.getFrame(), ex.getMessage(), "Error loading db schema", JOptionPane.ERROR_MESSAGE);
LOGGER.warn("Error loading db schema", ex);
} finally {
rootParent.getLoadDbSchemaButton().setEnabled(true);
rootParent.getLoadDbSchemaProgress().setVisible(false);
rootParent.unlockToolbarButtons();
}
});
thread.start();
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class DbImporterMojoTest method testFilteringConfig.
@Test
public void testFilteringConfig() throws Exception {
DbImporterMojo cdbImport = getCdbImport("config/pom-01.xml");
assertEquals(2, cdbImport.getReverseEngineering().getCatalogs().size());
Iterator<Catalog> iterator = cdbImport.getReverseEngineering().getCatalogs().iterator();
assertEquals("catalog-name-01", iterator.next().getName());
Catalog catalog = iterator.next();
assertEquals("catalog-name-02", catalog.getName());
Iterator<Schema> schemaIterator = catalog.getSchemas().iterator();
assertEquals("schema-name-01", schemaIterator.next().getName());
Schema schema = schemaIterator.next();
assertEquals("schema-name-02", schema.getName());
Iterator<IncludeTable> includeTableIterator = schema.getIncludeTables().iterator();
assertEquals("incTable-01", includeTableIterator.next().getPattern());
IncludeTable includeTable = includeTableIterator.next();
assertEquals("incTable-02", includeTable.getPattern());
assertEquals("includeColumn-01", includeTable.getIncludeColumns().iterator().next().getPattern());
assertEquals("excludeColumn-01", includeTable.getExcludeColumns().iterator().next().getPattern());
assertEquals("includeColumn-02", schema.getIncludeColumns().iterator().next().getPattern());
assertEquals("excludeColumn-02", schema.getExcludeColumns().iterator().next().getPattern());
assertEquals("includeColumn-03", catalog.getIncludeColumns().iterator().next().getPattern());
assertEquals("excludeColumn-03", catalog.getExcludeColumns().iterator().next().getPattern());
schemaIterator = cdbImport.getReverseEngineering().getSchemas().iterator();
schema = schemaIterator.next();
assertEquals("schema-name-03", schema.getName());
schema = schemaIterator.next();
assertEquals("schema-name-04", schema.getName());
includeTableIterator = schema.getIncludeTables().iterator();
assertEquals("incTable-04", includeTableIterator.next().getPattern());
assertEquals("excTable-04", schema.getExcludeTables().iterator().next().getPattern());
includeTable = includeTableIterator.next();
assertEquals("incTable-05", includeTable.getPattern());
assertEquals("includeColumn-04", includeTable.getIncludeColumns().iterator().next().getPattern());
assertEquals("excludeColumn-04", includeTable.getExcludeColumns().iterator().next().getPattern());
assertEquals("includeColumn-04", schema.getIncludeColumns().iterator().next().getPattern());
assertEquals("excludeColumn-04", schema.getExcludeColumns().iterator().next().getPattern());
assertEquals("includeColumn-03", catalog.getIncludeColumns().iterator().next().getPattern());
assertEquals("excludeColumn-03", catalog.getExcludeColumns().iterator().next().getPattern());
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class FiltersConfigBuilderTest method testCompact_01.
@Test
public void testCompact_01() {
ReverseEngineering engineering = new ReverseEngineering();
engineering.addIncludeTable(new IncludeTable("table1"));
engineering.addIncludeTable(new IncludeTable("table2"));
engineering.addIncludeTable(new IncludeTable("table3"));
engineering.addIncludeColumn(new IncludeColumn("includeColumn"));
FiltersConfigBuilder builder = new FiltersConfigBuilder(engineering);
builder.compact();
assertEquals("ReverseEngineering: \n" + " Catalog: null\n" + " Schema: null\n" + " IncludeTable: table1\n" + " IncludeColumn: includeColumn\n" + " IncludeTable: table2\n" + " IncludeColumn: includeColumn\n" + " IncludeTable: table3\n" + " IncludeColumn: includeColumn\n\n" + " Use primitives", engineering.toString());
}
Aggregations