From 5e15e0e34c901075ce11f4b9f35671bebd4ae275 Mon Sep 17 00:00:00 2001 From: Katja Luther Date: Tue, 15 Mar 2016 13:47:39 +0100 Subject: [PATCH] add delete to media bulk editor --- .../bulkeditor/handler/DeleteHandler.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java index 08d0355e8..6936095c4 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java @@ -28,6 +28,7 @@ import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; import eu.etaxonomy.cdm.api.service.DeleteResult; import eu.etaxonomy.cdm.api.service.IAgentService; import eu.etaxonomy.cdm.api.service.IGroupService; +import eu.etaxonomy.cdm.api.service.IMediaService; import eu.etaxonomy.cdm.api.service.INameService; import eu.etaxonomy.cdm.api.service.IOccurrenceService; import eu.etaxonomy.cdm.api.service.IReferenceService; @@ -39,6 +40,7 @@ import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.cdm.model.common.User; +import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.model.reference.Reference; @@ -54,7 +56,6 @@ import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog; -import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteTaxonConfiguratorComposite; /** @@ -128,8 +129,8 @@ public class DeleteHandler extends AbstractHandler { INameService service = controller.getNameService(); if (object != null){ NameDeletionConfigurator config = new NameDeletionConfigurator(); - - DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the name", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); + + DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the name", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); int result_dialog= dialog.open(); if (result_dialog == 1){ return null; @@ -143,7 +144,7 @@ public class DeleteHandler extends AbstractHandler { if (object instanceof Taxon){ TaxonDeletionConfigurator config = new TaxonDeletionConfigurator(); config.setDeleteInAllClassifications(true); - DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the taxon", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); + DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the taxon", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0); int result_dialog= dialog.open(); if (result_dialog == 1){ return null; @@ -152,7 +153,7 @@ public class DeleteHandler extends AbstractHandler { errorMessage = "The taxon "; }else{ SynonymDeletionConfigurator config = new SynonymDeletionConfigurator(); - + result = service.deleteSynonym(((Synonym)object).getUuid(), config); errorMessage = "The synonym "; } @@ -162,7 +163,13 @@ public class DeleteHandler extends AbstractHandler { //TeamOrPersonBase teamOrPerson = (TeamOrPersonBase)service.load(((TeamOrPersonBase) object).getUuid()); result = service.delete(((TeamOrPersonBase)object).getUuid()); errorMessage = "The team or person "; - } + } else if (object instanceof Media){ + IMediaService service = controller.getMediaService(); + //TeamOrPersonBase teamOrPerson = (TeamOrPersonBase)service.load(((TeamOrPersonBase) object).getUuid()); + result = service.delete(((Media)object).getUuid()); + errorMessage = "The media "; + } + } catch (Exception e){ MessagingUtils.errorDialog("Exception occured. Delete not possible", getClass(), e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID, null, true); } -- 2.34.1