Revision a1ab28ed
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetPublishForSubtreeOperation.java | ||
---|---|---|
18 | 18 |
import org.eclipse.core.runtime.IStatus; |
19 | 19 |
import org.eclipse.core.runtime.Status; |
20 | 20 |
import org.eclipse.core.runtime.jobs.Job; |
21 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
22 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
23 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
21 | 24 |
import org.eclipse.swt.widgets.Display; |
22 | 25 |
import org.eclipse.ui.progress.IProgressConstants; |
23 | 26 |
|
... | ... | |
26 | 29 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; |
27 | 30 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
28 | 31 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
32 |
import eu.etaxonomy.cdm.api.service.config.ForSubtreeConfiguratorBase; |
|
29 | 33 |
import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator; |
30 | 34 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
31 | 35 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; |
... | ... | |
35 | 39 |
* @date 11.10.2017 |
36 | 40 |
* |
37 | 41 |
*/ |
38 |
public class SetPublishForSubtreeOperation extends RemotingCdmUpdateOperation {
|
|
42 |
public class SetPublishForSubtreeOperation extends UpdateSubtreeOperation {
|
|
39 | 43 |
|
40 | 44 |
private final static String LABEL = Messages.SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP; |
41 | 45 |
private static final Logger logger = Logger |
42 | 46 |
.getLogger(SetPublishForSubtreeOperation.class); |
43 |
UUID parentUuid; |
|
44 |
PublishForSubtreeConfigurator config; |
|
47 |
|
|
45 | 48 |
|
46 | 49 |
/** |
47 | 50 |
* @param label |
... | ... | |
52 | 55 |
public SetPublishForSubtreeOperation(Object source, |
53 | 56 |
boolean async, |
54 | 57 |
UUID taxonNodeUuid, |
58 |
EPartService partService, |
|
59 |
MPart activePart, |
|
60 |
MApplication application, |
|
55 | 61 |
PublishForSubtreeConfigurator config) { |
56 |
super(LABEL, Action.Update, source, async); |
|
57 |
parentUuid = taxonNodeUuid; |
|
58 |
this.config = config; |
|
59 |
this.updateResult = new UpdateResult(); |
|
62 |
super(source, async, taxonNodeUuid, partService, activePart, application, config, LABEL); |
|
63 |
|
|
60 | 64 |
} |
61 |
|
|
62 |
|
|
63 |
// /* (non-Javadoc) |
|
64 |
// * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
65 |
// */ |
|
66 |
// @Override |
|
67 |
// protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { |
|
68 |
// ITaxonNodeService taxonService = CdmApplicationState.getService(ITaxonNodeService.class); |
|
69 |
//// taxonService.setSecundumForSubtree(config.getSubtreeUuid(), config.getNewSecundum(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isOverwriteExistingAccepted(), config.isOverwriteExistingSynonyms(), config.isIncludeSharedTaxa(), config.isEmptySecundumDetail(), null); |
|
70 |
// eu.etaxonomy.cdm.common.monitor.IProgressMonitor cdmMonitor = CdmProgressMonitorAdapter.CreateMonitor(monitor); |
|
71 |
// updateResult = taxonService.setPublishForSubtree(config.getSubtreeUuid(), config.isPublish(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isIncludeSharedTaxa(), null); |
|
72 |
// return updateResult; |
|
73 |
// } |
|
74 |
|
|
75 |
@Override |
|
65 |
@Override |
|
76 | 66 |
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { |
77 | 67 |
// runMoniteredOperation(); |
78 | 68 |
|
... | ... | |
94 | 84 |
|
95 | 85 |
final Display display = Display.getDefault(); |
96 | 86 |
|
97 |
Job job = new Job(Messages.SetSecundumForSubtreeOperation_SET_SEC_TASK) {
|
|
87 |
Job job = new Job(Messages.SetPublishFlagForSubtreeOperation_SET_SEC_TASK) {
|
|
98 | 88 |
|
99 | 89 |
|
100 | 90 |
@Override |
... | ... | |
102 | 92 |
|
103 | 93 |
try { |
104 | 94 |
ITaxonNodeService taxonService = CdmApplicationState.getService(ITaxonNodeService.class); |
105 |
updateResult = taxonService.setPublishForSubtree(config.getSubtreeUuid(), config.isPublish(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isIncludeSharedTaxa(), null); |
|
106 |
|
|
95 |
|
|
96 |
if (config instanceof PublishForSubtreeConfigurator){ |
|
97 |
updateResult = taxonService.setPublishForSubtree(config.getSubtreeUuid(), ((PublishForSubtreeConfigurator)config).isPublish(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isIncludeSharedTaxa(), null); |
|
98 |
}else { |
|
99 |
return Status.CANCEL_STATUS; |
|
100 |
} |
|
101 |
updateNameEditors(); |
|
107 | 102 |
} catch (CdmApplicationException e) { |
108 | 103 |
// TODO Auto-generated catch block |
109 | 104 |
e.printStackTrace(); |
Also available in: Unified diff
fix #7065: update the nameEditors also after update publish flag