Project

General

Profile

Download (1.63 KB) Statistics
| Branch: | Tag: | Revision:
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.databasePreferences.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.SortIndexUpdaterConfigurator;
16
import eu.etaxonomy.taxeditor.store.CdmStore;
17

    
18
/**
19
 * @author k.luther
20
 * @date 06.12.2016
21
 *
22
 */
23
public class DatabaseRepairWizard extends Wizard {
24
    private final DatabaseRepairPage repairPage;
25
    SortIndexUpdaterConfigurator config;
26

    
27
    public DatabaseRepairWizard() {
28
        setWindowTitle("Database Repair Wizard");
29
        config = SortIndexUpdaterConfigurator.NewInstance(null);
30
        repairPage = new DatabaseRepairPage("Database Repair",config);
31

    
32
    }
33

    
34
    /**
35
     * {@inheritDoc}
36
     */
37
    @Override
38
    public boolean performFinish() {
39
        if (repairPage.isPageComplete()){
40
            if (config == null){
41
                ICdmSource source= CdmStore.getActiveCdmSource();
42
                config = SortIndexUpdaterConfigurator.NewInstance(null);
43
                config.setDoFeatureNode(false);
44
                config.setDoPolytomousKeyNode(false);
45

    
46
             }
47
             Job updateJob = CdmStore.getImportManager().createIOServiceJob(config);
48

    
49
             CdmStore.getImportManager().run(updateJob);
50
        }
51
        return true;
52
    }
53

    
54
    @Override
55
    public void addPages() {
56
        addPage(repairPage);
57
    }
58

    
59

    
60
}
(4-4/4)