use of org.apache.cayenne.dbsync.reverse.dbimport.SchemaContainer in project cayenne by apache.
the class AddSchemaAction method performAction.
@Override
public void performAction(ActionEvent e) {
ReverseEngineering reverseEngineeringOldCopy = prepareElements();
Schema newSchema = new Schema(name);
if (canBeInserted(selectedElement)) {
((SchemaContainer) selectedElement.getUserObject()).addSchema(newSchema);
selectedElement.add(new DbImportTreeNode(newSchema));
updateSelected = true;
} else if (canInsert()) {
if (parentElement.isReverseEngineering()) {
((ReverseEngineering) parentElement.getUserObject()).addSchema(newSchema);
} else {
((Catalog) parentElement.getUserObject()).addSchema(newSchema);
}
parentElement.add(new DbImportTreeNode(newSchema));
updateSelected = false;
}
completeInserting(reverseEngineeringOldCopy);
}
use of org.apache.cayenne.dbsync.reverse.dbimport.SchemaContainer in project cayenne by apache.
the class DatabaseSchemaLoader method packFilterContainer.
private FilterContainer packFilterContainer(String catalogName, String schemaName) {
SchemaContainer parentCatalog;
if (catalogName == null) {
parentCatalog = databaseReverseEngineering;
} else {
parentCatalog = getCatalogByName(databaseReverseEngineering.getCatalogs(), catalogName);
if (parentCatalog == null) {
parentCatalog = new Catalog();
parentCatalog.setName(catalogName);
databaseReverseEngineering.addCatalog((Catalog) parentCatalog);
}
}
Schema parentSchema = null;
if (schemaName != null) {
parentSchema = getSchemaByName(parentCatalog.getSchemas(), schemaName);
if (parentSchema == null) {
parentSchema = new Schema();
parentSchema.setName(schemaName);
parentCatalog.addSchema(parentSchema);
}
}
return parentSchema == null ? parentCatalog : parentSchema;
}
Aggregations