2 * Copyright (C) 2016 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.databaseAdmin
.wizard
;
11 import org
.eclipse
.core
.runtime
.jobs
.Job
;
12 import org
.eclipse
.jface
.wizard
.Wizard
;
14 import eu
.etaxonomy
.cdm
.config
.ICdmSource
;
15 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
.CHECK
;
16 import eu
.etaxonomy
.cdm
.io
.operation
.config
.CacheUpdaterConfigurator
;
17 import eu
.etaxonomy
.cdm
.io
.operation
.config
.SortIndexUpdaterConfigurator
;
18 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
19 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
20 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
21 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 public class DatabaseRepairWizard
extends Wizard
{
31 // private final DatabaseRepairSortIndexPage repairSortIndexPage;
32 private final Test test
;
33 SortIndexUpdaterConfigurator config
;
34 CacheUpdaterConfigurator cacheUpdaterConfig
;
38 public DatabaseRepairWizard() {
39 setWindowTitle("Repair Wizard");
40 config
= SortIndexUpdaterConfigurator
.NewInstance(null);
41 // repairSortIndexPage = new DatabaseRepairSortIndexPage("SortIndex Repair",config);
42 cacheUpdaterConfig
= CacheUpdaterConfigurator
.NewInstance(null);
43 test
= new Test("Test", cacheUpdaterConfig
, config
);
51 public boolean performFinish() {
54 ICdmSource source
= CdmStore
.getActiveCdmSource();
55 config
= SortIndexUpdaterConfigurator
.NewInstance(null);
56 config
.setDoFeatureNode(false);
57 config
.setDoPolytomousKeyNode(false);
61 if (config
.isDoFeatureNode() || config
.isDoPolytomousKeyNode() || config
.isDoTaxonNode()){
62 config
.setCheck(CHECK
.IMPORT_WITHOUT_CHECK
);
63 Job updateJob
= CdmStore
.getImportManager().createIOServiceJob(config
);
64 CdmStore
.getImportManager().run(updateJob
);
66 if (test
.updateAgentBase
){
67 cacheUpdaterConfig
.getClassList().add(TeamOrPersonBase
.class);
69 if (test
.updateReference
){
70 cacheUpdaterConfig
.getClassList().add(Reference
.class);
73 cacheUpdaterConfig
.getClassList().add(TaxonName
.class);
75 if (test
.updateTaxonBase
){
76 cacheUpdaterConfig
.getClassList().add(TaxonBase
.class);
78 if (test
.updateSpecimen
){
79 cacheUpdaterConfig
.getClassList().add(SpecimenOrObservationBase
.class);
81 if (!cacheUpdaterConfig
.getClassList().isEmpty()){
82 cacheUpdaterConfig
.setCheck(CHECK
.IMPORT_WITHOUT_CHECK
);
83 Job updateJob2
= CdmStore
.getImportManager().createIOServiceJob(cacheUpdaterConfig
);
84 CdmStore
.getImportManager().run(updateJob2
);
93 public void addPages() {
94 //addPage(repairSortIndexPage);