Merge branch 'develop' into remoting-4.0
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / navigator / operation / RemotingMoveFactualDataOperation.java
1 // $Id$
2 /**
3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10 package eu.etaxonomy.taxeditor.navigation.navigator.operation;
11
12 import java.util.UUID;
13
14 import org.eclipse.core.runtime.IAdaptable;
15 import org.eclipse.core.runtime.IProgressMonitor;
16
17 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
18 import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
19 import eu.etaxonomy.cdm.api.service.IDescriptionService;
20 import eu.etaxonomy.cdm.api.service.UpdateResult;
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 = "Move Factual Data operation";
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 }