1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.io.wizard;
|
11
|
|
12
|
import java.io.File;
|
13
|
import java.net.URI;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
17
|
import org.eclipse.ui.IWorkbench;
|
18
|
|
19
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
20
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
|
21
|
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
|
22
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
23
|
|
24
|
/**
|
25
|
*
|
26
|
* @author n.hoffmann
|
27
|
* @created Jun 16, 2010
|
28
|
* @version 1.0
|
29
|
*/
|
30
|
public class AbcdImportWizard extends AbstractImportWizard<Abcd206ImportConfigurator> {
|
31
|
|
32
|
private static final Logger logger = Logger.getLogger(AbcdImportWizard.class);
|
33
|
|
34
|
private Abcd206ImportConfigurator configurator;
|
35
|
private AbcdSourceSelectionPage dataSourcePage;
|
36
|
private ClassificationChooserWizardPage classificationChooserWizardPage;
|
37
|
|
38
|
/** {@inheritDoc} */
|
39
|
@Override
|
40
|
public Abcd206ImportConfigurator getConfigurator() {
|
41
|
return configurator;
|
42
|
}
|
43
|
|
44
|
/** {@inheritDoc} */
|
45
|
@Override
|
46
|
public boolean performFinish() {
|
47
|
URI source = dataSourcePage.getUri();
|
48
|
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
|
49
|
|
50
|
if(classificationChooserWizardPage.getClassification()!=null){
|
51
|
configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
|
52
|
}
|
53
|
|
54
|
CdmStore.getImportManager().runMoniteredOperation(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
|
55
|
|
56
|
return true;
|
57
|
|
58
|
}
|
59
|
|
60
|
/** {@inheritDoc} */
|
61
|
@Override
|
62
|
public void init(IWorkbench workbench, IStructuredSelection selection) {
|
63
|
super.init(workbench, selection);
|
64
|
configurator = CdmStore.getImportManager().AbcdConfigurator();
|
65
|
}
|
66
|
|
67
|
@Override
|
68
|
protected void addConfiguratorPage() {
|
69
|
AbcdImportConfiguratorWizardPage configuratorWizardPage = AbcdImportConfiguratorWizardPage.createPage(configurator);
|
70
|
addPage(configuratorWizardPage);
|
71
|
}
|
72
|
|
73
|
/** {@inheritDoc} */
|
74
|
@Override
|
75
|
public void addPages() {
|
76
|
super.addPages();
|
77
|
|
78
|
classificationChooserWizardPage = ClassificationChooserWizardPage.createPage();
|
79
|
|
80
|
dataSourcePage = ImportFromFileDataSourceWizardPage.XML();
|
81
|
|
82
|
addPage(classificationChooserWizardPage);
|
83
|
addPage(dataSourcePage);
|
84
|
}
|
85
|
}
|