#5009 Fix post polytomous key delete operation event handling
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / key / polytomous / operation / RemotingDeletePolytomousKeyOperation.java
1 // $Id$
2 /**
3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.navigation.key.polytomous.operation;
11
12 import java.util.List;
13 import java.util.UUID;
14
15 import org.eclipse.core.runtime.IAdaptable;
16 import org.eclipse.core.runtime.IProgressMonitor;
17
18 import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
19 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
20 import eu.etaxonomy.cdm.api.service.UpdateResult;
21 import eu.etaxonomy.cdm.model.description.PolytomousKey;
22 import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
23 import eu.etaxonomy.taxeditor.store.CdmStore;
24
25 /**
26 * @author cmathew
27 * @date 25 Jun 2015
28 *
29 */
30 public class RemotingDeletePolytomousKeyOperation extends RemotingCdmUpdateOperation {
31
32 private final static String LABEL = "Delete Polytomous Key operation";
33
34 private final List<UUID> keysToDelete;
35 /**
36 * @param label
37 * @param action
38 * @param source
39 * @param async
40 */
41 public RemotingDeletePolytomousKeyOperation(Object source,
42 boolean async,
43 List<UUID> keysToDelete) {
44 super(LABEL, Action.Delete, source, async);
45 this.keysToDelete = keysToDelete;
46 }
47
48 /* (non-Javadoc)
49 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
50 */
51 @Override
52 protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
53 entityType = PolytomousKey.class;
54 return CdmStore.getService(IPolytomousKeyService.class).delete(keysToDelete);
55 }
56
57 }