use of org.apache.cayenne.dbsync.reverse.dbimport.Schema in project cayenne by apache.
the class FiltersConfigBuilder method clearGlobalFilters.
private void clearGlobalFilters() {
for (Catalog catalog : engineering.getCatalogs()) {
catalog.clearIncludeTables();
catalog.clearExcludeTables();
catalog.clearIncludeProcedures();
catalog.clearExcludeProcedures();
catalog.clearIncludeColumns();
catalog.clearExcludeColumns();
catalog.clearExcludeRelationships();
for (Schema schema : catalog.getSchemas()) {
schema.clearIncludeColumns();
schema.clearExcludeColumns();
schema.clearExcludeRelationships();
}
}
engineering.clearIncludeTables();
engineering.clearExcludeTables();
engineering.clearIncludeProcedures();
engineering.clearExcludeProcedures();
engineering.clearIncludeColumns();
engineering.clearExcludeColumns();
engineering.clearExcludeRelationships();
engineering.getSchemas().clear();
}
use of org.apache.cayenne.dbsync.reverse.dbimport.Schema 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);
}
}
use of org.apache.cayenne.dbsync.reverse.dbimport.Schema in project cayenne by apache.
the class FiltersConfigBuilder method transformSchemas.
private SchemaFilter[] transformSchemas(Collection<Schema> schemas) {
SchemaFilter[] schemaFilters = new SchemaFilter[schemas.size()];
int i = 0;
for (Schema schema : schemas) {
schemaFilters[i] = new SchemaFilter(schema.getName(), new TableFilter(transformIncludeTable(schema.getIncludeTables()), transformExcludeTable(schema.getExcludeTables())), transform(schema.getIncludeProcedures(), schema.getExcludeProcedures()));
i++;
}
return schemaFilters;
}
use of org.apache.cayenne.dbsync.reverse.dbimport.Schema in project cayenne by apache.
the class DbImporterMojoConfigurationTest method testLoadSchema.
@Test
public void testLoadSchema() throws Exception {
Map<String, Schema> schemas = new HashMap<>();
for (Schema s : getCdbImport("pom-schema.xml").getReverseEngineering().getSchemas()) {
schemas.put(s.getName(), s);
}
assertEquals(3, schemas.size());
Schema s3 = schemas.get("schema-name-03");
assertNotNull(s3);
assertSchemaContent(s3);
}
use of org.apache.cayenne.dbsync.reverse.dbimport.Schema in project cayenne by apache.
the class DbImporterOldMojoConfigurationTest method testLoadSchema.
public void testLoadSchema() throws Exception {
Map<String, Schema> schemas = new HashMap<>();
for (Schema s : getCdbImport("pom-schema.xml").getReverseEngineering().getSchemas()) {
schemas.put(s.getName(), s);
}
assertEquals(3, schemas.size());
Schema s3 = schemas.get("schema-name-03");
assertNotNull(s3);
assertSchemaContent(s3);
}
Aggregations