use of org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable in project cayenne by apache.
the class ColorTreeRenderer method mergeAsFilterContainer.
private boolean mergeAsFilterContainer(FilterContainer container, Object object) {
if (object instanceof IncludeTable) {
container.addIncludeTable((IncludeTable) object);
container.addIncludeProcedure(new IncludeProcedure("tmp include to disable include all behaviour"));
return true;
} else if (object instanceof ExcludeTable) {
container.addExcludeTable((ExcludeTable) object);
container.addIncludeProcedure(new IncludeProcedure("tmp include to disable include all behaviour"));
container.addIncludeTable(new IncludeTable("tmp include to disable include all behaviour"));
return true;
} else if (object instanceof IncludeProcedure) {
container.addIncludeProcedure((IncludeProcedure) object);
return true;
} else if (object instanceof ExcludeProcedure) {
container.addExcludeProcedure((ExcludeProcedure) object);
container.addIncludeProcedure(new IncludeProcedure("tmp include to disable include all behaviour"));
return true;
} else if (object instanceof IncludeColumn) {
container.addIncludeColumn((IncludeColumn) object);
return true;
} else if (object instanceof ExcludeColumn) {
container.addExcludeColumn((ExcludeColumn) object);
return true;
}
return false;
}
use of org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable in project cayenne by apache.
the class TableNode method getStatus.
@Override
public Status getStatus(ReverseEngineering config) {
T parent = getParent();
if (parent != null) {
Status parentStatus = parent.getStatus(config);
if (parentStatus != Status.INCLUDE) {
return parentStatus;
}
}
List<IncludeTable> includeTables = new ArrayList<>();
List<ExcludeTable> excludeTables = new ArrayList<>();
for (FilterContainer container : getContainers(config)) {
if (container == null) {
continue;
}
includeTables.addAll(container.getIncludeTables());
excludeTables.addAll(container.getExcludeTables());
}
return includesTable(includeTables, excludeTables);
}
use of org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable in project cayenne by apache.
the class DbLoaderContext method buildConfig.
public boolean buildConfig(DataSourceWizard connectionWizard, DbLoaderOptionsDialog dialog) {
if (dialog == null || connectionWizard == null) {
return false;
}
// Build filters
ReverseEngineering reverseEngineering = new ReverseEngineering();
reverseEngineering.addCatalog(new Catalog(dialog.getSelectedCatalog()));
reverseEngineering.addSchema(new Schema(dialog.getSelectedSchema()));
reverseEngineering.addIncludeTable(new IncludeTable(dialog.getTableIncludePattern()));
if (dialog.getTableExcludePattern() != null) {
reverseEngineering.addExcludeTable(new ExcludeTable(dialog.getTableExcludePattern()));
}
// Add here auto_pk_support table
reverseEngineering.addExcludeTable(new ExcludeTable("auto_pk_support|AUTO_PK_SUPPORT"));
reverseEngineering.addIncludeProcedure(new IncludeProcedure(dialog.getProcedureNamePattern()));
FiltersConfigBuilder filtersConfigBuilder = new FiltersConfigBuilder(reverseEngineering);
DbImportConfiguration config = new DbImportConfiguration() {
@Override
public DbLoaderDelegate createLoaderDelegate() {
return new LoaderDelegate(DbLoaderContext.this);
}
};
// Build config
DBConnectionInfo connectionInfo = connectionWizard.getConnectionInfo();
config.setAdapter(connectionWizard.getAdapter().getClass().getName());
config.setUsername(connectionInfo.getUserName());
config.setPassword(connectionInfo.getPassword());
config.setDriver(connectionInfo.getJdbcDriver());
config.setUrl(connectionInfo.getUrl());
config.getDbLoaderConfig().setFiltersConfig(filtersConfigBuilder.build());
config.setMeaningfulPkTables(dialog.getMeaningfulPk());
config.setNamingStrategy(dialog.getNamingStrategy());
config.setUsePrimitives(dialog.isUsePrimitives());
config.setUseJava7Types(dialog.isUseJava7Typed());
setConfig(config);
prepareDataMap();
return true;
}
use of org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable in project cayenne by apache.
the class AddPatternParamAction method addPatternParamToContainer.
private void addPatternParamToContainer(Class paramClass, Object selectedObject, String name, DbImportTreeNode node) {
FilterContainer container = (FilterContainer) selectedObject;
PatternParam element = null;
if (paramClass == ExcludeTable.class) {
element = new ExcludeTable(name);
container.addExcludeTable((ExcludeTable) element);
} else if (paramClass == IncludeColumn.class) {
element = new IncludeColumn(name);
container.addIncludeColumn((IncludeColumn) element);
} else if (paramClass == ExcludeColumn.class) {
element = new ExcludeColumn(name);
container.addExcludeColumn((ExcludeColumn) element);
} else if (paramClass == IncludeProcedure.class) {
element = new IncludeProcedure(name);
container.addIncludeProcedure((IncludeProcedure) element);
} else if (paramClass == ExcludeProcedure.class) {
element = new ExcludeProcedure(name);
container.addExcludeProcedure((ExcludeProcedure) element);
}
node.add(new DbImportTreeNode(element));
}
use of org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable in project cayenne by apache.
the class FiltersConfigBuilderTest method testCompact_03.
@Test
public void testCompact_03() {
ReverseEngineering engineering = new ReverseEngineering();
engineering.addCatalog(new Catalog("APP1"));
engineering.addCatalog(new Catalog("APP2"));
engineering.addExcludeTable(new ExcludeTable("SYS_.*"));
engineering.addExcludeColumn(new ExcludeColumn("calculated_.*"));
FiltersConfigBuilder builder = new FiltersConfigBuilder(engineering);
builder.compact();
assertEquals("ReverseEngineering: \n" + " Catalog: APP1\n" + " Schema: null\n" + " IncludeTable: null\n" + " ExcludeColumn: calculated_.*\n" + " ExcludeTable: SYS_.*\n" + " Catalog: APP2\n" + " Schema: null\n" + " IncludeTable: null\n" + " ExcludeColumn: calculated_.*\n" + " ExcludeTable: SYS_.*\n\n" + " Use primitives", engineering.toString());
}
Aggregations