Project

General

Profile

Download (3.19 KB) Statistics
| Branch: | Tag: | Revision:
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_30;
10

    
11
import java.util.ArrayList;
12
import java.util.List;
13

    
14
import org.apache.logging.log4j.LogManager;import org.apache.logging.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

    
22
/**
23
 * @author a.mueller
24
 * @since 10.09.2010
25
 *
26
 */
27
public class SchemaUpdater_24_25 extends SchemaUpdaterBase {
28
	@SuppressWarnings("unused")
29
	private static final Logger logger = LogManager.getLogger(SchemaUpdater_24_25.class);
30
	private static final String startSchemaVersion = "2.4.1.2.201004231015";
31
	private static final String endSchemaVersion = "2.5.0.0.201009211255";
32

    
33
// ********************** FACTORY METHOD *******************************************
34

    
35
	public static SchemaUpdater_24_25 NewInstance(){
36
		return new SchemaUpdater_24_25();
37
	}
38

    
39

    
40
// ********************** CONSTRUCTOR *******************************************/
41

    
42
	private SchemaUpdater_24_25(){
43
		super(startSchemaVersion, endSchemaVersion);
44
	}
45

    
46
// ************************ NEXT / PREVIOUS **************************************/
47

    
48
	@Override
49
	public ISchemaUpdater getPreviousUpdater() {
50
		return null;
51
	}
52

    
53
// ************************** UPDATE STEPS ************************************************
54

    
55
	@Override
56
	protected List<ISchemaUpdaterStep> getUpdaterList() {
57
		List<ISchemaUpdaterStep> stepList = new ArrayList<>();
58
		String stepName;
59

    
60
		//sortIndex on children in FeatureNode
61
		stepName = "Add sort index on FeatureNode children";
62
		ColumnAdder.NewIntegerInstance(stepList, stepName, "FeatureNode", "sortindex", INCLUDE_AUDIT, false, null);
63

    
64
		//update sortindex on FeatureNode children
65
		stepName = "Update sort index on FeatureNode children";
66
//		updateQuery = "UPDATE FeatureNode SET sortindex = id WHERE sortindex is null";
67
//		SimpleSchemaUpdaterStep.NewInstance(stepList, stepName, updateQuery);
68
		SortIndexUpdater.NewInstance(stepList, stepName, "FeatureNode", "parent_fk", "sortindex", INCLUDE_AUDIT);
69

    
70
		//add country to gathering event
71
		stepName = "Add country column to gathering event";
72
		ColumnAdder.NewIntegerInstance(stepList, stepName, "GatheringEvent", "country_id", INCLUDE_AUDIT, false, "DefinedTermBase");
73

    
74
		//add unplaced and excluded to taxon
75
		stepName = "Add unplaced to taxon";
76
		Boolean defaultValue = false;
77
		ColumnAdder.NewBooleanInstance(stepList, stepName, "TaxonBase", "unplaced", INCLUDE_AUDIT, defaultValue);
78

    
79
		//add excluded to taxon
80
		stepName = "Add excluded to taxon";
81
		defaultValue = false;
82
		ColumnAdder.NewBooleanInstance(stepList, stepName, "TaxonBase", "excluded", INCLUDE_AUDIT, defaultValue);
83

    
84
		//add barcode to derived unit base
85
		stepName = "Add barcode to specimen";
86
		ColumnAdder.NewStringInstance(stepList, stepName, "SpecimenOrObservationBase", "barcode", INCLUDE_AUDIT);
87

    
88
		return stepList;
89
	}
90
}
(3-3/5)