3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.navigation
.operation
;
12 import org
.eclipse
.core
.commands
.ExecutionException
;
13 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
14 import org
.eclipse
.core
.runtime
.IAdaptable
;
15 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
16 import org
.eclipse
.core
.runtime
.IStatus
;
18 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
19 import eu
.etaxonomy
.cdm
.api
.service
.IClassificationService
;
20 import eu
.etaxonomy
.cdm
.api
.service
.UpdateResult
;
21 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
24 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPersistentPostOperation
;
25 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
26 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
33 public class CloneClassificationOperation
extends AbstractPersistentPostOperation
{
35 private final Classification classification
;
37 private final IClassificationService service
;
39 private String classificationName
;
41 private Reference sec
;
43 private TaxonRelationshipType relationType
;
45 public CloneClassificationOperation(String label
, IUndoContext undoContext
, Classification classification
,
46 String classificationName
, Reference sec
, TaxonRelationshipType relationType
,
47 IPostOperationEnabled postOperationEnabled
,
48 IConversationEnabled conversationEnabled
) {
49 super(label
, undoContext
, postOperationEnabled
, conversationEnabled
);
51 this.classification
= classification
;
52 this.classificationName
= classificationName
;
54 this.relationType
= relationType
;
55 this.service
= CdmStore
.getService(IClassificationService
.class);
60 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
) throws ExecutionException
{
62 UpdateResult result
= service
.cloneClassification(classification
.getUuid(), classificationName
, sec
, relationType
);
63 return postExecute(result
.getCdmEntity());
67 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
) throws ExecutionException
{
72 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
) throws ExecutionException
{