2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
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
.model
.reference
.Reference
;
21 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
23 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPersistentPostOperation
;
24 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
25 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
26 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 * <p>SaveClassificationOperation class.</p>
35 @Deprecated // we do not undo creation of elements
36 public class CreateClassification
extends AbstractPersistentPostOperation
{
38 private final Classification classification
;
41 * <p>Constructor for SaveClassificationOperation.</p>
43 * @param label a {@link java.lang.String} object.
44 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
45 * @param classification a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
46 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
47 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
49 public CreateClassification(String label
, IUndoContext undoContext
, Classification classification
,
50 IPostOperationEnabled postOperationEnabled
,
51 IConversationEnabled conversationEnabled
,
52 ICdmEntitySessionEnabled cdmEntitiySessionEnabled
) {
53 super(label
, undoContext
, postOperationEnabled
, conversationEnabled
, cdmEntitiySessionEnabled
);
55 this.classification
= classification
;
61 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
62 throws ExecutionException
{
66 if(classification
.getReference() == null){
67 Reference reference
= ReferenceFactory
.newGeneric();
68 reference
.setTitle(classification
.getTitleCache());
69 classification
.setReference(reference
);
72 CdmStore
.getService(IClassificationService
.class).saveOrUpdate(classification
);
76 return postExecute(classification
);
81 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
82 throws ExecutionException
{
88 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
89 throws ExecutionException
{