Project

General

Profile

Download (3.62 KB) Statistics
| Branch: | Tag: | Revision:
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
*/
9

    
10
package eu.etaxonomy.taxeditor.editor.view.descriptive.operation;
11

    
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;
17

    
18
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
19
import eu.etaxonomy.cdm.api.service.IDescriptionService;
20
import eu.etaxonomy.cdm.model.description.TaxonDescription;
21
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
22
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
23
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
24
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
25
import eu.etaxonomy.taxeditor.store.CdmStore;
26

    
27
/**
28
 * <p>MoveDescriptionToOtherTaxonOperation</p>
29
 *
30
 * @author a.kohlbecker
31
 * @created Okt. 11, 2013
32
 */
33
public class MoveDescriptionToOtherTaxonOperation extends
34
		AbstractPersistentPostOperation {
35

    
36
	private final TaxonNode newAcceptedTaxonNode;
37

    
38
	private final TaxonDescription description;
39

    
40
	/**
41
	 * <p>Constructor for ChangeAcceptedTaxonToSynonymOperation.</p>
42
	 *
43
	 * @param label a {@link java.lang.String} object.
44
	 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
45
	 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
46
	 * @param description a {@link TaxonDescription} object.
47
	 * @param targetTaxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
48
	 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
49
	 */
50
	public MoveDescriptionToOtherTaxonOperation(String label,
51
			IUndoContext undoContext,
52
			TaxonDescription description,
53
			TaxonNode targetTaxonNode,
54
			IPostOperationEnabled postOperationEnabled,
55
			IConversationEnabled conversationEnabled,
56
            ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
57
		super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); // FIXME is this the right constructor ???
58
		this.description = description;
59
		this.newAcceptedTaxonNode = targetTaxonNode;
60
	}
61

    
62

    
63
	/* (non-Javadoc)
64
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
65
	 */
66
	/** {@inheritDoc} */
67
	@Override
68
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
69
			throws ExecutionException {
70
		monitor.worked(20);
71
		bind();
72
		CdmStore.getService(IDescriptionService.class).moveTaxonDescription(description.getUuid(), newAcceptedTaxonNode.getTaxon().getUuid());
73
		monitor.worked(40);
74

    
75
		return postExecute(description);
76
	}
77

    
78
	/* (non-Javadoc)
79
	 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
80
	 */
81
	/** {@inheritDoc} */
82
	@Override
83
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
84
			throws ExecutionException {
85
		// TODO Auto-generated method stub
86
		return null;
87
	}
88

    
89
	/* (non-Javadoc)
90
	 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
91
	 */
92
	/** {@inheritDoc} */
93
	@Override
94
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
95
			throws ExecutionException {
96
		// TODO Auto-generated method stub
97
		return null;
98
	}
99
}
(11-11/11)