3 * Copyright (C) 2007 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.
11 package eu
.etaxonomy
.taxeditor
.navigation
.operation
;
13 import org
.eclipse
.core
.commands
.ExecutionException
;
14 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
15 import org
.eclipse
.core
.runtime
.IAdaptable
;
16 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
17 import org
.eclipse
.core
.runtime
.IStatus
;
19 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
20 import eu
.etaxonomy
.cdm
.api
.service
.IClassificationService
;
21 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
22 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
24 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPersistentPostOperation
;
25 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
26 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
27 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 * <p>SaveClassificationOperation class.</p>
36 @Deprecated // we do not undo creation of elements
37 public class CreateClassification
extends AbstractPersistentPostOperation
{
39 private final Classification classification
;
42 * <p>Constructor for SaveClassificationOperation.</p>
44 * @param label a {@link java.lang.String} object.
45 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
46 * @param classification a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
47 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
48 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
50 public CreateClassification(String label
, IUndoContext undoContext
, Classification classification
,
51 IPostOperationEnabled postOperationEnabled
,
52 IConversationEnabled conversationEnabled
,
53 ICdmEntitySessionEnabled cdmEntitiySessionEnabled
) {
54 super(label
, undoContext
, postOperationEnabled
, conversationEnabled
, cdmEntitiySessionEnabled
);
56 this.classification
= classification
;
62 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
63 throws ExecutionException
{
67 if(classification
.getReference() == null){
68 Reference reference
= ReferenceFactory
.newGeneric();
69 reference
.setTitle(classification
.getTitleCache());
70 classification
.setReference(reference
);
73 CdmStore
.getService(IClassificationService
.class).saveOrUpdate(classification
);
77 return postExecute(classification
);
82 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
83 throws ExecutionException
{
89 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
90 throws ExecutionException
{