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