ref #6315: implement set secundum reference for subtree in editor
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / navigator / operation / SetSecundumForSubtreeOperation.java
1 /**
2 * Copyright (C) 2017 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.ITaxonNodeService;
19 import eu.etaxonomy.cdm.api.service.UpdateResult;
20 import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator;
21 import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
22
23 /**
24 * @author k.luther
25 * @date 10.02.2017
26 *
27 */
28 public class SetSecundumForSubtreeOperation extends RemotingCdmUpdateOperation{
29
30 private final static String LABEL = "Change secundum reference for all children";
31
32 UUID parentUuid;
33 SetSecundumForSubtreeConfigurator config;
34
35 /**
36 * @param label
37 * @param action
38 * @param source
39 * @param async
40 */
41 public SetSecundumForSubtreeOperation(Object source,
42 boolean async,
43 UUID taxonNodeUuid,
44 SetSecundumForSubtreeConfigurator config) {
45 super(LABEL, Action.Update, source, async);
46 parentUuid = taxonNodeUuid;
47 this.config = config;
48 }
49
50 /**
51 * {@inheritDoc}
52 */
53 @Override
54 protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
55 monitor.beginTask("Set secundum reference for subtree", 10);
56 UpdateResult result = CdmApplicationState.getService(ITaxonNodeService.class).setSecundumForSubtree(config, null);
57 monitor.done();
58 return result;
59 }
60
61 }