1
|
/**
|
2
|
* Copyright (C) 2016 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.databaseAdmin.wizard;
|
10
|
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.eclipse.jface.wizard.Wizard;
|
14
|
import org.eclipse.swt.widgets.Display;
|
15
|
|
16
|
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
|
17
|
import eu.etaxonomy.cdm.api.service.config.SortIndexUpdaterConfigurator;
|
18
|
import eu.etaxonomy.cdm.api.service.longrunningService.ILongRunningTasksService;
|
19
|
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
|
20
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
21
|
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
|
22
|
|
23
|
/**
|
24
|
* @author k.luther
|
25
|
* @date 06.12.2016
|
26
|
*/
|
27
|
public class DatabaseRepairUpdateSortIndicesWizard extends Wizard implements IPostMoniteredOperationEnabled{
|
28
|
// private final DatabaseRepairSortIndexPage repairSortIndexPage;
|
29
|
private final SortIndexUpdaterWizardPage page;
|
30
|
SortIndexUpdaterConfigurator config;
|
31
|
|
32
|
ILongRunningTasksService longRunningTaskService;
|
33
|
|
34
|
public DatabaseRepairUpdateSortIndicesWizard() {
|
35
|
setWindowTitle("Update Sort Indices");
|
36
|
config = SortIndexUpdaterConfigurator.NewInstance();
|
37
|
page = new SortIndexUpdaterWizardPage("Sort index update", config);
|
38
|
longRunningTaskService = CdmApplicationState.getLongRunningTasksService();
|
39
|
}
|
40
|
|
41
|
@Override
|
42
|
public boolean performFinish() {
|
43
|
|
44
|
if (config == null){
|
45
|
config = SortIndexUpdaterConfigurator.NewInstance();
|
46
|
config.setDoTermNode(false);
|
47
|
config.setDoPolytomousKeyNode(false);
|
48
|
}
|
49
|
if (config.isDoTermNode() || config.isDoPolytomousKeyNode() || config.isDoTaxonNode()){
|
50
|
|
51
|
final UUID uuid = longRunningTaskService.monitLongRunningTask(config);
|
52
|
Display.getDefault().asyncExec(new Runnable() {
|
53
|
@Override
|
54
|
public void run() {
|
55
|
AbstractUtility.executeMoniteredOperation("Update SortIndices: ",
|
56
|
uuid,
|
57
|
1000,
|
58
|
false,
|
59
|
DatabaseRepairUpdateSortIndicesWizard.this,
|
60
|
null,
|
61
|
true, true);
|
62
|
}
|
63
|
});
|
64
|
}
|
65
|
|
66
|
return true;
|
67
|
}
|
68
|
|
69
|
@Override
|
70
|
public void addPages() {
|
71
|
addPage(page);
|
72
|
}
|
73
|
|
74
|
@Override
|
75
|
public void postOperation(IRemotingProgressMonitor monitor) {
|
76
|
// TODO Auto-generated method stub
|
77
|
}
|
78
|
}
|