Revision 43527305
Added by Cherian Mathew over 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java | ||
---|---|---|
16 | 16 |
import java.net.URI; |
17 | 17 |
|
18 | 18 |
import org.apache.log4j.Logger; |
19 |
import org.eclipse.core.runtime.jobs.Job; |
|
19 | 20 |
import org.eclipse.jface.viewers.IStructuredSelection; |
20 | 21 |
import org.eclipse.ui.IWorkbench; |
21 | 22 |
|
22 | 23 |
import eu.etaxonomy.cdm.database.DbSchemaValidation; |
24 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE; |
|
23 | 25 |
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; |
24 | 26 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
25 | 27 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
55 | 57 |
/** {@inheritDoc} */ |
56 | 58 |
@Override |
57 | 59 |
public boolean performFinish() { |
58 |
URI source = dataSourcePage.getUri(); |
|
59 |
try { |
|
60 |
configurator.setSource(new FileInputStream(new File(source))); |
|
61 |
} catch (FileNotFoundException e) { |
|
62 |
MessagingUtils.errorDialog("File not found.", this, "Import file was not found.", TaxeditorStorePlugin.PLUGIN_ID, e, false); |
|
63 |
logger.error("File not found!", e); |
|
64 |
return false; |
|
65 |
} |
|
66 |
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE); |
|
60 |
URI source = dataSourcePage.getUri(); |
|
61 |
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE); |
|
67 | 62 |
|
68 |
if(classificationChooserWizardPage.getClassification()!=null){
|
|
69 |
configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
|
|
70 |
}
|
|
71 |
configurator.setReportUri(classificationChooserWizardPage.getReportUri());
|
|
63 |
if(classificationChooserWizardPage.getClassification()!=null){
|
|
64 |
configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
|
|
65 |
}
|
|
66 |
configurator.setReportUri(classificationChooserWizardPage.getReportUri());
|
|
72 | 67 |
|
73 |
CdmStore.getImportManager().run(configurator); |
|
74 |
return true; |
|
68 |
if(CdmStore.getCurrentSessionManager().isRemoting()) { |
|
69 |
Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM); |
|
70 |
CdmStore.getImportManager().run(job); |
|
71 |
} else { |
|
72 |
try { |
|
73 |
configurator.setSource(new FileInputStream(new File(source))); |
|
74 |
} catch (FileNotFoundException e) { |
|
75 |
MessagingUtils.errorDialog("File not found.", this, "Import file was not found.", TaxeditorStorePlugin.PLUGIN_ID, e, false); |
|
76 |
logger.error("File not found!", e); |
|
77 |
return false; |
|
78 |
} |
|
79 |
CdmStore.getImportManager().run(configurator); |
|
80 |
} |
|
81 |
return true; |
|
75 | 82 |
|
76 | 83 |
} |
77 | 84 |
|
Also available in: Unified diff
#5130 Extend import wizards to import data via remoting and Add tests for the same