Project

General

Profile

Revision f5ae4e08

IDf5ae4e08e7c0147b4909f38cad2266d0c339e8bf
Parent 3271c92d
Child 159bb3e7

Added by Katja Luther over 3 years ago

ref #6480: add deleteConfigurator to bulk editor delete of specimenOrObservation base

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
32 32
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
33 33
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
34 34
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
35
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
35 36
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
36 37
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
37 38
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
......
51 52
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
52 53
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
53 54
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
55
import eu.etaxonomy.taxeditor.bulkeditor.l10n.Messages;
54 56
import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
55 57
import eu.etaxonomy.taxeditor.model.MessagingUtils;
56 58
import eu.etaxonomy.taxeditor.store.CdmStore;
......
107 109
        				    controller = CdmStore.getCurrentApplicationConfiguration();
108 110
        				    if (object instanceof SpecimenOrObservationBase){
109 111
        				        IOccurrenceService service = controller.getOccurrenceService();
112
        				        config = new SpecimenDeleteConfigurator();
113

  
114
                                DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), CONFIRM_DELETION,  null,  Messages.BulkEditor_DeleteHandler_reallyDeleteSpecimen, MessageDialog.WARNING, new String[] { DELETE, SKIP }, 0, true);
115
                                int result_dialog= dialog.open();
116
                                if (result_dialog != Status.OK){
117
                                    return null;
118
                                }
110 119
        						if (object != null){
111
        							result = service.isDeletable(((SpecimenOrObservationBase) object).getUuid(), null);
120
        							result = service.isDeletable(((SpecimenOrObservationBase) object).getUuid(), config);
112 121
        							errorMessage = "The specimen or observation ";
113 122

  
114 123
        						}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java
13 13
import java.util.List;
14 14
import java.util.UUID;
15 15

  
16
import eu.etaxonomy.cdm.api.service.DeleteResult;
16 17
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
17 18
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
18 19
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
20
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
19 21
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
20 22
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
21 23
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
22
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
23 24
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
24 25
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
25 26
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.OccurrenceCreator;
......
111 112
	 * @throws ReferencedObjectUndeletableException */
112 113
	@Override
113 114
    public boolean delete(SpecimenOrObservationBase entity, DeleteConfiguratorBase config ) throws ReferencedObjectUndeletableException {
114
		return CdmStore.getService(IOccurrenceService.class).delete(entity) != null;
115
	    DeleteResult deleteResult;
116
	    SpecimenDeleteConfigurator specimenConfig;
117
	    if (config instanceof SpecimenDeleteConfigurator){
118
	        specimenConfig = (SpecimenDeleteConfigurator)config;
119
	    }else{
120
	        specimenConfig = new SpecimenDeleteConfigurator();
121
	    }
122
	    deleteResult = CdmStore.getService(IOccurrenceService.class).delete(entity.getUuid(), specimenConfig);
123

  
124
		return deleteResult.isOk();
115 125
	}
116 126

  
117 127
	/** {@inheritDoc} */
118 128
	@Override
119 129
    public SpecimenOrObservationBase<?> save(SpecimenOrObservationBase entity) {
120 130
	    return CdmStore.getService(IOccurrenceService.class).merge(entity, true).getMergedEntity();
121
	   
131

  
122 132
	}
123 133

  
124 134
	@Override
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/Messages.java
18 18
public class Messages extends NLS {
19 19
    private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.bulkeditor.l10n.messages"; //$NON-NLS-1$
20 20
    public static String ReferencingObjectsLabelProvider_No_description_available;
21
    public static String ConvertPerson2TeamHandler_warning;
22
    public static String ConvertPerson2TeamHandler_lable;
23
    public static String BulkEditor_DeleteHandler_reallyDeleteSpecimen;
21 24
    static {
22 25
        // initialize resource bundle
23 26
        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/messages.properties
1 1
ReferencingObjectsLabelProvider_No_description_available=No description available
2
ConvertPerson2TeamHandler_warning=While reloading the data an exception occured
3
ConvertPerson2TeamHandler_lable=Convert Person to Team
4
BulkEditor_DeleteHandler_reallyDeleteSpecimen=Do you really want to delete the specimen/field unit? This is irreversible.
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/l10n/messages_de.properties
1
ReferencingObjectsLabelProvider_No_description_available=Keine Beschreibung verf?gbar
1
ReferencingObjectsLabelProvider_No_description_available=Keine Beschreibung verf?gbar
2
ConvertPerson2TeamHandler_warning=Beim Neuladen der Daten ist ein Fehler aufgetreten
3
ConvertPerson2TeamHandler_lable=Wandle Person in Team um
4
BulkEditor_DeleteHandler_reallyDeleteSpecimen=M?chten Sie das Specimen/die FieldUnit wirklich l?schen, dieser Vorgang kann nicht r?ckg?ngig gemacht werden.

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)