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);
}
}
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);
}
}
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);
}
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);
}
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;
}
Aggregations