acab4046c1c0c607f17ce36e2c891655d0e6f155
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / io / wizard / AbcdImportWizard.java
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 java.net.URI;
14
15 import org.eclipse.jface.viewers.IStructuredSelection;
16 import org.eclipse.ui.IWorkbench;
17
18 import eu.etaxonomy.cdm.database.DbSchemaValidation;
19 import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
20 import eu.etaxonomy.taxeditor.store.CdmStore;
21
22 /**
23 * <p>AbcdImportWizard class.</p>
24 *
25 * @author n.hoffmann
26 * @created Jun 16, 2010
27 * @version 1.0
28 */
29 public class AbcdImportWizard extends AbstractImportWizard<Abcd206ImportConfigurator> {
30
31 private Abcd206ImportConfigurator configurator;
32 private ImportFromFileDataSourceWizardPage dataSourcePage;
33
34 /* (non-Javadoc)
35 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
36 */
37 /** {@inheritDoc} */
38 @Override
39 public Abcd206ImportConfigurator getConfigurator() {
40 return configurator;
41 }
42
43 /* (non-Javadoc)
44 * @see org.eclipse.jface.wizard.Wizard#performFinish()
45 */
46 /** {@inheritDoc} */
47 @Override
48 public boolean performFinish() {
49 URI source = dataSourcePage.getUri();
50 // InputStream inputStream = new FileInputStream(new File(source));
51 configurator.setSource(source);
52 configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
53
54 CdmStore.getImportManager().run(configurator);
55 return true;
56
57 }
58
59 /* (non-Javadoc)
60 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
61 */
62 /** {@inheritDoc} */
63 @Override
64 public void init(IWorkbench workbench, IStructuredSelection selection) {
65 super.init(workbench, selection);
66 configurator = CdmStore.getImportManager().AbcdConfigurator();
67 }
68
69 /* (non-Javadoc)
70 * @see eu.etaxonomy.taxeditor.io.AbstractImportWizard#addPages()
71 */
72 /** {@inheritDoc} */
73 @Override
74 public void addPages() {
75 super.addPages();
76
77 dataSourcePage = ImportFromFileDataSourceWizardPage.XML();
78 addPage(dataSourcePage);
79 }
80 }