1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.database.update.v30_31;
|
11
|
|
12
|
import java.util.ArrayList;
|
13
|
import java.util.List;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.database.update.ITermUpdater;
|
19
|
import eu.etaxonomy.cdm.database.update.ITermUpdaterStep;
|
20
|
import eu.etaxonomy.cdm.database.update.SimpleSchemaUpdaterStep;
|
21
|
import eu.etaxonomy.cdm.database.update.TermUpdaterBase;
|
22
|
|
23
|
/**
|
24
|
* @author a.mueller
|
25
|
* @date 10.09.2010
|
26
|
*
|
27
|
*/
|
28
|
public class TermUpdater_31_311 extends TermUpdaterBase implements ITermUpdater {
|
29
|
@SuppressWarnings("unused")
|
30
|
private static final Logger logger = Logger.getLogger(TermUpdater_31_311.class);
|
31
|
|
32
|
public static final String startTermVersion = "3.0.1.0.201012150000";
|
33
|
private static final String endTermVersion = "3.0.1.1.201101310000";
|
34
|
|
35
|
// *************************** FACTORY **************************************/
|
36
|
|
37
|
public static TermUpdater_31_311 NewInstance(){
|
38
|
return new TermUpdater_31_311(startTermVersion, endTermVersion);
|
39
|
}
|
40
|
|
41
|
// *************************** CONSTRUCTOR ***********************************/
|
42
|
|
43
|
protected TermUpdater_31_311(String startTermVersion, String endTermVersion) {
|
44
|
super(startTermVersion, endTermVersion);
|
45
|
}
|
46
|
|
47
|
//
|
48
|
|
49
|
/* (non-Javadoc)
|
50
|
* @see eu.etaxonomy.cdm.database.update.ICdmUpdater#invoke()
|
51
|
*/
|
52
|
@Override
|
53
|
protected List<ITermUpdaterStep> getUpdaterList() {
|
54
|
List<ITermUpdaterStep> list = new ArrayList<ITermUpdaterStep>();
|
55
|
|
56
|
String description;
|
57
|
String label;
|
58
|
String abbrev;
|
59
|
String dtype;
|
60
|
boolean isOrdered;
|
61
|
UUID uuidVocabulary;
|
62
|
UUID uuidAfterTerm;
|
63
|
UUID uuidLang;
|
64
|
String stepName;
|
65
|
|
66
|
// // [unranked infragneric]
|
67
|
// UUID uuidTerm = UUID.fromString("994646a1-c2e7-461d-a1bc-2afd6ea51b40");
|
68
|
// description = "Unranked Infragneric Rank: The infrageneric name on purpose has no rank";
|
69
|
// label = "Unranked Infrageneric";
|
70
|
// abbrev = "[unranked]";
|
71
|
// dtype = Rank.class.getSimpleName();
|
72
|
// isOrdered = true;
|
73
|
// uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b");
|
74
|
// uuidAfterTerm = UUID.fromString("41bcc6ac-37d3-4fd4-bb80-3cc5b04298b9");
|
75
|
// uuidLang = Language.uuidEnglish;
|
76
|
// stepName = "Add 'unranked infrageneric' rank to ranks";
|
77
|
// list.add( SingleTermUpdater.NewInstance(stepName, uuidTerm, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm));
|
78
|
//
|
79
|
//
|
80
|
// // [unranked infraspecific]
|
81
|
// uuidTerm = UUID.fromString("a965befb-70a9-4747-a18f-624456c65223");
|
82
|
// description = "Unranked Infraspecific Rank: The infraspecific name on purpose has no rank";
|
83
|
// label = "Unranked Infraspecific";
|
84
|
// abbrev = "[unranked]";
|
85
|
// dtype = Rank.class.getSimpleName();
|
86
|
// isOrdered = true;
|
87
|
// uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b");
|
88
|
// uuidAfterTerm = UUID.fromString("5c4d6755-2cf6-44ca-9220-cccf8881700b");
|
89
|
// uuidLang = Language.uuidEnglish;
|
90
|
// stepName = "Add 'unranked' rank to ranks";
|
91
|
// list.add( SingleTermUpdater.NewInstance(stepName, uuidTerm, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm));
|
92
|
|
93
|
String sql = "UPDATE Representation SET text = '`Unranked? Infrageneric Rank: The infrageneric name on purpose has no rank', label = 'Unranked (infrageneric)', abbreviatedlabel = '[infragen.]'" +
|
94
|
" WHERE abbreviatedlabel = 't.infgen.'";
|
95
|
stepName = "Update unranked infrageneric representation";
|
96
|
SimpleSchemaUpdaterStep infraGenStep = SimpleSchemaUpdaterStep.NewInstance(stepName, sql);
|
97
|
list.add(infraGenStep);
|
98
|
|
99
|
sql = "UPDATE DefinedTermBase SET titleCache = 'Unranked (infrageneric)' " +
|
100
|
" WHERE titleCache = 'Infrageneric Taxon'";
|
101
|
stepName = "Update unranked infrageneric title cache";
|
102
|
SimpleSchemaUpdaterStep infraGenTitleStep = SimpleSchemaUpdaterStep.NewInstance(stepName, sql);
|
103
|
list.add(infraGenTitleStep);
|
104
|
|
105
|
|
106
|
|
107
|
sql = "UPDATE Representation SET text = '`Unranked? Infraspecific Rank: The infraspecific name on purpose has no rank', label = 'Unranked (infraspecific)', abbreviatedlabel = '[infraspec.]' " +
|
108
|
" WHERE abbreviatedlabel = 't.infr.'";
|
109
|
stepName = "Update unranked infraspecific representation";
|
110
|
SimpleSchemaUpdaterStep infraSpecStep = SimpleSchemaUpdaterStep.NewInstance(stepName, sql);
|
111
|
list.add(infraSpecStep);
|
112
|
|
113
|
sql = "UPDATE DefinedTermBase SET titleCache = 'Unranked (infraspecific)' " +
|
114
|
" WHERE titleCache = 'Infraspecific Taxon'";
|
115
|
stepName = "Update unranked infraspecific title cache";
|
116
|
SimpleSchemaUpdaterStep infraSpecTitleStep = SimpleSchemaUpdaterStep.NewInstance(stepName, sql);
|
117
|
list.add(infraSpecTitleStep);
|
118
|
|
119
|
|
120
|
|
121
|
return list;
|
122
|
}
|
123
|
|
124
|
|
125
|
/* (non-Javadoc)
|
126
|
* @see eu.etaxonomy.cdm.database.update.ICdmUpdater#getNextUpdater()
|
127
|
*/
|
128
|
@Override
|
129
|
public ITermUpdater getNextUpdater() {
|
130
|
return null;
|
131
|
}
|
132
|
|
133
|
/* (non-Javadoc)
|
134
|
* @see eu.etaxonomy.cdm.database.update.ICdmUpdater#getPreviousUpdater()
|
135
|
*/
|
136
|
@Override
|
137
|
public ITermUpdater getPreviousUpdater() {
|
138
|
return TermUpdater_30_31.NewInstance();
|
139
|
}
|
140
|
|
141
|
}
|