include more auditing in schema update and refactor to better allow transaction suppo...
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / database / update / v31_33 / TermUpdater_31_33.java
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.v31_33;
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.SingleTermUpdater;
21 import eu.etaxonomy.cdm.database.update.TermUpdaterBase;
22 import eu.etaxonomy.cdm.database.update.v30_31.TermUpdater_314_315;
23 import eu.etaxonomy.cdm.model.common.Language;
24 import eu.etaxonomy.cdm.model.common.TermType;
25 import eu.etaxonomy.cdm.model.name.NameRelationshipType;
26 import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
27 import eu.etaxonomy.cdm.model.name.Rank;
28 import eu.etaxonomy.cdm.model.name.RankClass;
29
30 /**
31 * @author a.mueller
32 * @date 10.09.2010
33 *
34 */
35 public class TermUpdater_31_33 extends TermUpdaterBase implements ITermUpdater {
36 @SuppressWarnings("unused")
37 private static final Logger logger = Logger.getLogger(TermUpdater_31_33.class);
38
39 public static final String startTermVersion = "3.0.1.4.201105100000";
40 private static final String endTermVersion = "3.3.0.0.201308010000";
41
42 // *************************** FACTORY **************************************/
43
44 public static TermUpdater_31_33 NewInstance(){
45 return new TermUpdater_31_33(startTermVersion, endTermVersion);
46 }
47
48 // *************************** CONSTRUCTOR ***********************************/
49
50 protected TermUpdater_31_33(String startTermVersion, String endTermVersion) {
51 super(startTermVersion, endTermVersion);
52 }
53
54 //
55
56 /* (non-Javadoc)
57 * @see eu.etaxonomy.cdm.database.update.ICdmUpdater#invoke()
58 */
59 @Override
60 protected List<ITermUpdaterStep> getUpdaterList() {
61 List<ITermUpdaterStep> list = new ArrayList<ITermUpdaterStep>();
62
63 // proles, #2793
64 UUID uuidTerm = UUID.fromString("8810d1ba-6a34-4ae3-a355-919ccd1cd1a5");
65 String description = "Rank 'Proles'. Note: This rank is not compliant with the current nomenclatural codes";
66 String label = "Proles";
67 String abbrev = "prol.";
68 String dtype = Rank.class.getSimpleName();
69 boolean isOrdered = true;
70 UUID uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b");
71 UUID uuidAfterTerm = UUID.fromString("bff22f84-553a-4429-a4e7-c4b3796c3a18");
72 UUID uuidLang = Language.uuidEnglish;
73 RankClass rankClass = RankClass.Infraspecific;
74 String stepName = "Add 'proles' rank to ranks";
75 TermType termType = TermType.Rank;
76 list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm).setRankClass(rankClass));
77
78 // race, #2793
79 uuidTerm = UUID.fromString("196dee39-cfd8-4460-8bf0-88b83da27f62");
80 description = "Rank 'Race'. Note: This rank is not compliant with the current nomenclatural codes";
81 label = "Race";
82 abbrev = "race";
83 dtype = Rank.class.getSimpleName();
84 isOrdered = true;
85 uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b");
86 uuidAfterTerm = UUID.fromString("8810d1ba-6a34-4ae3-a355-919ccd1cd1a5");
87 uuidLang = Language.uuidEnglish;
88 rankClass = RankClass.Infraspecific;
89 stepName = "Add 'race' rank to ranks";
90 termType = TermType.Rank;
91 list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm).setRankClass(rankClass));
92
93 // sublusus, #2793
94 uuidTerm = UUID.fromString("1fafa596-a8e7-4e62-a378-3cc8cb3627ca");
95 description = "Rank 'Sublusus'. Note: This rank is not compliant with the current nomenclatural codes";
96 label = "Sublusus";
97 abbrev = "sublusus";
98 dtype = Rank.class.getSimpleName();
99 isOrdered = true;
100 uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b");
101 uuidAfterTerm = UUID.fromString("196dee39-cfd8-4460-8bf0-88b83da27f625");
102 uuidLang = Language.uuidEnglish;
103 rankClass = RankClass.Infraspecific;
104 stepName = "Add 'sublusus' rank to ranks";
105 termType = TermType.Rank;
106 list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm).setRankClass(rankClass));
107
108 // comb. nov., #3545
109 uuidTerm = UUID.fromString("ed508710-deef-44b1-96f6-1ce6d2c9c884");
110 description = "Nomenclatural status type 'new combination'";
111 label = "new combination";
112 abbrev = "comb. nov.";
113 dtype = NomenclaturalStatusType.class.getSimpleName();
114 isOrdered = true;
115 uuidVocabulary = UUID.fromString("bb28cdca-2f8a-4f11-9c21-517e9ae87f1f");
116 uuidAfterTerm = UUID.fromString("92a76bd0-6ea8-493f-98e0-4be0b98c092f");
117 uuidLang = Language.uuidEnglish;
118 stepName = "Add 'comb. nov.' status to nom. status types";
119 termType = TermType.NomenclaturalStatusType;
120 list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm));
121
122 // original spelling, #2874
123 uuidTerm = UUID.fromString("264d2be4-e378-4168-9760-a9512ffbddc4");
124 description = "Namerelationship type 'original spelling for'";
125 label = "original spelling for";
126 abbrev = null;
127 String reverseDescription = "has original spelling";
128 String reverseLabel = "has original spelling";
129 String reverseAbbrev = null;
130 dtype = NameRelationshipType.class.getSimpleName();
131 isOrdered = true;
132 uuidVocabulary = UUID.fromString("6878cb82-c1a4-4613-b012-7e73b413c8cd");
133 uuidAfterTerm = UUID.fromString("eeaea868-c4c1-497f-b9fe-52c9fc4aca53");
134 uuidLang = Language.uuidEnglish;
135 stepName = "Add 'original spelling for' name relationship name relationship types";
136 termType = TermType.NameRelationshipType;
137 boolean symmetric = false;
138 boolean transitive = false;
139 list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description,
140 label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm)
141 .setReverseRepresentation(reverseDescription, reverseLabel, reverseAbbrev)
142 .setSymmetricTransitiv(symmetric, transitive));
143
144
145 // later isnonym, #2874
146 uuidTerm = UUID.fromString("29ab238d-598d-45b9-addd-003cf39ccc3e");
147 description = "Namerelationship type 'later isonym for'";
148 label = "later isonym for";
149 abbrev = null;
150 reverseDescription = "has earlier isonym";
151 reverseLabel = "has earlier isonym";
152 reverseAbbrev = null;
153 dtype = NameRelationshipType.class.getSimpleName();
154 isOrdered = true;
155 uuidVocabulary = UUID.fromString("6878cb82-c1a4-4613-b012-7e73b413c8cd");
156 uuidAfterTerm = UUID.fromString("2990a884-3302-4c8b-90b2-dfd31aaa2778");
157 uuidLang = Language.uuidEnglish;
158 stepName = "Add 'later isonym for' name relationship name relationship types";
159 termType = TermType.NameRelationshipType;
160 symmetric = false;
161 transitive = true;
162 list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description,
163 label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm)
164 .setReverseRepresentation(reverseDescription, reverseLabel, reverseAbbrev)
165 .setSymmetricTransitiv(symmetric, transitive));
166
167
168
169 return list;
170 }
171
172
173 /* (non-Javadoc)
174 * @see eu.etaxonomy.cdm.database.update.ICdmUpdater#getNextUpdater()
175 */
176 @Override
177 public ITermUpdater getNextUpdater() {
178 return null;
179 }
180
181 /* (non-Javadoc)
182 * @see eu.etaxonomy.cdm.database.update.ICdmUpdater#getPreviousUpdater()
183 */
184 @Override
185 public ITermUpdater getPreviousUpdater() {
186 return TermUpdater_314_315.NewInstance();
187 }
188
189 }