Revision f728a51b
Added by Andreas Müller almost 7 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/CdmMetaData.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 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 |
|
|
11 |
package eu.etaxonomy.cdm.model.metadata; |
|
12 |
|
|
13 |
import java.util.ArrayList; |
|
14 |
import java.util.Comparator; |
|
15 |
import java.util.List; |
|
16 |
|
|
17 |
import javax.persistence.Entity; |
|
18 |
|
|
19 |
import org.apache.log4j.Logger; |
|
20 |
import org.joda.time.DateTime; |
|
21 |
|
|
22 |
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor; |
|
23 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author a.mueller |
|
27 |
* @created 07.09.2009 |
|
28 |
*/ |
|
29 |
@Entity |
|
30 |
public class CdmMetaData extends CdmBase{ |
|
31 |
private static final long serialVersionUID = -3033376680593279078L; |
|
32 |
@SuppressWarnings("unused") |
|
33 |
private static final Logger logger = Logger.getLogger(CdmMetaData.class); |
|
34 |
|
|
35 |
/* It is a little bit confusing that this specific information is located in |
|
36 |
* a generic class for metadata. Think about moving the schema version |
|
37 |
* |
|
38 |
*/ |
|
39 |
/** |
|
40 |
* The database schema version number. |
|
41 |
* It is recommended to have the first two numbers equal to the CDM Library version number. |
|
42 |
* But it is not obligatory as there may be cases when the library number changes but the |
|
43 |
* schema version is not changing. |
|
44 |
* The third should be incremented if the schema changes in a way that SCHEMA_VALIDATION.UPDATE |
|
45 |
* will probably not work or will not be enough to transform old data into new data. |
|
46 |
* The fourth number should be incremented when minor schema changes take place that can |
|
47 |
* be handled by SCHEMA_VALIDATION.UPDATE |
|
48 |
* The last number represents the date of change. |
|
49 |
*/ |
|
50 |
private static final String dbSchemaVersion = "3.6.0.0.201527040000"; |
|
51 |
// private static final String dbSchemaVersion = "3.4.1.0.201411210000"; |
|
52 |
// private static final String dbSchemaVersion = "3.5.0.0.201531030000"; |
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* @return a list of default metadata objects |
|
60 |
*/ |
|
61 |
public static final List<CdmMetaData> defaultMetaData(){ |
|
62 |
List<CdmMetaData> result = new ArrayList<CdmMetaData>(); |
|
63 |
// schema version |
|
64 |
result.add(new CdmMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION, dbSchemaVersion)); |
|
65 |
//term version |
|
66 |
result.add(new CdmMetaData(MetaDataPropertyName.TERMS_VERSION, termsVersion)); |
|
67 |
// database create time |
|
68 |
result.add(new CdmMetaData(MetaDataPropertyName.DB_CREATE_DATE, new DateTime().toString())); |
|
69 |
return result; |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* The version number for the terms loaded by the termloader (csv-files) |
|
74 |
* It is recommended to have the first two numbers equal to the CDM Library version number. |
|
75 |
* |
|
76 |
* But it is not obligatory as there may be cases when the library number changes but the |
|
77 |
* schema version is not changing. |
|
78 |
* |
|
79 |
* The third should be incremented if the terms change in a way that is not compatible |
|
80 |
* to the previous version (e.g. by changing the type of a term) |
|
81 |
* |
|
82 |
* The fourth number should be incremented when compatible term changes take place |
|
83 |
* (e.g. when new terms were added) |
|
84 |
* |
|
85 |
* The last number represents the date of change. |
|
86 |
*/ |
|
87 |
private static final String termsVersion = "3.6.0.0.201527040000"; |
|
88 |
// private static final String termsVersion = "3.5.0.0.201531030000"; |
|
89 |
|
|
90 |
|
|
91 |
public enum MetaDataPropertyName{ |
|
92 |
DB_SCHEMA_VERSION, |
|
93 |
TERMS_VERSION, |
|
94 |
DB_CREATE_DATE, |
|
95 |
DB_CREATE_NOTE; |
|
96 |
|
|
97 |
public String getSqlQuery(){ |
|
98 |
return "SELECT value FROM CdmMetaData WHERE propertyname=" + this.ordinal(); |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
/* END OF CONFUSION */ |
|
103 |
private MetaDataPropertyName propertyName; |
|
104 |
private String value; |
|
105 |
|
|
106 |
|
|
107 |
/** |
|
108 |
* Method to retrieve a CDM Libraries meta data |
|
109 |
* @return |
|
110 |
*/ |
|
111 |
public static final List<CdmMetaData> propertyList(){ |
|
112 |
List<CdmMetaData> result = new ArrayList<CdmMetaData>(); |
|
113 |
result.add(new CdmMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION, dbSchemaVersion)); |
|
114 |
result.add(new CdmMetaData(MetaDataPropertyName.TERMS_VERSION, termsVersion)); |
|
115 |
result.add(new CdmMetaData(MetaDataPropertyName.DB_CREATE_DATE, new DateTime().toString())); |
|
116 |
return result; |
|
117 |
} |
|
118 |
|
|
119 |
//********************* Constructor *********************************************/ |
|
120 |
|
|
121 |
/** |
|
122 |
* Simple constructor to be used by Spring |
|
123 |
*/ |
|
124 |
protected CdmMetaData(){ |
|
125 |
super(); |
|
126 |
} |
|
127 |
|
|
128 |
public CdmMetaData(MetaDataPropertyName propertyName, String value) { |
|
129 |
super(); |
|
130 |
this.propertyName = propertyName; |
|
131 |
this.value = value; |
|
132 |
} |
|
133 |
|
|
134 |
//****************** instance methods ****************************************/ |
|
135 |
|
|
136 |
/** |
|
137 |
* @return the propertyName |
|
138 |
*/ |
|
139 |
public MetaDataPropertyName getPropertyName() { |
|
140 |
return propertyName; |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* @param propertyName the propertyName to set |
|
145 |
*/ |
|
146 |
public void setPropertyName(MetaDataPropertyName propertyName) { |
|
147 |
this.propertyName = propertyName; |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* @return the value |
|
152 |
*/ |
|
153 |
public String getValue() { |
|
154 |
return value; |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* @param value the value to set |
|
159 |
*/ |
|
160 |
public void setValue(String value) { |
|
161 |
this.value = value; |
|
162 |
} |
|
163 |
|
|
164 |
//******************** Version comparator **********************************/ |
|
165 |
|
|
166 |
public static class VersionComparator implements Comparator<String>{ |
|
167 |
Integer depth; |
|
168 |
IProgressMonitor monitor; |
|
169 |
|
|
170 |
public VersionComparator(Integer depth, IProgressMonitor monitor){ |
|
171 |
this.depth = depth; |
|
172 |
this.monitor = monitor; |
|
173 |
} |
|
174 |
|
|
175 |
/* (non-Javadoc) |
|
176 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
177 |
*/ |
|
178 |
public int compare(String version1, String version2) { |
|
179 |
int result = 0; |
|
180 |
String[] version1Split = version1.split("\\."); |
|
181 |
String[] version2Split = version2.split("\\."); |
|
182 |
|
|
183 |
if(version1Split.length == 1 || version2Split.length == 1){ |
|
184 |
throwException("Tried to compare version but given Strings don't seem to " + |
|
185 |
"contain version numbers. version1: " + version1 + ", version2:" + version2); |
|
186 |
} |
|
187 |
|
|
188 |
if(depth != null && (version1Split.length < depth || version2Split.length < depth )){ |
|
189 |
throwException("Desired depth can not be achieved with the given strings. depth: " + depth + ", version1: " + version1 + ", version2:" + version2); |
|
190 |
} |
|
191 |
|
|
192 |
int length = (depth == null ||version1Split.length < depth) ? version1Split.length : depth; |
|
193 |
for (int i = 0; i < length; i++){ |
|
194 |
Long version1Part = Long.valueOf(version1Split[i]); |
|
195 |
Long version2Part = Long.valueOf(version2Split[i]); |
|
196 |
int partCompare = version1Part.compareTo(version2Part); |
|
197 |
if (partCompare != 0){ |
|
198 |
return partCompare; |
|
199 |
} |
|
200 |
} |
|
201 |
return result; |
|
202 |
} |
|
203 |
|
|
204 |
private Throwable throwException(String message){ |
|
205 |
RuntimeException exception = new RuntimeException(message); |
|
206 |
if (monitor != null){ |
|
207 |
monitor.warning(message, exception); |
|
208 |
} |
|
209 |
throw exception; |
|
210 |
} |
|
211 |
|
|
212 |
} |
|
213 |
|
|
214 |
/** |
|
215 |
* Compares two version string. If version1 is higher than version2 a positive result is returned. |
|
216 |
* If both are equal 0 is returned, otherwise -1 is returned. |
|
217 |
* @see Comparator#compare(Object, Object) |
|
218 |
* @param version1 |
|
219 |
* @param version2 |
|
220 |
* @param depth |
|
221 |
* @param monitor |
|
222 |
* @return |
|
223 |
*/ |
|
224 |
public static int compareVersion(String version1, String version2, Integer depth, IProgressMonitor monitor){ |
|
225 |
VersionComparator versionComparator = new VersionComparator(depth, monitor); |
|
226 |
return versionComparator.compare(version1, version2); |
|
227 |
} |
|
228 |
|
|
229 |
public static boolean isDbSchemaVersionCompatible(String version){ |
|
230 |
return compareVersion(dbSchemaVersion, version, 3, null) == 0; |
|
231 |
} |
|
232 |
|
|
233 |
public static String getDbSchemaVersion() { |
|
234 |
return dbSchemaVersion; |
|
235 |
} |
|
236 |
|
|
237 |
public static String getTermsVersion() { |
|
238 |
return termsVersion; |
|
239 |
} |
|
240 |
|
|
241 |
public static boolean isTermsVersionCompatible(String version){ |
|
242 |
return compareVersion(termsVersion, version, 3, null) == 0; |
|
243 |
} |
|
244 |
|
|
245 |
} |
|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 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 |
|
|
11 |
package eu.etaxonomy.cdm.model.metadata; |
|
12 |
|
|
13 |
import java.util.ArrayList; |
|
14 |
import java.util.Comparator; |
|
15 |
import java.util.List; |
|
16 |
|
|
17 |
import javax.persistence.Entity; |
|
18 |
|
|
19 |
import org.apache.log4j.Logger; |
|
20 |
import org.joda.time.DateTime; |
|
21 |
|
|
22 |
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor; |
|
23 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author a.mueller |
|
27 |
* @created 07.09.2009 |
|
28 |
*/ |
|
29 |
@Entity |
|
30 |
public class CdmMetaData extends CdmBase{ |
|
31 |
private static final long serialVersionUID = -3033376680593279078L; |
|
32 |
@SuppressWarnings("unused") |
|
33 |
private static final Logger logger = Logger.getLogger(CdmMetaData.class); |
|
34 |
|
|
35 |
/* It is a little bit confusing that this specific information is located in |
|
36 |
* a generic class for metadata. Think about moving the schema version |
|
37 |
* |
|
38 |
*/ |
|
39 |
/** |
|
40 |
* The database schema version number. |
|
41 |
* It is recommended to have the first two numbers equal to the CDM Library version number. |
|
42 |
* But it is not obligatory as there may be cases when the library number changes but the |
|
43 |
* schema version is not changing. |
|
44 |
* The third should be incremented if the schema changes in a way that SCHEMA_VALIDATION.UPDATE |
|
45 |
* will probably not work or will not be enough to transform old data into new data. |
|
46 |
* The fourth number should be incremented when minor schema changes take place that can |
|
47 |
* be handled by SCHEMA_VALIDATION.UPDATE |
|
48 |
* The last number represents the date of change. |
|
49 |
*/ |
|
50 |
// private static final String dbSchemaVersion = "3.6.0.0.201527040000"; |
|
51 |
private static final String dbSchemaVersion = "4.0.0.0.201604200000"; |
|
52 |
// private static final String dbSchemaVersion = "3.5.0.0.201531030000"; |
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* @return a list of default metadata objects |
|
60 |
*/ |
|
61 |
public static final List<CdmMetaData> defaultMetaData(){ |
|
62 |
List<CdmMetaData> result = new ArrayList<CdmMetaData>(); |
|
63 |
// schema version |
|
64 |
result.add(new CdmMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION, dbSchemaVersion)); |
|
65 |
//term version |
|
66 |
result.add(new CdmMetaData(MetaDataPropertyName.TERMS_VERSION, termsVersion)); |
|
67 |
// database create time |
|
68 |
result.add(new CdmMetaData(MetaDataPropertyName.DB_CREATE_DATE, new DateTime().toString())); |
|
69 |
return result; |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* The version number for the terms loaded by the termloader (csv-files) |
|
74 |
* It is recommended to have the first two numbers equal to the CDM Library version number. |
|
75 |
* |
|
76 |
* But it is not obligatory as there may be cases when the library number changes but the |
|
77 |
* schema version is not changing. |
|
78 |
* |
|
79 |
* The third should be incremented if the terms change in a way that is not compatible |
|
80 |
* to the previous version (e.g. by changing the type of a term) |
|
81 |
* |
|
82 |
* The fourth number should be incremented when compatible term changes take place |
|
83 |
* (e.g. when new terms were added) |
|
84 |
* |
|
85 |
* The last number represents the date of change. |
|
86 |
*/ |
|
87 |
// private static final String termsVersion = "3.6.0.0.201527040000"; |
|
88 |
private static final String termsVersion = "4.0.0.0.201604200000"; |
|
89 |
|
|
90 |
|
|
91 |
public enum MetaDataPropertyName{ |
|
92 |
DB_SCHEMA_VERSION, |
|
93 |
TERMS_VERSION, |
|
94 |
DB_CREATE_DATE, |
|
95 |
DB_CREATE_NOTE; |
|
96 |
|
|
97 |
public String getSqlQuery(){ |
|
98 |
return "SELECT value FROM CdmMetaData WHERE propertyname=" + this.ordinal(); |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
/* END OF CONFUSION */ |
|
103 |
private MetaDataPropertyName propertyName; |
|
104 |
private String value; |
|
105 |
|
|
106 |
|
|
107 |
/** |
|
108 |
* Method to retrieve a CDM Libraries meta data |
|
109 |
* @return |
|
110 |
*/ |
|
111 |
public static final List<CdmMetaData> propertyList(){ |
|
112 |
List<CdmMetaData> result = new ArrayList<CdmMetaData>(); |
|
113 |
result.add(new CdmMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION, dbSchemaVersion)); |
|
114 |
result.add(new CdmMetaData(MetaDataPropertyName.TERMS_VERSION, termsVersion)); |
|
115 |
result.add(new CdmMetaData(MetaDataPropertyName.DB_CREATE_DATE, new DateTime().toString())); |
|
116 |
return result; |
|
117 |
} |
|
118 |
|
|
119 |
//********************* Constructor *********************************************/ |
|
120 |
|
|
121 |
/** |
|
122 |
* Simple constructor to be used by Spring |
|
123 |
*/ |
|
124 |
protected CdmMetaData(){ |
|
125 |
super(); |
|
126 |
} |
|
127 |
|
|
128 |
public CdmMetaData(MetaDataPropertyName propertyName, String value) { |
|
129 |
super(); |
|
130 |
this.propertyName = propertyName; |
|
131 |
this.value = value; |
|
132 |
} |
|
133 |
|
|
134 |
//****************** instance methods ****************************************/ |
|
135 |
|
|
136 |
/** |
|
137 |
* @return the propertyName |
|
138 |
*/ |
|
139 |
public MetaDataPropertyName getPropertyName() { |
|
140 |
return propertyName; |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* @param propertyName the propertyName to set |
|
145 |
*/ |
|
146 |
public void setPropertyName(MetaDataPropertyName propertyName) { |
|
147 |
this.propertyName = propertyName; |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* @return the value |
|
152 |
*/ |
|
153 |
public String getValue() { |
|
154 |
return value; |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* @param value the value to set |
|
159 |
*/ |
|
160 |
public void setValue(String value) { |
|
161 |
this.value = value; |
|
162 |
} |
|
163 |
|
|
164 |
//******************** Version comparator **********************************/ |
|
165 |
|
|
166 |
public static class VersionComparator implements Comparator<String>{ |
|
167 |
Integer depth; |
|
168 |
IProgressMonitor monitor; |
|
169 |
|
|
170 |
public VersionComparator(Integer depth, IProgressMonitor monitor){ |
|
171 |
this.depth = depth; |
|
172 |
this.monitor = monitor; |
|
173 |
} |
|
174 |
|
|
175 |
/* (non-Javadoc) |
|
176 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
177 |
*/ |
|
178 |
@Override |
|
179 |
public int compare(String version1, String version2) { |
|
180 |
int result = 0; |
|
181 |
String[] version1Split = version1.split("\\."); |
|
182 |
String[] version2Split = version2.split("\\."); |
|
183 |
|
|
184 |
if(version1Split.length == 1 || version2Split.length == 1){ |
|
185 |
throwException("Tried to compare version but given Strings don't seem to " + |
|
186 |
"contain version numbers. version1: " + version1 + ", version2:" + version2); |
|
187 |
} |
|
188 |
|
|
189 |
if(depth != null && (version1Split.length < depth || version2Split.length < depth )){ |
|
190 |
throwException("Desired depth can not be achieved with the given strings. depth: " + depth + ", version1: " + version1 + ", version2:" + version2); |
|
191 |
} |
|
192 |
|
|
193 |
int length = (depth == null ||version1Split.length < depth) ? version1Split.length : depth; |
|
194 |
for (int i = 0; i < length; i++){ |
|
195 |
Long version1Part = Long.valueOf(version1Split[i]); |
|
196 |
Long version2Part = Long.valueOf(version2Split[i]); |
|
197 |
int partCompare = version1Part.compareTo(version2Part); |
|
198 |
if (partCompare != 0){ |
|
199 |
return partCompare; |
|
200 |
} |
|
201 |
} |
|
202 |
return result; |
|
203 |
} |
|
204 |
|
|
205 |
private Throwable throwException(String message){ |
|
206 |
RuntimeException exception = new RuntimeException(message); |
|
207 |
if (monitor != null){ |
|
208 |
monitor.warning(message, exception); |
|
209 |
} |
|
210 |
throw exception; |
|
211 |
} |
|
212 |
|
|
213 |
} |
|
214 |
|
|
215 |
/** |
|
216 |
* Compares two version string. If version1 is higher than version2 a positive result is returned. |
|
217 |
* If both are equal 0 is returned, otherwise -1 is returned. |
|
218 |
* @see Comparator#compare(Object, Object) |
|
219 |
* @param version1 |
|
220 |
* @param version2 |
|
221 |
* @param depth |
|
222 |
* @param monitor |
|
223 |
* @return |
|
224 |
*/ |
|
225 |
public static int compareVersion(String version1, String version2, Integer depth, IProgressMonitor monitor){ |
|
226 |
VersionComparator versionComparator = new VersionComparator(depth, monitor); |
|
227 |
return versionComparator.compare(version1, version2); |
|
228 |
} |
|
229 |
|
|
230 |
public static boolean isDbSchemaVersionCompatible(String version){ |
|
231 |
return compareVersion(dbSchemaVersion, version, 3, null) == 0; |
|
232 |
} |
|
233 |
|
|
234 |
public static String getDbSchemaVersion() { |
|
235 |
return dbSchemaVersion; |
|
236 |
} |
|
237 |
|
|
238 |
public static String getTermsVersion() { |
|
239 |
return termsVersion; |
|
240 |
} |
|
241 |
|
|
242 |
public static boolean isTermsVersionCompatible(String version){ |
|
243 |
return compareVersion(termsVersion, version, 3, null) == 0; |
|
244 |
} |
|
245 |
|
|
246 |
} |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/CdmUpdater.java | ||
---|---|---|
18 | 18 |
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor; |
19 | 19 |
import eu.etaxonomy.cdm.database.CdmDataSource; |
20 | 20 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
21 |
import eu.etaxonomy.cdm.database.update.v35_36.SchemaUpdater_35_36;
|
|
22 |
import eu.etaxonomy.cdm.database.update.v35_36.TermUpdater_35_36;
|
|
21 |
import eu.etaxonomy.cdm.database.update.v36_40.SchemaUpdater_36_40;
|
|
22 |
import eu.etaxonomy.cdm.database.update.v36_40.TermUpdater_36_40;
|
|
23 | 23 |
import eu.etaxonomy.cdm.model.metadata.CdmMetaData; |
24 | 24 |
|
25 | 25 |
/** |
... | ... | |
77 | 77 |
|
78 | 78 |
|
79 | 79 |
private ITermUpdater getCurrentTermUpdater() { |
80 |
return TermUpdater_35_36.NewInstance();
|
|
80 |
return TermUpdater_36_40.NewInstance();
|
|
81 | 81 |
} |
82 | 82 |
|
83 | 83 |
/** |
... | ... | |
85 | 85 |
* @return |
86 | 86 |
*/ |
87 | 87 |
private ISchemaUpdater getCurrentSchemaUpdater() { |
88 |
return SchemaUpdater_35_36.NewInstance();
|
|
88 |
return SchemaUpdater_36_40.NewInstance();
|
|
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
/** |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v35_36/SchemaUpdater_35_36.java | ||
---|---|---|
24 | 24 |
import eu.etaxonomy.cdm.database.update.TableCreator; |
25 | 25 |
import eu.etaxonomy.cdm.database.update.UniqueIndexDropper; |
26 | 26 |
import eu.etaxonomy.cdm.database.update.v34_35.SchemaUpdater_341_35; |
27 |
import eu.etaxonomy.cdm.database.update.v36_40.SchemaUpdater_36_40; |
|
27 | 28 |
|
28 | 29 |
/** |
29 | 30 |
* @author a.mueller |
... | ... | |
190 | 191 |
|
191 | 192 |
@Override |
192 | 193 |
public ISchemaUpdater getNextUpdater() { |
193 |
return null;
|
|
194 |
return SchemaUpdater_36_40.NewInstance();
|
|
194 | 195 |
} |
195 | 196 |
|
196 | 197 |
@Override |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v35_36/TermUpdater_35_36.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.v35_36; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import org.apache.log4j.Logger; |
|
16 |
|
|
17 |
import eu.etaxonomy.cdm.database.update.ITermUpdater; |
|
18 |
import eu.etaxonomy.cdm.database.update.ITermUpdaterStep; |
|
19 |
import eu.etaxonomy.cdm.database.update.TermUpdaterBase; |
|
20 |
import eu.etaxonomy.cdm.database.update.v34_35.TermUpdater_34_35; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author a.mueller |
|
24 |
* @date 10.09.2010 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public class TermUpdater_35_36 extends TermUpdaterBase implements ITermUpdater { |
|
28 |
@SuppressWarnings("unused") |
|
29 |
private static final Logger logger = Logger.getLogger(TermUpdater_35_36.class); |
|
30 |
|
|
31 |
public static final String endTermVersion = "3.6.0.0.201527040000"; |
|
32 |
private static final String startTermVersion = "3.5.0.0.201531030000"; |
|
33 |
|
|
34 |
// *************************** FACTORY **************************************/ |
|
35 |
|
|
36 |
public static TermUpdater_35_36 NewInstance(){ |
|
37 |
return new TermUpdater_35_36(startTermVersion, endTermVersion); |
|
38 |
} |
|
39 |
|
|
40 |
// *************************** CONSTRUCTOR ***********************************/ |
|
41 |
|
|
42 |
protected TermUpdater_35_36(String startTermVersion, String endTermVersion) { |
|
43 |
super(startTermVersion, endTermVersion); |
|
44 |
} |
|
45 |
|
|
46 |
|
|
47 |
@Override |
|
48 |
protected List<ITermUpdaterStep> getUpdaterList() { |
|
49 |
List<ITermUpdaterStep> list = new ArrayList<ITermUpdaterStep>(); |
|
50 |
|
|
51 |
// // proles, #2793 |
|
52 |
// UUID uuidTerm = UUID.fromString("8810d1ba-6a34-4ae3-a355-919ccd1cd1a5"); |
|
53 |
// String description = "Rank ''Proles''. Note: This rank is not compliant with the current nomenclatural codes"; |
|
54 |
// String label = "Proles"; |
|
55 |
// String abbrev = "prol."; |
|
56 |
// String dtype = Rank.class.getSimpleName(); |
|
57 |
// boolean isOrdered = true; |
|
58 |
// UUID uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b"); |
|
59 |
// UUID uuidAfterTerm = UUID.fromString("bff22f84-553a-4429-a4e7-c4b3796c3a18"); |
|
60 |
// UUID uuidLang = Language.uuidEnglish; |
|
61 |
// RankClass rankClass = RankClass.Infraspecific; |
|
62 |
// String stepName = "Add 'proles' rank to ranks"; |
|
63 |
// TermType termType = TermType.Rank; |
|
64 |
// list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm).setRankClass(rankClass)); |
|
65 |
|
|
66 |
//there are some more new vocabularies, but we trust that the term initializer will |
|
67 |
//initialize and persist them correctly |
|
68 |
|
|
69 |
return list; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public ITermUpdater getNextUpdater() { |
|
74 |
return null; |
|
75 |
} |
|
76 |
|
|
77 |
@Override |
|
78 |
public ITermUpdater getPreviousUpdater() { |
|
79 |
return TermUpdater_34_35.NewInstance(); |
|
80 |
} |
|
81 |
|
|
82 |
} |
|
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.v35_36; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import org.apache.log4j.Logger; |
|
16 |
|
|
17 |
import eu.etaxonomy.cdm.database.update.ITermUpdater; |
|
18 |
import eu.etaxonomy.cdm.database.update.ITermUpdaterStep; |
|
19 |
import eu.etaxonomy.cdm.database.update.TermUpdaterBase; |
|
20 |
import eu.etaxonomy.cdm.database.update.v34_35.TermUpdater_34_35; |
|
21 |
import eu.etaxonomy.cdm.database.update.v36_40.TermUpdater_36_40; |
|
22 |
|
|
23 |
/** |
|
24 |
* @author a.mueller |
|
25 |
* @date 10.09.2010 |
|
26 |
* |
|
27 |
*/ |
|
28 |
public class TermUpdater_35_36 extends TermUpdaterBase { |
|
29 |
@SuppressWarnings("unused") |
|
30 |
private static final Logger logger = Logger.getLogger(TermUpdater_35_36.class); |
|
31 |
|
|
32 |
public static final String endTermVersion = "3.6.0.0.201527040000"; |
|
33 |
private static final String startTermVersion = "3.5.0.0.201531030000"; |
|
34 |
|
|
35 |
// *************************** FACTORY **************************************/ |
|
36 |
|
|
37 |
public static TermUpdater_35_36 NewInstance(){ |
|
38 |
return new TermUpdater_35_36(startTermVersion, endTermVersion); |
|
39 |
} |
|
40 |
|
|
41 |
// *************************** CONSTRUCTOR ***********************************/ |
|
42 |
|
|
43 |
protected TermUpdater_35_36(String startTermVersion, String endTermVersion) { |
|
44 |
super(startTermVersion, endTermVersion); |
|
45 |
} |
|
46 |
|
|
47 |
|
|
48 |
@Override |
|
49 |
protected List<ITermUpdaterStep> getUpdaterList() { |
|
50 |
List<ITermUpdaterStep> list = new ArrayList<ITermUpdaterStep>(); |
|
51 |
|
|
52 |
// // proles, #2793 |
|
53 |
// UUID uuidTerm = UUID.fromString("8810d1ba-6a34-4ae3-a355-919ccd1cd1a5"); |
|
54 |
// String description = "Rank ''Proles''. Note: This rank is not compliant with the current nomenclatural codes"; |
|
55 |
// String label = "Proles"; |
|
56 |
// String abbrev = "prol."; |
|
57 |
// String dtype = Rank.class.getSimpleName(); |
|
58 |
// boolean isOrdered = true; |
|
59 |
// UUID uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b"); |
|
60 |
// UUID uuidAfterTerm = UUID.fromString("bff22f84-553a-4429-a4e7-c4b3796c3a18"); |
|
61 |
// UUID uuidLang = Language.uuidEnglish; |
|
62 |
// RankClass rankClass = RankClass.Infraspecific; |
|
63 |
// String stepName = "Add 'proles' rank to ranks"; |
|
64 |
// TermType termType = TermType.Rank; |
|
65 |
// list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm).setRankClass(rankClass)); |
|
66 |
|
|
67 |
//there are some more new vocabularies, but we trust that the term initializer will |
|
68 |
//initialize and persist them correctly |
|
69 |
|
|
70 |
return list; |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public ITermUpdater getNextUpdater() { |
|
75 |
return TermUpdater_36_40.NewInstance(); |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public ITermUpdater getPreviousUpdater() { |
|
80 |
return TermUpdater_34_35.NewInstance(); |
|
81 |
} |
|
82 |
|
|
83 |
} |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v36_40/SchemaUpdater_36_40.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 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 |
|
|
11 |
package eu.etaxonomy.cdm.database.update.v36_40; |
|
12 |
|
|
13 |
import java.util.ArrayList; |
|
14 |
import java.util.List; |
|
15 |
|
|
16 |
import org.apache.log4j.Logger; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.database.update.ISchemaUpdater; |
|
19 |
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep; |
|
20 |
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase; |
|
21 |
import eu.etaxonomy.cdm.database.update.v35_36.SchemaUpdater_35_36; |
|
22 |
|
|
23 |
/** |
|
24 |
* @author a.mueller |
|
25 |
* @created 16.04.2016 |
|
26 |
*/ |
|
27 |
public class SchemaUpdater_36_40 extends SchemaUpdaterBase { |
|
28 |
|
|
29 |
@SuppressWarnings("unused") |
|
30 |
private static final Logger logger = Logger.getLogger(SchemaUpdater_36_40.class); |
|
31 |
private static final String endSchemaVersion = "4.0.0.0.201604200000"; |
|
32 |
private static final String startSchemaVersion = "3.6.0.0.201527040000"; |
|
33 |
|
|
34 |
// ********************** FACTORY METHOD ************************************* |
|
35 |
|
|
36 |
public static SchemaUpdater_36_40 NewInstance() { |
|
37 |
return new SchemaUpdater_36_40(); |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* @param startSchemaVersion |
|
42 |
* @param endSchemaVersion |
|
43 |
*/ |
|
44 |
protected SchemaUpdater_36_40() { |
|
45 |
super(startSchemaVersion, endSchemaVersion); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected List<ISchemaUpdaterStep> getUpdaterList() { |
|
50 |
|
|
51 |
String stepName; |
|
52 |
String tableName; |
|
53 |
ISchemaUpdaterStep step; |
|
54 |
// String columnName; |
|
55 |
String newColumnName; |
|
56 |
String oldColumnName; |
|
57 |
String columnNames[]; |
|
58 |
String referencedTables[]; |
|
59 |
String columnTypes[]; |
|
60 |
// boolean includeCdmBaseAttributes = false; |
|
61 |
|
|
62 |
List<ISchemaUpdaterStep> stepList = new ArrayList<ISchemaUpdaterStep>(); |
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
return stepList; |
|
67 |
} |
|
68 |
|
|
69 |
|
|
70 |
@Override |
|
71 |
public ISchemaUpdater getNextUpdater() { |
|
72 |
return null; |
|
73 |
} |
|
74 |
|
|
75 |
@Override |
|
76 |
public ISchemaUpdater getPreviousUpdater() { |
|
77 |
return SchemaUpdater_35_36.NewInstance(); |
|
78 |
} |
|
79 |
|
|
80 |
} |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v36_40/TermUpdater_36_40.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.v36_40; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import org.apache.log4j.Logger; |
|
16 |
|
|
17 |
import eu.etaxonomy.cdm.database.update.ITermUpdater; |
|
18 |
import eu.etaxonomy.cdm.database.update.ITermUpdaterStep; |
|
19 |
import eu.etaxonomy.cdm.database.update.TermUpdaterBase; |
|
20 |
import eu.etaxonomy.cdm.database.update.v35_36.TermUpdater_35_36; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author a.mueller |
|
24 |
* @date 16.04.2016 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public class TermUpdater_36_40 extends TermUpdaterBase { |
|
28 |
@SuppressWarnings("unused") |
|
29 |
private static final Logger logger = Logger.getLogger(TermUpdater_36_40.class); |
|
30 |
|
|
31 |
public static final String startTermVersion = "3.6.0.0.201527040000"; |
|
32 |
private static final String endTermVersion = "4.0.0.0.201604200000"; |
|
33 |
|
|
34 |
// *************************** FACTORY **************************************/ |
|
35 |
|
|
36 |
public static TermUpdater_36_40 NewInstance(){ |
|
37 |
return new TermUpdater_36_40(startTermVersion, endTermVersion); |
|
38 |
} |
|
39 |
|
|
40 |
// *************************** CONSTRUCTOR ***********************************/ |
|
41 |
|
|
42 |
protected TermUpdater_36_40(String startTermVersion, String endTermVersion) { |
|
43 |
super(startTermVersion, endTermVersion); |
|
44 |
} |
|
45 |
|
|
46 |
|
|
47 |
@Override |
|
48 |
protected List<ITermUpdaterStep> getUpdaterList() { |
|
49 |
List<ITermUpdaterStep> list = new ArrayList<ITermUpdaterStep>(); |
|
50 |
|
|
51 |
// // proles, #2793 |
|
52 |
// UUID uuidTerm = UUID.fromString("8810d1ba-6a34-4ae3-a355-919ccd1cd1a5"); |
|
53 |
// String description = "Rank ''Proles''. Note: This rank is not compliant with the current nomenclatural codes"; |
|
54 |
// String label = "Proles"; |
|
55 |
// String abbrev = "prol."; |
|
56 |
// String dtype = Rank.class.getSimpleName(); |
|
57 |
// boolean isOrdered = true; |
|
58 |
// UUID uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b"); |
|
59 |
// UUID uuidAfterTerm = UUID.fromString("bff22f84-553a-4429-a4e7-c4b3796c3a18"); |
|
60 |
// UUID uuidLang = Language.uuidEnglish; |
|
61 |
// RankClass rankClass = RankClass.Infraspecific; |
|
62 |
// String stepName = "Add 'proles' rank to ranks"; |
|
63 |
// TermType termType = TermType.Rank; |
|
64 |
// list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm).setRankClass(rankClass)); |
|
65 |
|
|
66 |
//there are some more new vocabularies, but we trust that the term initializer will |
|
67 |
//initialize and persist them correctly |
|
68 |
|
|
69 |
return list; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public ITermUpdater getNextUpdater() { |
|
74 |
return null; |
|
75 |
} |
|
76 |
|
|
77 |
@Override |
|
78 |
public ITermUpdater getPreviousUpdater() { |
|
79 |
return TermUpdater_35_36.NewInstance(); |
|
80 |
} |
|
81 |
|
|
82 |
} |
Also available in: Unified diff
Add base structure for model update to 4.0