1 package eu
.etaxonomy
.taxeditor
.editor
.name
.e4
.operation
;
3 import java
.util
.ArrayList
;
7 import org
.eclipse
.core
.commands
.ExecutionException
;
8 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
9 import org
.eclipse
.core
.runtime
.IAdaptable
;
10 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
11 import org
.eclipse
.core
.runtime
.IStatus
;
13 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
14 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
15 import eu
.etaxonomy
.cdm
.api
.service
.UpdateResult
;
16 import eu
.etaxonomy
.cdm
.api
.service
.exception
.HomotypicalGroupChangeException
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
19 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
20 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
21 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
23 public class MoveSynonymToAnotherAcceptedTaxonOperationE4
extends
24 AbstractPostTaxonOperation
{
27 * The synonym to be moved.
29 private final Synonym synonym
;
30 private IConversationEnabled conversationEnabled
;
32 public MoveSynonymToAnotherAcceptedTaxonOperationE4(String label
, IUndoContext undoContext
, UUID synonymUUID
,
33 Taxon taxon
, IPostOperationEnabled postOperationEnabled
, IConversationEnabled conversationEnabled
) {
35 super(label
, undoContext
, taxon
, postOperationEnabled
);
36 List
<String
> propertyPaths
= new ArrayList
<String
>();
37 propertyPaths
.add("synonymRelations"); //$NON-NLS-1$
38 this.conversationEnabled
= conversationEnabled
;
39 this.element
= (Taxon
) CdmStore
.getService(ITaxonService
.class).load(taxon
.getUuid(),propertyPaths
);
40 this.synonym
= (Synonym
) CdmStore
.getService(ITaxonService
.class).load(synonymUUID
);
42 throw new IllegalArgumentException(
43 "A null synonym was provided."); //$NON-NLS-1$
48 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
49 throws ExecutionException
{
57 conversationEnabled
.getConversationHolder().commit();
60 UpdateResult result
= CdmStore
.getService(ITaxonService
.class).moveSynonymToAnotherTaxon(synonym
,
61 this.element
.getUuid(),
67 } catch (HomotypicalGroupChangeException e
) {
68 // TODO Auto-generated catch block
71 conversationEnabled
.getConversationHolder().commit();
73 // Redraw editor if it exists
74 return postExecute(null);
78 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
79 throws ExecutionException
{
84 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
85 throws ExecutionException
{