<elements xsi:type="commands:Command" xmi:id="_QbHeEKmQEeeDJPU_cUTI2g" elementId="eu.etaxonomy.taxeditor.store.command.importAbcd" commandName="%wizard.name.3"/>
<elements xsi:type="commands:Command" xmi:id="_tpPnUKmfEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelDistribution" commandName="%wizard.name.23"/>
<elements xsi:type="commands:Command" xmi:id="_qAEkYKmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelTaxa" commandName="%wizard.name.2"/>
+ <elements xsi:type="commands:Command" xmi:id="_tBCr8KmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.imnportRisReference" commandName="%wizard.name.24"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
<elements xsi:type="commands:Handler" xmi:id="_2yHUgKmYEeeDJPU_cUTI2g" elementId="eu.etaxonomy.taxeditor.io.e4.abcd.OpenAbcdImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.abcd.OpenAbcdImportWizard" command="_QbHeEKmQEeeDJPU_cUTI2g"/>
<elements xsi:type="commands:Handler" xmi:id="_6slh0KmfEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.excel.distribution.OpenExcelDistributionImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.excel.distribution.OpenExcelDistributionImportWizard" command="_tpPnUKmfEeeTAPHmaMLwQQ"/>
<elements xsi:type="commands:Handler" xmi:id="_wvx9oKmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.excel.taxa.OpenExcelTaxaImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.excel.taxa.OpenExcelTaxaImportWizard" command="_qAEkYKmjEeeTAPHmaMLwQQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_96ANIKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.ris.OpenRisImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.ris.OpenRisImportWizard" command="_tBCr8KmsEeeTAPHmaMLwQQ"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
<elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="Term Editor">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_wnmZYKmgEeeTAPHmaMLwQQ" coreExpressionId="isShowExperimentalFeatures"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_0z1o8KmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exceldistribution" label="%wizard.name.2" command="_qAEkYKmjEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_pQNeoKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.risReference" label="%wizard.name.24" command="_qAEkYKmjEeeTAPHmaMLwQQ"/>
</elements>
</fragments>
</fragment:ModelFragments>
--- /dev/null
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.io.e4.ris;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.reference.ris.in.RisReferenceImportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.ImportFromFileDataSourceWizardPageE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExcelDistributionUpdateWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 12.05.2017
+ *
+ */
+public class RISImportWizardE4 extends AbstractImportWizardE4<RisReferenceImportConfigurator>{
+
+ private RisReferenceImportConfigurator configurator;
+
+ private ImportFromFileDataSourceWizardPageE4 dataSourcePage;
+
+ private static final Logger logger = Logger.getLogger(ExcelDistributionUpdateWizard.class);
+
+ @Inject
+ public RISImportWizardE4(IEclipseContext context, EPartService partService) {
+ super(context, partService, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public RisReferenceImportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ URI source = dataSourcePage.getUri();
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ File file = new File(source);
+ FileInputStream fis;
+
+ try {
+ fis = new FileInputStream(file);
+ byte[] data;
+ data = IOUtils.toByteArray(fis);
+ configurator.setStream(data);
+//TODO: workaround, needs to be changed to source as byte array
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, data, SOURCE_TYPE.INPUTSTREAM);
+ CdmStore.getImportManager().run(job);
+ } catch (FileNotFoundException e) {
+ logger.error("Error while reading file" + source.toString());
+ } catch (IOException e){
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ configurator = RisReferenceImportConfigurator.NewInstance();
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ addDataSourcePage();
+ }
+ @Override
+ protected void addConfiguratorPage(){
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setIgnoreNull");
+ ignoreMethods.add("setInteractWithUser");
+ ignoreMethods.add("setUseClassification");
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ pageConfiguration.initImport(getConfigurator(), ignoreMethods, "Ris Import");
+ addPage(pageConfiguration);
+ }
+
+ private void addDataSourcePage(){
+ dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPageE4.class, context);
+ dataSourcePage.setTitle("Choose Ris File");
+ dataSourcePage.setDescription("Please choose an xls file in the Distribution Update format.");
+ dataSourcePage.setExtensions(new String[]{"*.txt"});
+ addPage(dataSourcePage);
+ }
+
+}