Revision 91a8d98c
Added by Cherian Mathew over 8 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RemotingPolytomousKeyDeleteOperation.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.operation; |
11 | 11 |
|
12 | 12 |
import java.util.List; |
13 |
import java.util.UUID; |
|
13 | 14 |
|
14 | 15 |
import org.eclipse.core.runtime.IAdaptable; |
15 | 16 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
17 | 18 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; |
18 | 19 |
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService; |
19 | 20 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
20 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
|
21 | 21 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; |
22 | 22 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
23 | 23 |
|
... | ... | |
30 | 30 |
|
31 | 31 |
private final static String LABEL = "Delete Polytomous Key operation"; |
32 | 32 |
|
33 |
private final List<PolytomousKey> keysToDelete;
|
|
33 |
private final List<UUID> keysToDelete;
|
|
34 | 34 |
/** |
35 | 35 |
* @param label |
36 | 36 |
* @param action |
... | ... | |
39 | 39 |
*/ |
40 | 40 |
public RemotingPolytomousKeyDeleteOperation(Object source, |
41 | 41 |
boolean async, |
42 |
List<PolytomousKey> keysToDelete) {
|
|
42 |
List<UUID> keysToDelete) {
|
|
43 | 43 |
super(LABEL, Action.Delete, source, async); |
44 | 44 |
this.keysToDelete = keysToDelete; |
45 | 45 |
} |
... | ... | |
49 | 49 |
*/ |
50 | 50 |
@Override |
51 | 51 |
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { |
52 |
UpdateResult result = new UpdateResult(); |
|
53 |
for(PolytomousKey key : keysToDelete) { |
|
54 |
UpdateResult updateResult = CdmStore.getService(IPolytomousKeyService.class).delete(key.getUuid()); |
|
55 |
if(updateResult.isAbort()) { |
|
56 |
result.setStatus(updateResult.getStatus()); |
|
57 |
result.addExceptions(updateResult.getExceptions()); |
|
58 |
return result; |
|
59 |
} |
|
60 |
if(updateResult.isError()) { |
|
61 |
result.setStatus(updateResult.getStatus()); |
|
62 |
result.addExceptions(updateResult.getExceptions()); |
|
63 |
} |
|
64 |
} |
|
65 |
return result; |
|
52 |
return CdmStore.getService(IPolytomousKeyService.class).delete(keysToDelete); |
|
66 | 53 |
} |
67 | 54 |
|
68 | 55 |
} |
Also available in: Unified diff
#5009 Add operations and corresponding tests for delete / update nodes actions
#5009 : missed in last commit