command.label.21 = New\r
command.label.22 = Save\r
command.label.23 = Database Preferences\r
+command.label.24 = Database Repair Functionality\r
product.name = EDIT Taxonomic Editor\r
command.name = Parser Help\r
command.name.0 = About the EDIT Platform\r
command.label.21 = Neu
command.label.22 = Speichern
command.label.23 = Datenbank Präferenzen
+command.label.24 = Datenbank Reparatur Funktionalität
product.name = EDIT Taxonomischer Editor
command.name = Parser Hilfe
command.name.0 = \u00dcber die EDIT Platform
</and>
</visibleWhen>
</command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.application.DatabaseRepairFunctionality"
+ label="%command.label.24"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <and>
+ <reference
+ definitionId="hasROLE_PROJECT_MANAGER">
+ </reference>
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </and>
+ </visibleWhen>
+ </command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu.help">
LanguageEditorPreferencePage_RestartRequired=After changing the default language, a restart is required,\nin order for the new settings to take effect.
OrderPreferencePage_NewNavigatorWindowRequired=After changing the order of the taxon nodes, closing and reopen of the taxon navigator is required.
OrderPreferencePage_PleaseReopenNavigator=Please close and reopen the taxon navigator.
+DatabaseRepairPage_chooseParameter=Please choose the trees where the sortIndex should be recalculated.
+DatabaseRepairPage_updateTaxonNodes=Taxonomic Tree
+DatabaseRepairPage_toolTip_taxonNode=The sort indexes of the taxonomic tree will be recalculated.
+DatabaseRepairPage_PolytomousKeyNode=Polytomous Key
+DatabaseRepairPage_toolTip_polytomousKeyNode=The sort indexes of all polytomous keys are recalculated.
+DatabaseRepairPage_featureNodes=Feature Tree
+DatabaseRepairPage_toolTipFeatureNodes=The sort indexes of the feature tree will be recalculated.
UriWithLabelElement_URL_NOT_SAVED=URI won't be saved\!
UriWithLabelElement_COULD_NOT_OPEN_BROWSER=Could not open external browser. URI is invalid.
UriWithLabelElement_INVALID_URL=Invalid URI
LanguageEditorPreferencePage_PleaseRestart=Bitte neu starten
LanguageEditorPreferencePage_RestartRequired=Nach dem Wechsel der Standardsprache ist ein Neustart erforderlich.
OrderPreferencePage_NewNavigatorWindowRequired=Nach dem Ändern der Taxon Sortierung, ist das Schließen und erneute Öffnen des Taxonnavigators erforderlich.
-OrderPreferencePage_PleaseReopenNavigator=Bitte schließen sie den Taxonnavigator und öffnen ihn erneut.
+OrderPreferencePage_PleaseReopenNavigator=Bitte schließen Sie den Taxonnavigator und öffnen ihn erneut.
+DatabaseRepairPage_chooseParameter=Bitte wählen Sie, für welche Bäume der SortIndex neu berechnet werden soll.
+DatabaseRepairPage_updateTaxonNodes=Taxonomischer Baum
+DatabaseRepairPage_toolTip_taxonNode=Die Sortier Indizes des Taxonomischen Baums werden aktualisiert.
+DatabaseRepairPage_PolytomousKeyNode=Polytome Schlüssel
+DatabaseRepairPage_toolTip_polytomousKeyNode=Die Sortier Indizes aller Polytomen Schlüssel werden aktualisiert.
+DatabaseRepairPage_featureNodes=Merkmalsbaum
+DatabaseRepairPage_toolTipFeatureNodes=Die Sortier Indizes des Merkmalsbaumes werden aktualisiert.
+
UriWithLabelElement_URL_NOT_SAVED=URI wird nicht gespeichert\!
UriWithLabelElement_COULD_NOT_OPEN_BROWSER=Externer Browser konnte nicht geöffnet werden. URI ist ung\u00FCtlig.
UriWithLabelElement_INVALID_URL=Ung\u00FCltige URI
id="eu.etaxonomy.taxeditor.application.DatabaseSettings"
name="%command.label.23">
</command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.handler.OpenDatabaseRepairWizardHandler"
+ id="eu.etaxonomy.taxeditor.application.DatabaseRepairFunctionality"
+ name="%command.label.24">
+ </command>
</extension>
<extension
point="org.eclipse.ui.commands">
*/
public class Messages extends NLS {
private static final String BUNDLE_NAME = "OSGI-INF/l10n/messages"; //$NON-NLS-1$
+
public static String AuthenticatedUserBar_LOGGED_IN_AS;
public static String AuthenticatedUserBar_NOT_LOGGED_IN;
public static String LanguageEditorPreferencePage_ChooseDefaultLanguage;
public static String LanguageEditorPreferencePage_EditorHasToRestart;
public static String LanguageEditorPreferencePage_PleaseRestart;
public static String LanguageEditorPreferencePage_RestartRequired;
+ public static String DatabaseRepairPage_chooseParameter;
+ public static String DatabaseRepairPage_updateTaxonNodes;
+ public static String DatabaseRepairPage_toolTip_taxonNode;
+ public static String DatabaseRepairPage_PolytomousKeyNode;
+ public static String DatabaseRepairPage_toolTip_polytomousKeyNode;
+ public static String DatabaseRepairPage_featureNodes;
+ public static String DatabaseRepairPage_toolTipFeatureNodes;
public static String LoginDialog_CANCEL_MESSAGE;
public static String LoginDialog_LOGIN;
public static String LoginDialog_PASSWORD;
public static String RemotingLoginDialog_STATUS_REMOTING_NOT_ACTIVATED;
public static String RemotingLoginDialog_STATUS_RETRIEVING;
public static String RemotingLoginDialog_STATUS_STARTED;
- public static String RemotingLoginDialog_UPDATE_EDITOR;
+ public static String RemotingLoginDialog_UPDATE_EDITOR;
public static String RemotingLoginDialog_COULD_NOT_STOP_SERVER;
public static String RemotingLoginDialog_ERROR_GENERATING_CONFIG_FILE;
public static String RemotingLoginDialog_ERROR_STARTING_SERVER;
--- /dev/null
+/**
+* Copyright (C) 2016 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.databasePreferences.wizard;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.io.common.SortIndexUpdaterConfigurator;
+import eu.etaxonomy.taxeditor.Messages;
+
+/**
+ * @author k.luther
+ * @date 06.12.2016
+ *
+ */
+public class DatabaseRepairPage extends WizardPage {
+
+ SortIndexUpdaterConfigurator config = null;
+ /**
+ * @param pageName
+ */
+ protected DatabaseRepairPage(String pageName, SortIndexUpdaterConfigurator config){
+ super(pageName);
+ this.config = config;
+ setMessage(Messages.DatabaseRepairPage_chooseParameter);
+ }
+
+
+
+
+
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void createControl(Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NULL);
+
+ GridLayout gridLayout = new GridLayout();
+ composite.setLayout(gridLayout);
+
+ Button checkBoxTaxonNode = new Button(composite, SWT.CHECK);
+ checkBoxTaxonNode.setSelection(config.isDoTaxonNode());
+ checkBoxTaxonNode.setText(Messages.DatabaseRepairPage_updateTaxonNodes);
+ checkBoxTaxonNode
+ .setToolTipText(Messages.DatabaseRepairPage_toolTip_taxonNode);
+ checkBoxTaxonNode.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ config.setDoTaxonNode(!config.isDoTaxonNode());
+ }
+ });
+
+ Button checkBoxPolytomousKeyNode = new Button(composite, SWT.CHECK);
+ checkBoxPolytomousKeyNode.setSelection(config.isDoPolytomousKeyNode());
+ checkBoxPolytomousKeyNode.setText(Messages.DatabaseRepairPage_PolytomousKeyNode);
+ checkBoxPolytomousKeyNode
+ .setToolTipText(Messages.DatabaseRepairPage_toolTip_polytomousKeyNode);
+ checkBoxPolytomousKeyNode.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ config.setDoPolytomousKeyNode(!config.isDoPolytomousKeyNode());
+ }
+ });
+
+ Button checkBoxFeatureNode = new Button(composite, SWT.CHECK);
+ checkBoxFeatureNode.setSelection(config.isDoFeatureNode());
+ checkBoxFeatureNode.setText(Messages.DatabaseRepairPage_featureNodes);
+ checkBoxFeatureNode
+ .setToolTipText(Messages.DatabaseRepairPage_toolTipFeatureNodes);
+ checkBoxFeatureNode.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ config.setDoFeatureNode(!config.isDoFeatureNode());
+ }
+ });
+
+
+
+ setControl(composite);
+
+ }
+
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2016 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.databasePreferences.wizard;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.wizard.Wizard;
+
+import eu.etaxonomy.cdm.config.ICdmSource;
+import eu.etaxonomy.cdm.io.common.SortIndexUpdaterConfigurator;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 06.12.2016
+ *
+ */
+public class DatabaseRepairWizard extends Wizard {
+ private final DatabaseRepairPage repairPage;
+ SortIndexUpdaterConfigurator config;
+
+ public DatabaseRepairWizard() {
+ setWindowTitle("Database Repair Wizard");
+ config = SortIndexUpdaterConfigurator.NewInstance(null);
+ repairPage = new DatabaseRepairPage("Database Repair",config);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performFinish() {
+ if (repairPage.isPageComplete()){
+ if (config == null){
+ ICdmSource source= CdmStore.getActiveCdmSource();
+ config = SortIndexUpdaterConfigurator.NewInstance(null);
+ config.setDoFeatureNode(false);
+ config.setDoPolytomousKeyNode(false);
+
+ }
+ Job updateJob = CdmStore.getImportManager().createIOServiceJob(config);
+
+ CdmStore.getImportManager().run(updateJob);
+ }
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ addPage(repairPage);
+ }
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2016 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.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.wizard.WizardDialog;
+
+import eu.etaxonomy.taxeditor.databasePreferences.wizard.DatabaseRepairWizard;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+
+
+/**
+ * @author k.luther
+ * @date 06.12.2016
+ *
+ */
+public class OpenDatabaseRepairWizardHandler extends AbstractHandler {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ DatabaseRepairWizard databaseRepairWizard = new DatabaseRepairWizard();
+ WizardDialog dialog = new WizardDialog(StoreUtil.getShell(),
+ databaseRepairWizard);
+
+ dialog.open();
+
+ return null;
+ }
+
+
+
+}
import java.io.File;
import java.io.InputStream;
-import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
-import java.util.Set;
import java.util.UUID;
import org.apache.commons.io.IOUtils;
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.common.ImportResult;
+import eu.etaxonomy.cdm.io.common.SortIndexUpdaterConfigurator;
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator;
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
import eu.etaxonomy.cdm.io.jaxb.JaxbImportConfigurator;
import eu.etaxonomy.cdm.io.reference.endnote.in.EndnoteImportConfigurator;
import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
import eu.etaxonomy.cdm.io.service.IIOService;
-import eu.etaxonomy.cdm.io.specimen.SpecimenImportConfiguratorBase;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportState;
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
public SpecimenCdmExcelImportConfigurator SpecimenCdmExcelImportConfigurator() {
return (SpecimenCdmExcelImportConfigurator) getConfigurator(TYPE.SpecimenCdmExcel);
}
-
+
public DwcaImportConfigurator DwcaImportConfigurator() {
return (DwcaImportConfigurator) getConfigurator(TYPE.Gbif);
}
return job;
}
-
+
public Job createIOServiceJob(final Abcd206ImportConfigurator<Abcd206ImportState, InputStream> configurator) {
Assert.isNotNull(configurator, "Configuration may not be null");
final Display display = Display.getDefault();
return job;
}
-
+ public Job createIOServiceJob(final SortIndexUpdaterConfigurator configurator) {
+ Assert.isNotNull(configurator, "Configuration may not be null");
+ final Display display = Display.getDefault();
+ Job job = new Job("Update: " + configurator.getClass().getSimpleName()) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("Updating data", IProgressMonitor.UNKNOWN);
+ IIOService ioService = CdmApplicationState.getIOService();
+
+ ioService.updateSortIndex(configurator);
+
+ monitor.done();
+
+ display.asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ CdmStore.getContextManager().notifyContextRefresh();
+ }
+ });
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ return job;
+
+ }
+
+
+
}