Project

General

Profile

« Previous | Next » 

Revision 5e15e0e3

Added by Katja Luther about 8 years ago

add delete to media bulk editor

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
28 28
import eu.etaxonomy.cdm.api.service.DeleteResult;
29 29
import eu.etaxonomy.cdm.api.service.IAgentService;
30 30
import eu.etaxonomy.cdm.api.service.IGroupService;
31
import eu.etaxonomy.cdm.api.service.IMediaService;
31 32
import eu.etaxonomy.cdm.api.service.INameService;
32 33
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
33 34
import eu.etaxonomy.cdm.api.service.IReferenceService;
......
39 40
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
40 41
import eu.etaxonomy.cdm.model.common.Group;
41 42
import eu.etaxonomy.cdm.model.common.User;
43
import eu.etaxonomy.cdm.model.media.Media;
42 44
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
43 45
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
44 46
import eu.etaxonomy.cdm.model.reference.Reference;
......
54 56
import eu.etaxonomy.taxeditor.model.MessagingUtils;
55 57
import eu.etaxonomy.taxeditor.store.CdmStore;
56 58
import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog;
57
import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteTaxonConfiguratorComposite;
58 59

  
59 60

  
60 61
/**
......
128 129
						INameService service = controller.getNameService();
129 130
						if (object != null){
130 131
							NameDeletionConfigurator config = new NameDeletionConfigurator();
131
							
132
							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); 
132

  
133
							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);
133 134
							int result_dialog= dialog.open();
134 135
							if (result_dialog == 1){
135 136
								return null;
......
143 144
							if (object instanceof Taxon){
144 145
								TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
145 146
								config.setDeleteInAllClassifications(true);
146
								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); 
147
								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);
147 148
								int result_dialog= dialog.open();
148 149
								if (result_dialog == 1){
149 150
									return null;
......
152 153
								errorMessage = "The taxon ";
153 154
							}else{
154 155
								SynonymDeletionConfigurator config = new SynonymDeletionConfigurator();
155
								
156

  
156 157
								result = service.deleteSynonym(((Synonym)object).getUuid(), config);
157 158
								errorMessage = "The synonym ";
158 159
							}
......
162 163
						//TeamOrPersonBase teamOrPerson = (TeamOrPersonBase)service.load(((TeamOrPersonBase) object).getUuid());
163 164
						result = service.delete(((TeamOrPersonBase)object).getUuid());
164 165
						errorMessage = "The team or person ";
165
					}
166
					} else if (object instanceof Media){
167
                        IMediaService service = controller.getMediaService();
168
                        //TeamOrPersonBase teamOrPerson = (TeamOrPersonBase)service.load(((TeamOrPersonBase) object).getUuid());
169
                        result = service.delete(((Media)object).getUuid());
170
                        errorMessage = "The media ";
171
                    }
172

  
166 173
				} catch (Exception e){
167 174
					MessagingUtils.errorDialog("Exception occured. Delete not possible", getClass(), e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID, null, true);
168 175
				}

Also available in: Unified diff