use of org.apache.cayenne.modeler.dialog.ValidationResultBrowser in project cayenne by apache.
the class DBGeneratorOptions method generateSchemaAction.
/**
* Performs configured schema operations via DbGenerator.
*/
public void generateSchemaAction() {
DataSourceWizard connectWizard = new DataSourceWizard(this.getParent(), "Generate DB Schema: Connect to Database");
if (!connectWizard.startupAction()) {
return;
}
this.connectionInfo = connectWizard.getConnectionInfo();
refreshGeneratorAction();
Collection<ValidationResult> failures = new ArrayList<ValidationResult>();
// sanity check...
for (DbGenerator generator : generators) {
if (generator.isEmpty(true)) {
JOptionPane.showMessageDialog(getView(), "Nothing to generate.");
return;
}
try {
generator.runGenerator(connectWizard.getDataSource());
failures.add(generator.getFailures());
} catch (Throwable th) {
reportError("Schema Generation Error", th);
}
}
if (failures.size() == 0) {
JOptionPane.showMessageDialog(getView(), "Schema Generation Complete.");
} else {
new ValidationResultBrowser(this).startupAction("Schema Generation Complete", "Schema generation finished. The following problem(s) were ignored.", failures);
}
}
Aggregations