1
|
/**
|
2
|
* Copyright (C) 2009 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.cdm.database.update.v24_25;
|
10
|
|
11
|
import java.util.ArrayList;
|
12
|
import java.util.List;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
|
16
|
import eu.etaxonomy.cdm.database.update.ColumnAdder;
|
17
|
import eu.etaxonomy.cdm.database.update.ISchemaUpdater;
|
18
|
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep;
|
19
|
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase;
|
20
|
import eu.etaxonomy.cdm.database.update.SortIndexUpdater;
|
21
|
import eu.etaxonomy.cdm.database.update.v25_30.SchemaUpdater_25_30;
|
22
|
|
23
|
/**
|
24
|
* @author a.mueller
|
25
|
* @date 10.09.2010
|
26
|
*
|
27
|
*/
|
28
|
public class SchemaUpdater_24_25 extends SchemaUpdaterBase implements ISchemaUpdater {
|
29
|
@SuppressWarnings("unused")
|
30
|
private static final Logger logger = Logger.getLogger(SchemaUpdater_24_25.class);
|
31
|
private static final String startSchemaVersion = "2.4.1.2.201004231015";
|
32
|
private static final String endSchemaVersion = "2.5.0.0.201009211255";
|
33
|
|
34
|
// ********************** FACTORY METHOD *******************************************
|
35
|
|
36
|
public static SchemaUpdater_24_25 NewInstance(){
|
37
|
return new SchemaUpdater_24_25();
|
38
|
}
|
39
|
|
40
|
|
41
|
// ********************** CONSTRUCTOR *******************************************/
|
42
|
|
43
|
private SchemaUpdater_24_25(){
|
44
|
super(startSchemaVersion, endSchemaVersion);
|
45
|
}
|
46
|
|
47
|
// ************************ NEXT / PREVIOUS **************************************/
|
48
|
|
49
|
@Override
|
50
|
public ISchemaUpdater getNextUpdater() {
|
51
|
return SchemaUpdater_25_30.NewInstance();
|
52
|
}
|
53
|
|
54
|
@Override
|
55
|
public ISchemaUpdater getPreviousUpdater() {
|
56
|
return null;
|
57
|
}
|
58
|
|
59
|
// ************************** UPDATE STEPS ************************************************
|
60
|
|
61
|
@Override
|
62
|
protected List<ISchemaUpdaterStep> getUpdaterList() {
|
63
|
List<ISchemaUpdaterStep> stepList = new ArrayList<ISchemaUpdaterStep>();
|
64
|
String stepName;
|
65
|
|
66
|
//sortIndex on children in FeatureNode
|
67
|
stepName = "Add sort index on FeatureNode children";
|
68
|
ColumnAdder step = ColumnAdder.NewIntegerInstance(stepName, "FeatureNode", "sortindex", INCLUDE_AUDIT, false, null);
|
69
|
stepList.add(step);
|
70
|
|
71
|
//update sortindex on FeatureNode children
|
72
|
stepName = "Update sort index on FeatureNode children";
|
73
|
// updateQuery = "UPDATE FeatureNode SET sortindex = id WHERE sortindex is null";
|
74
|
// SimpleSchemaUpdaterStep updateSortindex = SimpleSchemaUpdaterStep.NewInstance(stepName, updateQuery);
|
75
|
// stepList.add(updateSortindex);
|
76
|
SortIndexUpdater updateSortIndex = SortIndexUpdater.NewInstance(stepName, "FeatureNode", "parent_fk", "sortindex", INCLUDE_AUDIT);
|
77
|
stepList.add(updateSortIndex);
|
78
|
|
79
|
//add country to gathering event
|
80
|
stepName = "Add country column to gathering event";
|
81
|
step = ColumnAdder.NewIntegerInstance(stepName, "GatheringEvent", "country_id", INCLUDE_AUDIT, false, "DefinedTermBase");
|
82
|
stepList.add(step);
|
83
|
|
84
|
//add unplaced and excluded to taxon
|
85
|
stepName = "Add unplaced to taxon";
|
86
|
Boolean defaultValue = false;
|
87
|
step = ColumnAdder.NewBooleanInstance(stepName, "TaxonBase", "unplaced", INCLUDE_AUDIT, defaultValue);
|
88
|
stepList.add(step);
|
89
|
|
90
|
//add excluded to taxon
|
91
|
stepName = "Add excluded to taxon";
|
92
|
defaultValue = false;
|
93
|
step = ColumnAdder.NewBooleanInstance(stepName, "TaxonBase", "excluded", INCLUDE_AUDIT, defaultValue);
|
94
|
stepList.add(step);
|
95
|
|
96
|
//add barcode to derived unit base
|
97
|
stepName = "Add barcode to specimen";
|
98
|
step = ColumnAdder.NewStringInstance(stepName, "SpecimenOrObservationBase", "barcode", INCLUDE_AUDIT);
|
99
|
stepList.add(step);
|
100
|
|
101
|
return stepList;
|
102
|
}
|
103
|
}
|