Revision 0caafa75
Added by Andreas Müller over 1 year ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/RefreshNodesOperation.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
1 | 9 |
package eu.etaxonomy.taxeditor.navigation.key.polytomous.operation; |
2 | 10 |
|
3 | 11 |
import java.util.UUID; |
... | ... | |
10 | 18 |
|
11 | 19 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
12 | 20 |
import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService; |
13 |
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService; |
|
14 |
import eu.etaxonomy.cdm.api.service.ITermService; |
|
15 | 21 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
16 | 22 |
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; |
17 | 23 |
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; |
... | ... | |
21 | 27 |
/** |
22 | 28 |
* Operation responsible for refreshing key nodes node numbers of the Polytomous Keys. |
23 | 29 |
* The refresh is performed on all keys/ |
24 |
*
|
|
30 |
* |
|
25 | 31 |
* @author c.mathew |
26 | 32 |
* @created Jan 17 2013 |
27 |
* @version 1.0 |
|
28 |
* |
|
29 | 33 |
*/ |
30 | 34 |
public class RefreshNodesOperation extends AbstractPostTaxonOperation { |
31 | 35 |
|
32 |
PolytomousKey key;
|
|
33 |
|
|
36 |
private PolytomousKey key;
|
|
37 |
|
|
34 | 38 |
public RefreshNodesOperation(String label, |
35 |
IUndoContext undoContext,
|
|
36 |
PolytomousKey key,
|
|
39 |
IUndoContext undoContext, |
|
40 |
PolytomousKey key, |
|
37 | 41 |
IPostOperationEnabled postOperationEnabled) { |
38 | 42 |
super(label, undoContext, postOperationEnabled); |
39 | 43 |
this.key = key; |
40 | 44 |
} |
41 |
|
|
42 |
/* (non-Javadoc) |
|
43 |
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
44 |
*/ |
|
45 |
|
|
45 | 46 |
@Override |
46 | 47 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
47 | 48 |
throws ExecutionException { |
48 | 49 |
UUID polytomousKeyNodeUuid = key.getRoot().getUuid(); |
49 | 50 |
ConversationHolder conversation = CdmStore.createConversation(); |
50 | 51 |
PolytomousKeyNode root = CdmStore.getService(IPolytomousKeyNodeService.class).load(polytomousKeyNodeUuid, null); |
51 |
root.refreshNodeNumbering();
|
|
52 |
root.refreshNodeNumbering(); |
|
52 | 53 |
CdmStore.getService(IPolytomousKeyNodeService.class).saveOrUpdate(root); |
53 | 54 |
conversation.commit(true); |
54 | 55 |
return postExecute(root); |
55 | 56 |
} |
56 | 57 |
|
57 |
/* (non-Javadoc) |
|
58 |
* @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
59 |
*/ |
|
60 | 58 |
@Override |
61 | 59 |
public IStatus redo(IProgressMonitor monitor, IAdaptable info) |
62 | 60 |
throws ExecutionException { |
... | ... | |
64 | 62 |
return null; |
65 | 63 |
} |
66 | 64 |
|
67 |
/* (non-Javadoc) |
|
68 |
* @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
69 |
*/ |
|
70 | 65 |
@Override |
71 | 66 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
72 | 67 |
throws ExecutionException { |
73 | 68 |
// TODO Auto-generated method stub |
74 | 69 |
return null; |
75 | 70 |
} |
76 |
|
|
77 |
} |
|
71 |
} |
Also available in: Unified diff
ref #10186 further remove ConversationHolder and cleanup