use of org.pentaho.di.ui.spoon.wizards.RipDatabaseWizardPage1 in project pentaho-kettle by pentaho.
the class SpoonJobDelegate method ripDBWizard.
/**
* Create a job that extracts tables & data from a database.
* <p>
* <p>
*
* 0) Select the database to rip
* <p>
* 1) Select the tables in the database to rip
* <p>
* 2) Select the database to dump to
* <p>
* 3) Select the repository directory in which it will end up
* <p>
* 4) Select a name for the new job
* <p>
* 5) Create an empty job with the selected name.
* <p>
* 6) Create 1 transformation for every selected table
* <p>
* 7) add every created transformation to the job & evaluate
* <p>
*/
public void ripDBWizard() {
final List<DatabaseMeta> databases = spoon.getActiveDatabases();
if (databases.size() == 0) {
// Nothing to do here
return;
}
final RipDatabaseWizardPage1 page1 = new RipDatabaseWizardPage1("1", databases);
final RipDatabaseWizardPage2 page2 = new RipDatabaseWizardPage2("2");
final RipDatabaseWizardPage3 page3 = new RipDatabaseWizardPage3("3", spoon.getRepository());
Wizard wizard = new Wizard() {
public boolean performFinish() {
try {
JobMeta jobMeta = ripDB(databases, page3.getJobname(), page3.getRepositoryDirectory(), page3.getDirectory(), page1.getSourceDatabase(), page1.getTargetDatabase(), page2.getSelection());
if (jobMeta == null) {
return false;
}
if (page3.getRepositoryDirectory() != null) {
spoon.saveToRepository(jobMeta, false);
} else {
spoon.saveToFile(jobMeta);
}
addJobGraph(jobMeta);
return true;
} catch (Exception e) {
new ErrorDialog(spoon.getShell(), "Error", "An unexpected error occurred!", e);
return false;
}
}
/**
* @see org.eclipse.jface.wizard.Wizard#canFinish()
*/
public boolean canFinish() {
return page3.canFinish();
}
};
wizard.addPage(page1);
wizard.addPage(page2);
wizard.addPage(page3);
WizardDialog wd = new WizardDialog(spoon.getShell(), wizard);
WizardDialog.setDefaultImage(GUIResource.getInstance().getImageWizard());
wd.setMinimumPageSize(700, 400);
wd.updateSize();
wd.open();
}
Aggregations