changes in misapplicationDeletionOperation
authorKatja Luther <k.luther@bgbm.org>
Wed, 8 Feb 2017 10:59:39 +0000 (11:59 +0100)
committerKatja Luther <k.luther@bgbm.org>
Wed, 8 Feb 2017 10:59:39 +0000 (11:59 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java
eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperationTest.java

index caee71329e442155242346cad09b97ff8013e4fc..75fc960d13a65f4031b23f4104d2a63df3f56430 100644 (file)
@@ -14,16 +14,19 @@ import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.ui.IWorkbenchPage;
 
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
@@ -32,7 +35,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @author p.ciardelli
  * @created 16.01.2009
  */
-public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
+public class DeleteMisapplicationOperation extends DeleteTaxonBaseOperation {
 
        private final Taxon misapplication;
 
@@ -49,11 +52,12 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
         * @param misapplication a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
         * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
         */
-       public DeleteMisapplicationOperation(String label, IUndoContext undoContext,
-                       Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled) {
-               super(label, undoContext, taxon, postOperationEnabled);
-
+       public DeleteMisapplicationOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,IWorkbenchPage activePage,
+            Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+               //super(label, undoContext, taxon, postOperationEnabled);
+           super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
                this.misapplication = misapplication;
+               this.element = taxon;
        }
 
        /* (non-Javadoc)
@@ -86,7 +90,7 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
                NameDeletionConfigurator nameConfig = new NameDeletionConfigurator();
                nameConfig.setRemoveAllNameRelationships(true);
                config.setNameDeletionConfig(nameConfig);
-               service.deleteTaxon(misapplication.getUuid(), config, null);
+               result = service.deleteTaxon(misapplication.getUuid(), config, null);
                monitor.worked(40);
 
                return postExecute(null);
@@ -106,6 +110,7 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
 
                element.addMisappliedName(misapplication, citation, microcitation);
 
+
                return postExecute(misapplication);
        }
 }
index 1a39274dc3d99660c422bca9927b8bafdbd0a8e4..4f57c79b53899fa30439b3227479a2f266a0e1c7 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -17,7 +17,6 @@ import org.junit.Test;
 
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation;
 import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
 
 /**
@@ -32,51 +31,52 @@ public class DeleteMisapplicationOperationTest extends AbstractTaxeditorOperatio
        private static Taxon taxon;
 
        private static Taxon misapplication;
-       
+
        /**
         * @throws java.lang.Exception
         */
        @BeforeClass
        public static void setUpBeforeClass() throws Exception {
-               
+
                taxon = Taxon.NewInstance(null, null);
                misapplication = Taxon.NewInstance(null, null);
-               
+
                taxon.addMisappliedName(misapplication, null, null);
-               
-               operation = new DeleteMisapplicationOperation("", undoContext, taxon, misapplication, postOperation);
+
+               operation = new DeleteMisapplicationOperation("", undoContext, null, null, taxon, misapplication, postOperation,  null, null);
+
        }
 
        /**
         * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
-        * @throws ExecutionException 
+        * @throws ExecutionException
         */
        @Test
        public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
                operation.execute(monitor, info);
-               
+
                Assert.assertTrue(taxon.getMisappliedNames().size() == 0);
        }
 
        /**
         * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
-        * @throws ExecutionException 
+        * @throws ExecutionException
         */
        @Test
        public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
                operation.undo(monitor, info);
-               
+
                Assert.assertEquals(misapplication, taxon.getMisappliedNames().toArray(new Taxon[0])[0]);
        }
 
        /**
         * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
-        * @throws ExecutionException 
+        * @throws ExecutionException
         */
        @Test
        public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
                operation.redo(monitor, info);
-               
+
                Assert.assertTrue(taxon.getMisappliedNames().size() == 0);
        }