Cleanup DeleteOperation
authorAndreas Müller <a.mueller@bgbm.org>
Fri, 9 Oct 2015 13:41:09 +0000 (15:41 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Fri, 9 Oct 2015 13:41:09 +0000 (15:41 +0200)
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java

index cd0fbef49e3ea40493493963de799a531c2337fe..ee5880e967155116444bdb8576206b8a53d54612 100644 (file)
@@ -105,33 +105,33 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
                monitor.worked(20);
                ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
                ITaxonNodeService service = controller.getTaxonNodeService();
-                       if(taxonNode != null && taxonNode instanceof TaxonNode){
-                               //((TaxonNode) treeNode).delete();
-
-                               element = ((TaxonNode)taxonNode).getTaxon();
-
-                               DeleteResult result = service.deleteTaxonNode((TaxonNode)taxonNode, config);
-                               if (result.isError() && !result.getExceptions().isEmpty()){
-
-                                       DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
-                               } else if (!result.getExceptions().isEmpty()){
-                                       String separator = ", ";
-                                   String exceptionString = "";
-                                   for (Exception exception : result.getExceptions()) {
-                                   exceptionString += exception.getLocalizedMessage()+separator;
-                               }
-                                   DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode was successfully deleted, but related object(s) could not be deleted", TaxeditorNavigationPlugin.PLUGIN_ID);
-                               }
+               if(taxonNode != null && taxonNode instanceof TaxonNode){
+                       //((TaxonNode) treeNode).delete();
+
+                       element = ((TaxonNode)taxonNode).getTaxon();
+
+                       DeleteResult result = service.deleteTaxonNode((TaxonNode)taxonNode, config);
+                       if (result.isError() && !result.getExceptions().isEmpty()){
+
+                               DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
+                       } else if (!result.getExceptions().isEmpty()){
+                               String separator = ", ";
+                           String exceptionString = "";
+                           for (Exception exception : result.getExceptions()) {
+                           exceptionString += exception.getLocalizedMessage()+separator;
+                       }
+                           DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode was successfully deleted, but related object(s) could not be deleted", TaxeditorNavigationPlugin.PLUGIN_ID);
+                       }
 
 
-                       }else if(taxonNode != null && taxonNode instanceof Classification){
-                               Classification taxonomicTree = (Classification) taxonNode;
+               }else if(taxonNode != null && taxonNode instanceof Classification){
+                       Classification taxonomicTree = (Classification) taxonNode;
 
-                               DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree.getUuid());
-                if (result.isError() && !result.getExceptions().isEmpty()){
-                    //TODO:Error message!
-                    DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
-                }
+                       DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree.getUuid());
+            if (result.isError() && !result.getExceptions().isEmpty()){
+                //TODO:Error message!
+                DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
+            }
         } else {
             Set<UUID> treeNodeUuids = new HashSet<UUID>();
             ITaxonTreeNode entity = null;