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 org.eclipse.core.runtime.jobs.Job;
|
12
|
import org.eclipse.jface.wizard.Wizard;
|
13
|
|
14
|
import eu.etaxonomy.cdm.config.ICdmSource;
|
15
|
import eu.etaxonomy.cdm.io.common.CacheUpdaterConfigurator;
|
16
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
|
17
|
import eu.etaxonomy.cdm.io.common.SortIndexUpdaterConfigurator;
|
18
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
19
|
|
20
|
/**
|
21
|
* @author k.luther
|
22
|
* @date 06.12.2016
|
23
|
*
|
24
|
*/
|
25
|
public class DatabaseRepairWizard extends Wizard {
|
26
|
// private final DatabaseRepairSortIndexPage repairSortIndexPage;
|
27
|
private final Test test;
|
28
|
SortIndexUpdaterConfigurator config;
|
29
|
CacheUpdaterConfigurator cacheUpdaterConfig;
|
30
|
|
31
|
|
32
|
|
33
|
public DatabaseRepairWizard() {
|
34
|
setWindowTitle("Database Repair Wizard");
|
35
|
config = SortIndexUpdaterConfigurator.NewInstance(null);
|
36
|
// repairSortIndexPage = new DatabaseRepairSortIndexPage("SortIndex Repair",config);
|
37
|
cacheUpdaterConfig = CacheUpdaterConfigurator.NewInstance(null);
|
38
|
test = new Test("Test", cacheUpdaterConfig, config);
|
39
|
|
40
|
}
|
41
|
|
42
|
/**
|
43
|
* {@inheritDoc}
|
44
|
*/
|
45
|
@Override
|
46
|
public boolean performFinish() {
|
47
|
|
48
|
if (config == null){
|
49
|
ICdmSource source= CdmStore.getActiveCdmSource();
|
50
|
config = SortIndexUpdaterConfigurator.NewInstance(null);
|
51
|
config.setDoFeatureNode(false);
|
52
|
config.setDoPolytomousKeyNode(false);
|
53
|
|
54
|
|
55
|
}
|
56
|
if (config.isDoFeatureNode() || config.isDoPolytomousKeyNode() || config.isDoTaxonNode()){
|
57
|
config.setCheck(CHECK.IMPORT_WITHOUT_CHECK);
|
58
|
Job updateJob = CdmStore.getImportManager().createIOServiceJob(config);
|
59
|
CdmStore.getImportManager().run(updateJob);
|
60
|
}
|
61
|
if (!cacheUpdaterConfig.getClassList().isEmpty()){
|
62
|
cacheUpdaterConfig.setCheck(CHECK.IMPORT_WITHOUT_CHECK);
|
63
|
Job updateJob2 = CdmStore.getImportManager().createIOServiceJob(cacheUpdaterConfig);
|
64
|
CdmStore.getImportManager().run(updateJob2);
|
65
|
}
|
66
|
|
67
|
|
68
|
|
69
|
return true;
|
70
|
}
|
71
|
|
72
|
@Override
|
73
|
public void addPages() {
|
74
|
//addPage(repairSortIndexPage);
|
75
|
addPage(test);
|
76
|
}
|
77
|
|
78
|
|
79
|
}
|