1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.io.wizard;
|
12
|
|
13
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
14
|
import org.eclipse.ui.IWorkbench;
|
15
|
|
16
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
17
|
import eu.etaxonomy.cdm.io.berlinModel.out.BerlinModelExportConfigurator;
|
18
|
import eu.etaxonomy.cdm.io.common.Source;
|
19
|
import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceSQLServerWizardPage;
|
20
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
21
|
|
22
|
/**
|
23
|
* <p>BerlinModelExportWizard class.</p>
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created 23.06.2009
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class BerlinModelExportWizard extends AbstractExportWizard<BerlinModelExportConfigurator> {
|
30
|
|
31
|
private CdmDataSourceSQLServerWizardPage pageDataSource;
|
32
|
|
33
|
|
34
|
private BerlinModelExportConfigurator configurator;
|
35
|
|
36
|
/* (non-Javadoc)
|
37
|
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
|
38
|
*/
|
39
|
/** {@inheritDoc} */
|
40
|
public void init(IWorkbench workbench, IStructuredSelection selection) {
|
41
|
this.setWindowTitle("Berlin Model Export");
|
42
|
configurator = BerlinModelExportConfigurator.NewInstance(null, null);
|
43
|
}
|
44
|
|
45
|
/* (non-Javadoc)
|
46
|
* @see org.eclipse.jface.wizard.Wizard#addPages()
|
47
|
*/
|
48
|
/** {@inheritDoc} */
|
49
|
@Override
|
50
|
public void addPages() {
|
51
|
super.addPages();
|
52
|
|
53
|
pageDataSource = new CdmDataSourceSQLServerWizardPage(null);
|
54
|
this.addPage(pageDataSource);
|
55
|
|
56
|
|
57
|
|
58
|
}
|
59
|
|
60
|
/* (non-Javadoc)
|
61
|
* @see org.eclipse.jface.wizard.Wizard#performFinish()
|
62
|
*/
|
63
|
/** {@inheritDoc} */
|
64
|
@Override
|
65
|
public boolean performFinish() {
|
66
|
|
67
|
ICdmDataSource dataSource = pageDataSource.getDataSource();
|
68
|
|
69
|
// FIXME use new constructor Source(ICdmDataSource)
|
70
|
Source destination = new Source(Source.SQL_SERVER_2005,
|
71
|
dataSource.getServer(),
|
72
|
dataSource.getDatabase(),
|
73
|
dataSource.getPort());
|
74
|
destination.setUserAndPwd(dataSource.getUsername(), dataSource.getPassword());
|
75
|
|
76
|
configurator.setDestination(destination);
|
77
|
|
78
|
CdmStore.getExportHandler().run(configurator);
|
79
|
|
80
|
return true;
|
81
|
}
|
82
|
|
83
|
/* (non-Javadoc)
|
84
|
* @see eu.etaxonomy.taxeditor.io.AbstractExportWizard#getConfigurator()
|
85
|
*/
|
86
|
/** {@inheritDoc} */
|
87
|
@Override
|
88
|
public BerlinModelExportConfigurator getConfigurator() {
|
89
|
return configurator;
|
90
|
}
|
91
|
|
92
|
}
|