fix the deletion of SpecimenOrObservationBase objects in bulk editor
authorKatja Luther <k.luther@bgbm.org>
Fri, 8 Nov 2013 13:18:18 +0000 (13:18 +0000)
committerKatja Luther <k.luther@bgbm.org>
Fri, 8 Nov 2013 13:18:18 +0000 (13:18 +0000)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java

index 3ba11e54d3fc3b85430903f69d198fb35009ed9d..d1c0c644594b63d74ce2a45c15ac085c0345b1e5 100644 (file)
@@ -20,6 +20,11 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationController;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
@@ -27,6 +32,7 @@ import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
  * @author n.hoffmann
@@ -65,7 +71,16 @@ public class DeleteHandler extends AbstractHandler {
                                        LineAnnotation annotation = (LineAnnotation) model.getAnnotation(object);
                                                        
                                        try {
-                                               persistenceService.delete(object);
+                                               //persistenceService.delete(object);
+                                               if (object instanceof SpecimenOrObservationBase){
+                                                       CdmApplicationController controller;
+                                                       
+                                                       controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration();
+                                                       
+                                                       IOccurrenceService service = controller.getOccurrenceService();
+                                                       service.delete((SpecimenOrObservationBase)object);
+                                               }
+                                               
                                        } catch (Exception e){
                                                BulkEditorUtil.errorDialog("Could not delete", getClass(), e.getMessage(), null);
                                        }