Merge branch 'develop' into LibrAlign
[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.operation.RemotingCdmUpdateOperation;
21
22 /**
23 * @author cmathew
24 * @date 19 Jun 2015
25 *
26 */
27 public class RemotingMoveFactualDataOperation extends RemotingCdmUpdateOperation {
28
29 private final static String LABEL = "Move Factual Data operation";
30
31 private final UUID sourceTaxonUuid;
32 private final UUID targetParentTaxonUuid;
33
34 /**
35 * @param label
36 * @param action
37 * @param source
38 * @param async
39 */
40 public RemotingMoveFactualDataOperation(Object source,
41 boolean async,
42 UUID sourceTaxonUuid,
43 UUID targetParentTaxonUuid) {
44 super(LABEL, Action.Update, source, async);
45 this.sourceTaxonUuid = sourceTaxonUuid;
46 this.targetParentTaxonUuid = targetParentTaxonUuid;
47 }
48
49 /* (non-Javadoc)
50 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
51 */
52 @Override
53 protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
54 return CdmApplicationState.getService(IDescriptionService.class).moveTaxonDescriptions(sourceTaxonUuid,
55 targetParentTaxonUuid);
56 }
57
58 }