Merge branch 'release/4.6.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / navigator / operation / RemotingMoveFactualDataOperation.java
1 /**
2 * Copyright (C) 2015 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 package eu.etaxonomy.taxeditor.navigation.navigator.operation;
10
11 import java.util.UUID;
12
13 import org.eclipse.core.runtime.IAdaptable;
14 import org.eclipse.core.runtime.IProgressMonitor;
15
16 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
17 import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
18 import eu.etaxonomy.cdm.api.service.IDescriptionService;
19 import eu.etaxonomy.cdm.api.service.UpdateResult;
20 import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
21 import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
22
23 /**
24 * @author cmathew
25 * @date 19 Jun 2015
26 *
27 */
28 public class RemotingMoveFactualDataOperation extends RemotingCdmUpdateOperation {
29
30 private final static String LABEL = Messages.RemotingMoveFactualDataOperation_MOVE_OP;
31
32 private final UUID sourceTaxonUuid;
33 private final UUID targetParentTaxonUuid;
34
35 /**
36 * @param label
37 * @param action
38 * @param source
39 * @param async
40 */
41 public RemotingMoveFactualDataOperation(Object source,
42 boolean async,
43 UUID sourceTaxonUuid,
44 UUID targetParentTaxonUuid) {
45 super(LABEL, Action.Update, source, async);
46 this.sourceTaxonUuid = sourceTaxonUuid;
47 this.targetParentTaxonUuid = targetParentTaxonUuid;
48 }
49
50 /* (non-Javadoc)
51 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
52 */
53 @Override
54 protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
55 return CdmApplicationState.getService(IDescriptionService.class).moveTaxonDescriptions(sourceTaxonUuid,
56 targetParentTaxonUuid);
57 }
58
59 }