1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.cdm.io.pesi.faunaEuropaea;
|
11
|
|
12
|
import java.sql.ResultSet;
|
13
|
import java.sql.SQLException;
|
14
|
import java.util.HashMap;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import org.apache.log4j.Logger;
|
18
|
|
19
|
import eu.etaxonomy.cdm.api.service.ITermService;
|
20
|
import eu.etaxonomy.cdm.model.common.DefinedTerm;
|
21
|
import eu.etaxonomy.cdm.model.common.Language;
|
22
|
import eu.etaxonomy.cdm.model.common.Representation;
|
23
|
import eu.etaxonomy.cdm.model.common.TermType;
|
24
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
|
25
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
26
|
import eu.etaxonomy.cdm.model.name.Rank;
|
27
|
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
|
28
|
|
29
|
/**
|
30
|
* @author a.babadshanjan
|
31
|
* @created 12.05.2009
|
32
|
* @version 1.0
|
33
|
*/
|
34
|
|
35
|
public final class FaunaEuropaeaTransformer {
|
36
|
private static final Logger logger = Logger.getLogger(FaunaEuropaeaTransformer.class);
|
37
|
|
38
|
// Query
|
39
|
public static final int Q_NO_RESTRICTION = -1;
|
40
|
|
41
|
// TaxonStatus
|
42
|
public static final int T_STATUS_ACCEPTED = 1;
|
43
|
public static final int T_STATUS_NOT_ACCEPTED = 0;
|
44
|
|
45
|
// Author
|
46
|
public static final int A_AUCT = 1;
|
47
|
public static final String A_AUCTNAME = "auct.";
|
48
|
|
49
|
// Parenthesis
|
50
|
public static final int P_PARENTHESIS = 1;
|
51
|
|
52
|
// User
|
53
|
|
54
|
public static final int U_ACTIVE = 1;
|
55
|
|
56
|
//new AbsencePresenceTermUUIDs
|
57
|
|
58
|
// Rank
|
59
|
public static final int R_KINGDOM = 1;
|
60
|
public static final int R_SUBKINGDOM = 2;
|
61
|
public static final int R_SUPERPHYLUM = 3;
|
62
|
public static final int R_PHYLUM = 4;
|
63
|
public static final int R_SUBPHYLUM = 5;
|
64
|
public static final int R_INFRAPHYLUM = 6;
|
65
|
public static final int R_CLASS = 7;
|
66
|
public static final int R_SUBCLASS = 8;
|
67
|
public static final int R_INFRACLASS = 9;
|
68
|
public static final int R_SUPERORDER = 10;
|
69
|
public static final int R_ORDER = 11;
|
70
|
public static final int R_SUBORDER = 12;
|
71
|
public static final int R_INFRAORDER = 13;
|
72
|
public static final int R_SUPERFAMILY = 14;
|
73
|
public static final int R_FAMILY = 15;
|
74
|
public static final int R_SUBFAMILY = 16;
|
75
|
public static final int R_TRIBE = 17;
|
76
|
public static final int R_SUBTRIBE = 18;
|
77
|
public static final int R_GENUS = 19;
|
78
|
public static final int R_SUBGENUS = 20;
|
79
|
public static final int R_SPECIES = 21;
|
80
|
public static final int R_SUBSPECIES = 22;
|
81
|
|
82
|
public static PresenceAbsenceTerm occStatus2PresenceAbsence(int occStatusId) throws UnknownCdmTypeException{
|
83
|
|
84
|
if (Integer.valueOf(occStatusId) == null) {
|
85
|
return PresenceAbsenceTerm.PRESENT();
|
86
|
}
|
87
|
switch (occStatusId){
|
88
|
case 0: return PresenceAbsenceTerm.PRESENT();
|
89
|
case 2: return PresenceAbsenceTerm.ABSENT();
|
90
|
case 1: return PresenceAbsenceTerm.PRESENT_DOUBTFULLY();
|
91
|
|
92
|
default: {
|
93
|
|
94
|
return null;
|
95
|
|
96
|
|
97
|
}
|
98
|
|
99
|
}
|
100
|
}
|
101
|
|
102
|
|
103
|
public static PresenceAbsenceTerm occStatus2PresenceAbsence_ (int occStatusId) throws UnknownCdmTypeException{
|
104
|
switch (occStatusId){
|
105
|
case 0: return null;
|
106
|
//case 110: return AbsenceTerm.CULTIVATED_REPORTED_IN_ERROR();
|
107
|
case 120: return PresenceAbsenceTerm.CULTIVATED();
|
108
|
// case 210: return AbsenceTerm.INTRODUCED_REPORTED_IN_ERROR();
|
109
|
case 220: return PresenceAbsenceTerm.INTRODUCED_PRESENCE_QUESTIONABLE();
|
110
|
case 230: return PresenceAbsenceTerm.INTRODUCED_FORMERLY_INTRODUCED();
|
111
|
case 240: return PresenceAbsenceTerm.INTRODUCED_DOUBTFULLY_INTRODUCED();
|
112
|
case 250: return PresenceAbsenceTerm.INTRODUCED();
|
113
|
case 260: return PresenceAbsenceTerm.INTRODUCED_UNCERTAIN_DEGREE_OF_NATURALISATION();
|
114
|
case 270: return PresenceAbsenceTerm.CASUAL();
|
115
|
case 280: return PresenceAbsenceTerm.NATURALISED();
|
116
|
//case 310: return AbsenceTerm.NATIVE_REPORTED_IN_ERROR();
|
117
|
case 320: return PresenceAbsenceTerm.NATIVE_PRESENCE_QUESTIONABLE();
|
118
|
case 330: return PresenceAbsenceTerm.NATIVE_FORMERLY_NATIVE();
|
119
|
case 340: return PresenceAbsenceTerm.NATIVE_DOUBTFULLY_NATIVE();
|
120
|
case 350: return PresenceAbsenceTerm.NATIVE();
|
121
|
case 999: {
|
122
|
logger.warn("endemic for EM can not be transformed in legal status");
|
123
|
//TODO preliminary
|
124
|
return PresenceAbsenceTerm.PRESENT();
|
125
|
}
|
126
|
default: {
|
127
|
throw new UnknownCdmTypeException("Unknown occurrence status (id=" + Integer.valueOf(occStatusId).toString() + ")");
|
128
|
}
|
129
|
}
|
130
|
}
|
131
|
|
132
|
|
133
|
public static Rank rankId2Rank (ResultSet rs, boolean useUnknown) throws UnknownCdmTypeException {
|
134
|
Rank result;
|
135
|
try {
|
136
|
int rankId = rs.getInt("rnk_id");
|
137
|
int parentRankId = rs.getInt("rnk_rnk_id");
|
138
|
String rankName = rs.getString("rnk_name");
|
139
|
String rankLatinName = rs.getString("rnk_latinname");
|
140
|
int rankCategory = rs.getInt("rnk_category");
|
141
|
|
142
|
if (logger.isDebugEnabled()) {
|
143
|
logger.debug(rankId + ", " + parentRankId + ", " + rankName + ", " + rankCategory);
|
144
|
}
|
145
|
|
146
|
try {
|
147
|
result = Rank.getRankByNameOrIdInVoc(rankName);
|
148
|
} catch (UnknownCdmTypeException e1) {
|
149
|
|
150
|
switch (rankId) {
|
151
|
case 0: return null;
|
152
|
case R_KINGDOM: return Rank.KINGDOM();
|
153
|
case R_SUBKINGDOM: return Rank.SUBKINGDOM();
|
154
|
case R_SUPERPHYLUM: return Rank.SUPERPHYLUM();
|
155
|
case R_PHYLUM: return Rank.PHYLUM();
|
156
|
case R_SUBPHYLUM: return Rank.SUBPHYLUM();
|
157
|
case R_INFRAPHYLUM: return Rank.INFRAPHYLUM();
|
158
|
case R_CLASS: return Rank.CLASS();
|
159
|
case R_SUBCLASS: return Rank.SUBCLASS();
|
160
|
case R_INFRACLASS: return Rank.INFRACLASS();
|
161
|
case R_SUPERORDER: return Rank.SUPERORDER();
|
162
|
case R_ORDER: return Rank.ORDER();
|
163
|
case R_SUBORDER: return Rank.SUBORDER();
|
164
|
case R_INFRAORDER: return Rank.INFRAORDER();
|
165
|
case R_SUPERFAMILY: return Rank.SUPERFAMILY();
|
166
|
case R_FAMILY: return Rank.FAMILY();
|
167
|
case R_SUBFAMILY: return Rank.SUBFAMILY();
|
168
|
case R_TRIBE: return Rank.TRIBE();
|
169
|
case R_SUBTRIBE: return Rank.SUBTRIBE();
|
170
|
case R_GENUS: return Rank.GENUS();
|
171
|
case R_SUBGENUS: return Rank.SUBGENUS();
|
172
|
case R_SPECIES: return Rank.SPECIES();
|
173
|
case R_SUBSPECIES: return Rank.SUBSPECIES();
|
174
|
|
175
|
default: {
|
176
|
if (useUnknown){
|
177
|
logger.error("Rank unknown. Created UNKNOWN_RANK");
|
178
|
return Rank.UNKNOWN_RANK();
|
179
|
}
|
180
|
throw new UnknownCdmTypeException("Unknown Rank id" + Integer.valueOf(rankId).toString());
|
181
|
}
|
182
|
}
|
183
|
}
|
184
|
return result;
|
185
|
} catch (SQLException e) {
|
186
|
e.printStackTrace();
|
187
|
logger.warn("Exception occurred. Created UNKNOWN_RANK instead");
|
188
|
return Rank.UNKNOWN_RANK();
|
189
|
}
|
190
|
}
|
191
|
|
192
|
|
193
|
// public static NamedArea areaId2TdwgArea (FaunaEuropaeaDistribution fauEuDistribution)
|
194
|
// throws UnknownCdmTypeException {
|
195
|
//
|
196
|
// NamedArea tdwgArea = null;
|
197
|
//
|
198
|
// try {
|
199
|
// int areaId = fauEuDistribution.getAreaId();
|
200
|
// String areaName = fauEuDistribution.getAreaName();
|
201
|
// String areaCode = fauEuDistribution.getAreaCode();
|
202
|
// int extraLimital = fauEuDistribution.getExtraLimital();
|
203
|
//
|
204
|
// //TODO: Verify mappings with comments. Those don't map to TDWG areas.
|
205
|
//
|
206
|
// if (areaCode.equals("AD")) {
|
207
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SPA-AN");
|
208
|
// } else if (areaCode.equals("AL")) {
|
209
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ALB-OO");
|
210
|
// } else if (areaCode.equals("AT")) {
|
211
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("AUT-AU");
|
212
|
// } else if (areaCode.equals("AUS")) {
|
213
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("AUS"); // Australian region - Australia
|
214
|
// } else if (areaCode.equals("BA")) {
|
215
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG-BH");
|
216
|
// } else if (areaCode.equals("BE")) {
|
217
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BGM-BE");
|
218
|
// } else if (areaCode.equals("BG")) {
|
219
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BUL-OO");
|
220
|
// } else if (areaCode.equals("BY")) {
|
221
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLR-OO");
|
222
|
// } else if (areaCode.equals("CH")) {
|
223
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SWI-OO");
|
224
|
// } else if (areaCode.equals("CY")) {
|
225
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("CYP-OO");
|
226
|
// } else if (areaCode.equals("CZ")) {
|
227
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("CZE-CZ");
|
228
|
// } else if (areaCode.equals("DE")) {
|
229
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("GER-OO");
|
230
|
// } else if (areaCode.equals("DK-DEN")) {
|
231
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("DEN-OO");
|
232
|
// } else if (areaCode.equals("DK-FOR")) {
|
233
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FOR-OO");
|
234
|
// } else if (areaCode.equals("EE")) {
|
235
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLT-ES");
|
236
|
// } else if (areaCode.equals("ES-BAL")) {
|
237
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BAL-OO");
|
238
|
// } else if (areaCode.equals("ES-CNY")) {
|
239
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("CNY-OO");
|
240
|
// } else if (areaCode.equals("ES-SPA")) {
|
241
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SPA-SP");
|
242
|
// } else if (areaCode.equals("FI")) {
|
243
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FIN-OO");
|
244
|
// } else if (areaCode.equals("FR-COR")) {
|
245
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("COR-OO");
|
246
|
// } else if (areaCode.equals("FR-FRA")) {
|
247
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FRA-FR");
|
248
|
// } else if (areaCode.equals("GB-CI")) {
|
249
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FRA-CI");
|
250
|
// } else if (areaCode.equals("GB-GI")) {
|
251
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SPA-GI");
|
252
|
// } else if (areaCode.equals("GB-GRB")) {
|
253
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("GRB-OO");
|
254
|
// } else if (areaCode.equals("GB-NI")) {
|
255
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("IRE-NI");
|
256
|
// } else if (areaCode.equals("GR-GRC")) {
|
257
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("GRC-OO");
|
258
|
// } else if (areaCode.equals("HR")) {
|
259
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG-CR");
|
260
|
// } else if (areaCode.equals("HU")) {
|
261
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("HUN-OO");
|
262
|
// } else if (areaCode.equals("IE")) {
|
263
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("IRE-IR");
|
264
|
// } else if (areaCode.equals("IS")) {
|
265
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ICE-OO");
|
266
|
// } else if (areaCode.equals("IT-ITA")) {
|
267
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ITA-IT");
|
268
|
// } else if (areaCode.equals("IT-SAR")) {
|
269
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SAR-OO");
|
270
|
// } else if (areaCode.equals("IT-SI")) {
|
271
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SIC-SI");
|
272
|
// } else if (areaCode.equals("LI")) {
|
273
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("AUT-LI");
|
274
|
// } else if (areaCode.equals("LT")) {
|
275
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLT-LI");
|
276
|
// } else if (areaCode.equals("LU")) {
|
277
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BGM-LU");
|
278
|
// } else if (areaCode.equals("LV")) {
|
279
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLT-LA");
|
280
|
// } else if (areaCode.equals("MC")) {
|
281
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FRA-MO");
|
282
|
// } else if (areaCode.equals("MD")) {
|
283
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("UKR-MO");
|
284
|
// } else if (areaCode.equals("MK")) {
|
285
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG-MA");
|
286
|
// } else if (areaCode.equals("MT")) {
|
287
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SIC-MA");
|
288
|
// } else if (areaCode.equals("NL")) {
|
289
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("NET-OO");
|
290
|
// } else if (areaCode.equals("NO-NOR")) {
|
291
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("NOR-OO");
|
292
|
// } else if (areaCode.equals("NO-SVA")) {
|
293
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SVA-OO");
|
294
|
// } else if (areaCode.equals("PL")) {
|
295
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("POL-OO");
|
296
|
// } else if (areaCode.equals("PT-AZO")) {
|
297
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("AZO-OO");
|
298
|
// } else if (areaCode.equals("PT-MDR")) {
|
299
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("MDR-OO");
|
300
|
// } else if (areaCode.equals("PT-POR")) {
|
301
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("POR-OO");
|
302
|
// } else if (areaCode.equals("PT-SEL")) {
|
303
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SEL-OO");
|
304
|
// } else if (areaCode.equals("RO")) {
|
305
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ROM-OO");
|
306
|
// } else if (areaCode.equals("RU-KGD")) {
|
307
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLT-KA");
|
308
|
// } else if (areaCode.equals("RU-RUC")) {
|
309
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUC-OO");
|
310
|
// } else if (areaCode.equals("RU-RUE")) {
|
311
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUE-OO");
|
312
|
// } else if (areaCode.equals("RU-RUN")) {
|
313
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUN-OO");
|
314
|
// } else if (areaCode.equals("RU-RUS")) {
|
315
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUS-OO");
|
316
|
// } else if (areaCode.equals("RU-RUW")) {
|
317
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUW-OO");
|
318
|
// } else if (areaCode.equals("SE")) {
|
319
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SWE-OO");
|
320
|
// } else if (areaCode.equals("SI")) {
|
321
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG-SL");
|
322
|
// } else if (areaCode.equals("SK")) {
|
323
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("CZE-SK");
|
324
|
// } else if (areaCode.equals("SM")) {
|
325
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ITA-SM");
|
326
|
// } else if (areaCode.equals("TR-TUE")) {
|
327
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("TUE-OO");
|
328
|
// }else if (areaCode.equals("UA")) {
|
329
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("UKR-UK"); //UKraine including Crimea
|
330
|
// } else if (areaCode.equals("VA")) {
|
331
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ITA-VC");
|
332
|
// } else if (areaCode.equals("YU")) {
|
333
|
// tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG");
|
334
|
// } else {
|
335
|
// throw new UnknownCdmTypeException("Unknown Area " + areaCode);
|
336
|
// }
|
337
|
//
|
338
|
// if (logger.isDebugEnabled()) {
|
339
|
// logger.debug(areaId + ", " + areaName + ", " + areaCode + ", " + extraLimital);
|
340
|
// }
|
341
|
//
|
342
|
// } catch (Exception e) {
|
343
|
// //e.printStackTrace();
|
344
|
// logger.debug("Exception occurred. Area could not be mapped." + fauEuDistribution.getAreaName());
|
345
|
// return null;
|
346
|
// }
|
347
|
//
|
348
|
// return tdwgArea;
|
349
|
// }
|
350
|
|
351
|
// public static UUID uuidAreaAUS = UUID.fromString("cf979ca8-8cb6-42df-b2ce-1f432ec7c26b");
|
352
|
// public static UUID uuidAreaAFR = UUID.fromString("07ac5e75-9fc9-4aa0-938c-1324c9618b97");
|
353
|
// public static UUID uuidAreaEPA = UUID.fromString("e83446d7-7379-4beb-be05-295f8da6f5ae");
|
354
|
// public static UUID uuidAreaGR_AEG = UUID.fromString("6bd422aa-9911-4b80-8595-0f6d1ecd5eee");
|
355
|
// public static UUID uuidAreaGR_CYC = UUID.fromString("8e7d7f1e-3e4d-4f7c-96ec-93ec91e528d6");
|
356
|
// public static UUID uuidAreaGR_DOD = UUID.fromString("6d6f6842-924e-440b-9e7e-3df1922bf4a6");
|
357
|
// public static UUID uuidAreaNAF = UUID.fromString("d2c54b1e-5f9f-455d-b308-6859cb153c7b");
|
358
|
// public static UUID uuidAreaNEA = UUID.fromString("aa87f6b8-110b-44b5-a329-91a08f1a4cc9");
|
359
|
// public static UUID uuidAreaNEO = UUID.fromString("0e6e0ce9-c6ab-46bc-80b9-aee4a0620e78");
|
360
|
// public static UUID uuidAreaNRE = UUID.fromString("d51876c2-eaf6-4c7f-963e-337dd3e0d729");
|
361
|
// public static UUID uuidAreaORR = UUID.fromString("04cab4f8-b316-4e21-9bcc-236a45e4e83d");
|
362
|
// public static UUID uuidAreaGR_CR = UUID.fromString("2ef9fa6c-7c3f-431a-96c9-5980c55fc440");
|
363
|
// public static UUID uuidAreaGR_GRC = UUID.fromString("b5d33c78-91e7-467a-9c2d-6c337b78d31a");
|
364
|
// public static UUID uuidAreaUA = UUID.fromString("859cf055-a208-4f30-8e6e-361f165c6fa9");
|
365
|
// public static UUID uuidAreaRU_FJL = UUID.fromString("84671068-2f18-40cb-933a-e7e1c0e37cc8");
|
366
|
// public static UUID uuidAreaRU_NOZ = UUID.fromString("64cce0aa-0222-4740-8fa2-dbf0330e9266");
|
367
|
|
368
|
|
369
|
|
370
|
// public final static HashMap<String, UUID> abbrToUUID = new HashMap<String,UUID>();
|
371
|
// static
|
372
|
// {
|
373
|
// abbrToUUID.put("AUS", uuidAreaAUS);
|
374
|
// abbrToUUID.put("AFR", uuidAreaAFR);
|
375
|
// abbrToUUID.put("EPA", uuidAreaEPA);
|
376
|
// abbrToUUID.put("GR-AEG", uuidAreaGR_AEG);
|
377
|
// abbrToUUID.put("GR-CYC", uuidAreaGR_CYC);
|
378
|
// abbrToUUID.put("GR-DOD", uuidAreaGR_DOD);
|
379
|
// abbrToUUID.put("NAF", uuidAreaNAF);
|
380
|
// abbrToUUID.put("NEA", uuidAreaNEA);
|
381
|
// abbrToUUID.put("NEO", uuidAreaNEO);
|
382
|
// abbrToUUID.put("NRE", uuidAreaNRE);
|
383
|
// abbrToUUID.put("ORR", uuidAreaORR);
|
384
|
// abbrToUUID.put("GR-KRI", uuidAreaGR_CR);
|
385
|
// abbrToUUID.put("GR-GRC", uuidAreaGR_GRC);
|
386
|
// abbrToUUID.put("UA", uuidAreaUA);
|
387
|
// abbrToUUID.put("RU-FJL", uuidAreaRU_FJL);
|
388
|
// abbrToUUID.put("RU-NOZ", uuidAreaRU_NOZ);
|
389
|
//
|
390
|
//
|
391
|
// }
|
392
|
|
393
|
|
394
|
|
395
|
public final static HashMap<Integer, Language> languageFK2Language = new HashMap<Integer,Language>();
|
396
|
static
|
397
|
{
|
398
|
languageFK2Language.put(1, Language.ALBANIAN());
|
399
|
languageFK2Language.put(4, Language.AZERBAIJANI());
|
400
|
languageFK2Language.put(6, Language.BULGARIAN());
|
401
|
languageFK2Language.put(10, Language.DANISH());
|
402
|
languageFK2Language.put(11, Language.DUTCH_MIDDLE());
|
403
|
languageFK2Language.put(12, Language.ENGLISH());
|
404
|
languageFK2Language.put(16, Language.FRENCH());
|
405
|
|
406
|
languageFK2Language.put(18, Language.GERMAN());
|
407
|
languageFK2Language.put(19, Language.GREEK_MODERN());
|
408
|
languageFK2Language.put(23, Language.HEBREW());
|
409
|
languageFK2Language.put(24, Language.ITALIAN());
|
410
|
languageFK2Language.put(26, Language.LITHUANIAN());
|
411
|
languageFK2Language.put(30, Language.NORWEGIAN());
|
412
|
languageFK2Language.put(31, Language.POLISH());
|
413
|
languageFK2Language.put(34, Language.RUSSIAN());
|
414
|
languageFK2Language.put(54, Language.SLOVAK());
|
415
|
languageFK2Language.put(55, Language.SLOVENIAN());
|
416
|
languageFK2Language.put(57, Language.SWEDISH());
|
417
|
languageFK2Language.put(58, Language.TURKISH());
|
418
|
|
419
|
languageFK2Language.put(59, Language.UKRAINIAN());
|
420
|
languageFK2Language.put(60, Language.WELSH());
|
421
|
languageFK2Language.put(62, Language.GALICIAN());
|
422
|
//languageFK2Language.put(83, getEnglishUS());
|
423
|
languageFK2Language.put(97, Language.IRISH());
|
424
|
|
425
|
|
426
|
languageFK2Language.put(100, Language.NORWEGIAN_BOKMOL());
|
427
|
languageFK2Language.put(101, Language.NORWEGIAN_NYNORSK());
|
428
|
|
429
|
languageFK2Language.put(102, Language.ARABIC());
|
430
|
languageFK2Language.put(103, Language.ARMENIAN());
|
431
|
|
432
|
languageFK2Language.put(104, Language.CATALAN_VALENCIAN());
|
433
|
languageFK2Language.put(105, Language.CHINESE());
|
434
|
languageFK2Language.put(106, Language.ESTONIAN());
|
435
|
languageFK2Language.put(107, Language.FINNISH());
|
436
|
|
437
|
languageFK2Language.put(108, Language.GAELIC_SCOTTISH_GAELIC());
|
438
|
languageFK2Language.put(109, Language.JAPANESE());
|
439
|
languageFK2Language.put(110, Language.KOREAN());
|
440
|
languageFK2Language.put(111, Language.LATIN());
|
441
|
languageFK2Language.put(112, Language.LATVIAN());
|
442
|
languageFK2Language.put(113, Language.PERSIAN());
|
443
|
languageFK2Language.put(114, Language.PORTUGUESE());
|
444
|
languageFK2Language.put(115, Language.ROMANIAN());
|
445
|
languageFK2Language.put(116, Language.GAELIC_SCOTTISH_GAELIC());
|
446
|
languageFK2Language.put(117, Language.SWAHILI());
|
447
|
languageFK2Language.put(118, Language.SPANISH_CASTILIAN());
|
448
|
|
449
|
|
450
|
|
451
|
|
452
|
|
453
|
}
|
454
|
// public static UUID getUUIDByAreaAbbr(String abbr){
|
455
|
// return abbrToUUID.get(abbr);
|
456
|
// }
|
457
|
|
458
|
public static UUID uuidNomStatusTempNamed = UUID.fromString("aa6ada5a-ca21-4fef-b76f-9ae237e9c4ae");
|
459
|
|
460
|
static NomenclaturalStatusType nomStatusTempNamed;
|
461
|
|
462
|
private static DefinedTerm taxonomicSpecialistType;
|
463
|
|
464
|
private static UUID uuidTaxonomicSpecialistType = UUID.fromString("006879e4-cf99-405a-a720-2e81d9cbc34c");
|
465
|
|
466
|
private static DefinedTerm groupCoordinatorType;
|
467
|
|
468
|
private static UUID uuidGroupCoordinatorType = UUID.fromString("3a827ebe-4410-40e5-a241-941b17028e11");
|
469
|
|
470
|
private static DefinedTerm associateSpecialistType;
|
471
|
|
472
|
private static UUID uuidAssociateSpecialistType = UUID.fromString("8258f73c-e0ad-4f87-a88c-53c58c08bba9");
|
473
|
|
474
|
private static Language langEnglishUS;
|
475
|
|
476
|
private static UUID uuidEnglishUS;
|
477
|
|
478
|
|
479
|
|
480
|
public static NomenclaturalStatusType getNomStatusTempNamed(ITermService termService){
|
481
|
if (nomStatusTempNamed == null){
|
482
|
nomStatusTempNamed = (NomenclaturalStatusType)termService.find(uuidNomStatusTempNamed);
|
483
|
if (nomStatusTempNamed == null){
|
484
|
nomStatusTempNamed = NomenclaturalStatusType.NewInstance("temporary named", "temporary named", "temp. named", Language.ENGLISH());
|
485
|
Representation repLatin = Representation.NewInstance("", "", "", Language.LATIN());
|
486
|
nomStatusTempNamed.addRepresentation(repLatin);
|
487
|
nomStatusTempNamed.setUuid(uuidNomStatusTempNamed);
|
488
|
NomenclaturalStatusType.ALTERNATIVE().getVocabulary().addTerm(nomStatusTempNamed);
|
489
|
termService.save(nomStatusTempNamed);
|
490
|
}
|
491
|
}
|
492
|
return nomStatusTempNamed;
|
493
|
}
|
494
|
|
495
|
public static Language getEnglishUS(ITermService termService){
|
496
|
if (langEnglishUS == null){
|
497
|
langEnglishUS = (Language)termService.find(uuidEnglishUS);
|
498
|
if (langEnglishUS == null){
|
499
|
logger.info("create language english-us");
|
500
|
langEnglishUS = Language.NewInstance("english-United States", "english-US", "eng-US");
|
501
|
langEnglishUS.setUuid(uuidEnglishUS);
|
502
|
|
503
|
langEnglishUS = (Language)termService.save(langEnglishUS);
|
504
|
languageFK2Language.put(83, langEnglishUS);
|
505
|
}
|
506
|
}
|
507
|
return langEnglishUS;
|
508
|
}
|
509
|
/**
|
510
|
* @return
|
511
|
*/
|
512
|
public static DefinedTerm getTaxonomicSpecialistType(ITermService termService) {
|
513
|
if (taxonomicSpecialistType == null){
|
514
|
taxonomicSpecialistType = (DefinedTerm)termService.find(uuidTaxonomicSpecialistType);
|
515
|
if (taxonomicSpecialistType == null){
|
516
|
logger.info("create taxonomic specialist type");
|
517
|
taxonomicSpecialistType = DefinedTerm.NewInstance(TermType.TaxonNodeAgentRelationType, "taxonomic specialist", "taxonomic specialist", "TS");
|
518
|
|
519
|
taxonomicSpecialistType.setUuid(uuidTaxonomicSpecialistType);
|
520
|
|
521
|
termService.save(taxonomicSpecialistType);
|
522
|
}
|
523
|
}
|
524
|
return taxonomicSpecialistType;
|
525
|
}
|
526
|
/**
|
527
|
* @return
|
528
|
*/
|
529
|
public static DefinedTerm getGroupCoordinatorType(ITermService termService) {
|
530
|
if (groupCoordinatorType == null){
|
531
|
groupCoordinatorType = (DefinedTerm)termService.find(uuidGroupCoordinatorType);
|
532
|
if (groupCoordinatorType == null){
|
533
|
groupCoordinatorType = DefinedTerm.NewInstance(TermType.TaxonNodeAgentRelationType, "group coordinator", "group coordinator", "GC");
|
534
|
|
535
|
groupCoordinatorType.setUuid(uuidGroupCoordinatorType);
|
536
|
|
537
|
termService.save(groupCoordinatorType);
|
538
|
}
|
539
|
}
|
540
|
return groupCoordinatorType;
|
541
|
}
|
542
|
|
543
|
|
544
|
|
545
|
/**
|
546
|
* @return
|
547
|
*/
|
548
|
public static DefinedTerm getAssociateSpecialistType(ITermService termService) {
|
549
|
if (associateSpecialistType == null){
|
550
|
associateSpecialistType = (DefinedTerm)termService.find(uuidAssociateSpecialistType);
|
551
|
if (associateSpecialistType == null){
|
552
|
associateSpecialistType = DefinedTerm.NewInstance(TermType.TaxonNodeAgentRelationType, "associate specialist", "associate specialist", "AS");
|
553
|
|
554
|
associateSpecialistType.setUuid(uuidAssociateSpecialistType);
|
555
|
|
556
|
termService.save(associateSpecialistType);
|
557
|
}
|
558
|
}
|
559
|
return associateSpecialistType;
|
560
|
}
|
561
|
public static Language langFK2Language(
|
562
|
Integer languageFk) {
|
563
|
|
564
|
Language result = languageFK2Language.get(languageFk);
|
565
|
|
566
|
return result;
|
567
|
}
|
568
|
|
569
|
|
570
|
}
|