Project

General

Profile

Download (22.2 KB) Statistics
| Branch: | Revision:
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.io.common.TdwgAreaProvider;
21
import eu.etaxonomy.cdm.model.common.DefinedTerm;
22
import eu.etaxonomy.cdm.model.common.Language;
23
import eu.etaxonomy.cdm.model.common.Representation;
24
import eu.etaxonomy.cdm.model.common.TermType;
25
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
26
import eu.etaxonomy.cdm.model.location.NamedArea;
27
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
28
import eu.etaxonomy.cdm.model.name.Rank;
29
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
30

    
31
/**
32
 * @author a.babadshanjan
33
 * @created 12.05.2009
34
 * @version 1.0
35
 */
36

    
37
public final class FaunaEuropaeaTransformer {
38
	private static final Logger logger = Logger.getLogger(FaunaEuropaeaTransformer.class);
39

    
40
	// Query
41
	public static final int Q_NO_RESTRICTION = -1;
42

    
43
	// TaxonStatus
44
	public static final int T_STATUS_ACCEPTED = 1;
45
	public static final int T_STATUS_NOT_ACCEPTED = 0;
46

    
47
	// Author
48
	public static final int A_AUCT = 1;
49
	public static final String A_AUCTNAME = "auct.";
50

    
51
	// Parenthesis
52
	public static final int P_PARENTHESIS = 1;
53

    
54
	// User
55

    
56
	public static final int U_ACTIVE = 1;
57

    
58
	//new AbsencePresenceTermUUIDs
59

    
60
	public static UUID noData;
61
	//public static UUID doubtfull_present;
62

    
63
	// Rank
64
	public static final int R_KINGDOM = 1;
65
	public static final int R_SUBKINGDOM = 2;
66
	public static final int R_SUPERPHYLUM = 3;
67
	public static final int R_PHYLUM = 4;
68
	public static final int R_SUBPHYLUM = 5;
69
	public static final int R_INFRAPHYLUM = 6;
70
	public static final int R_CLASS = 7;
71
	public static final int R_SUBCLASS = 8;
72
	public static final int R_INFRACLASS = 9;
73
	public static final int R_SUPERORDER = 10;
74
	public static final int R_ORDER = 11;
75
	public static final int R_SUBORDER = 12;
76
	public static final int R_INFRAORDER = 13;
77
	public static final int R_SUPERFAMILY = 14;
78
	public static final int R_FAMILY = 15;
79
	public static final int R_SUBFAMILY = 16;
80
	public static final int R_TRIBE = 17;
81
	public static final int R_SUBTRIBE = 18;
82
	public static final int R_GENUS = 19;
83
	public static final int R_SUBGENUS = 20;
84
	public static final int R_SPECIES = 21;
85
	public static final int R_SUBSPECIES = 22;
86

    
87
	public static PresenceAbsenceTerm occStatus2PresenceAbsence(int occStatusId)  throws UnknownCdmTypeException{
88

    
89
		if (Integer.valueOf(occStatusId) == null) {
90
			return PresenceAbsenceTerm.PRESENT();
91
		}
92
		switch (occStatusId){
93
		case 0: return PresenceAbsenceTerm.PRESENT();
94
		case 2: return PresenceAbsenceTerm.ABSENT();
95
		case 1: return PresenceAbsenceTerm.PRESENT_DOUBTFULLY();
96

    
97
		default: {
98

    
99
			return null;
100

    
101

    
102
		}
103

    
104
	}
105
	}
106
	public static void setUUIDs(UUID uuid){
107
		noData = uuid;
108
		//doubtfull_present = uuids.get("doubtfullPresent");
109

    
110
	}
111

    
112
	public static PresenceAbsenceTerm occStatus2PresenceAbsence_ (int occStatusId)  throws UnknownCdmTypeException{
113
		switch (occStatusId){
114
			case 0: return null;
115
			//case 110: return AbsenceTerm.CULTIVATED_REPORTED_IN_ERROR();
116
			case 120: return PresenceAbsenceTerm.CULTIVATED();
117
		//	case 210: return AbsenceTerm.INTRODUCED_REPORTED_IN_ERROR();
118
			case 220: return PresenceAbsenceTerm.INTRODUCED_PRESENCE_QUESTIONABLE();
119
			case 230: return PresenceAbsenceTerm.INTRODUCED_FORMERLY_INTRODUCED();
120
			case 240: return PresenceAbsenceTerm.INTRODUCED_DOUBTFULLY_INTRODUCED();
121
			case 250: return PresenceAbsenceTerm.INTRODUCED();
122
			case 260: return PresenceAbsenceTerm.INTRODUCED_UNCERTAIN_DEGREE_OF_NATURALISATION();
123
			case 270: return PresenceAbsenceTerm.INTRODUCED_ADVENTITIOUS();
124
			case 280: return PresenceAbsenceTerm.INTRODUCED_NATURALIZED();
125
			//case 310: return AbsenceTerm.NATIVE_REPORTED_IN_ERROR();
126
			case 320: return PresenceAbsenceTerm.NATIVE_PRESENCE_QUESTIONABLE();
127
			case 330: return PresenceAbsenceTerm.NATIVE_FORMERLY_NATIVE();
128
			case 340: return PresenceAbsenceTerm.NATIVE_DOUBTFULLY_NATIVE();
129
			case 350: return PresenceAbsenceTerm.NATIVE();
130
			case 999: {
131
					logger.warn("endemic for EM can not be transformed in legal status");
132
					//TODO preliminary
133
					return PresenceAbsenceTerm.PRESENT();
134
				}
135
			default: {
136
				throw new UnknownCdmTypeException("Unknown occurrence status  (id=" + Integer.valueOf(occStatusId).toString() + ")");
137
			}
138
		}
139
	}
140

    
141

    
142
	public static Rank rankId2Rank (ResultSet rs, boolean useUnknown) throws UnknownCdmTypeException {
143
		Rank result;
144
		try {
145
			int rankId = rs.getInt("rnk_id");
146
			int parentRankId = rs.getInt("rnk_rnk_id");
147
			String rankName = rs.getString("rnk_name");
148
			String rankLatinName = rs.getString("rnk_latinname");
149
			int rankCategory = rs.getInt("rnk_category");
150

    
151
			if (logger.isDebugEnabled()) {
152
				logger.debug(rankId + ", " + parentRankId + ", " + rankName + ", " + rankCategory);
153
			}
154

    
155
			try {
156
				result = Rank.getRankByNameOrIdInVoc(rankName);
157
			} catch (UnknownCdmTypeException e1) {
158

    
159
				switch (rankId) {
160
				case 0: return null;
161
				case R_KINGDOM: return Rank.KINGDOM();
162
				case R_SUBKINGDOM: return Rank.SUBKINGDOM();
163
				case R_SUPERPHYLUM: return Rank.SUPERPHYLUM();
164
				case R_PHYLUM: return Rank.PHYLUM();
165
				case R_SUBPHYLUM: return Rank.SUBPHYLUM();
166
				case R_INFRAPHYLUM: return Rank.INFRAPHYLUM();
167
				case R_CLASS: return Rank.CLASS();
168
				case R_SUBCLASS: return Rank.SUBCLASS();
169
				case R_INFRACLASS: return Rank.INFRACLASS();
170
				case R_SUPERORDER: return Rank.SUPERORDER();
171
				case R_ORDER: return Rank.ORDER();
172
				case R_SUBORDER: return Rank.SUBORDER();
173
				case R_INFRAORDER: return Rank.INFRAORDER();
174
				case R_SUPERFAMILY: return Rank.SUPERFAMILY();
175
				case R_FAMILY: return Rank.FAMILY();
176
				case R_SUBFAMILY: return Rank.SUBFAMILY();
177
				case R_TRIBE: return Rank.TRIBE();
178
				case R_SUBTRIBE: return Rank.SUBTRIBE();
179
				case R_GENUS: return Rank.GENUS();
180
				case R_SUBGENUS: return Rank.SUBGENUS();
181
				case R_SPECIES: return Rank.SPECIES();
182
				case R_SUBSPECIES: return Rank.SUBSPECIES();
183

    
184
				default: {
185
					if (useUnknown){
186
						logger.error("Rank unknown. Created UNKNOWN_RANK");
187
						return Rank.UNKNOWN_RANK();
188
					}
189
					throw new UnknownCdmTypeException("Unknown Rank id" + Integer.valueOf(rankId).toString());
190
				}
191
				}
192
			}
193
			return result;
194
		} catch (SQLException e) {
195
			e.printStackTrace();
196
			logger.warn("Exception occurred. Created UNKNOWN_RANK instead");
197
			return Rank.UNKNOWN_RANK();
198
		}
199
	}
200

    
201

    
202
	public static NamedArea areaId2TdwgArea (FaunaEuropaeaDistribution fauEuDistribution)
203
	throws UnknownCdmTypeException {
204

    
205
		NamedArea tdwgArea = null;
206

    
207
		try {
208
			int areaId = fauEuDistribution.getAreaId();
209
			String areaName = fauEuDistribution.getAreaName();
210
			String areaCode = fauEuDistribution.getAreaCode();
211
			int extraLimital = fauEuDistribution.getExtraLimital();
212

    
213
			//TODO: Verify mappings with comments. Those don't map to TDWG areas.
214

    
215
			if (areaCode.equals("AD")) {
216
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SPA-AN");
217
            } else if (areaCode.equals("AL")) {
218
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ALB-OO");
219
            } else if (areaCode.equals("AT")) {
220
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("AUT-AU");
221
            } else if (areaCode.equals("AUS")) {
222
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("AUS"); // Australian region - Australia
223
            } else if (areaCode.equals("BA")) {
224
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG-BH");
225
            } else if (areaCode.equals("BE")) {
226
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BGM-BE");
227
            } else if (areaCode.equals("BG")) {
228
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BUL-OO");
229
            } else if (areaCode.equals("BY")) {
230
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLR-OO");
231
            } else if (areaCode.equals("CH")) {
232
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SWI-OO");
233
            } else if (areaCode.equals("CY")) {
234
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("CYP-OO");
235
            } else if (areaCode.equals("CZ")) {
236
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("CZE-CZ");
237
            } else if (areaCode.equals("DE")) {
238
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("GER-OO");
239
            } else if (areaCode.equals("DK-DEN")) {
240
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("DEN-OO");
241
            } else if (areaCode.equals("DK-FOR")) {
242
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FOR-OO");
243
            } else if (areaCode.equals("EE")) {
244
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLT-ES");
245
            } else if (areaCode.equals("ES-BAL")) {
246
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BAL-OO");
247
            } else if (areaCode.equals("ES-CNY")) {
248
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("CNY-OO");
249
            } else if (areaCode.equals("ES-SPA")) {
250
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SPA-SP");
251
            } else if (areaCode.equals("FI")) {
252
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FIN-OO");
253
            } else if (areaCode.equals("FR-COR")) {
254
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("COR-OO");
255
            } else if (areaCode.equals("FR-FRA")) {
256
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FRA-FR");
257
            } else if (areaCode.equals("GB-CI")) {
258
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FRA-CI");
259
            } else if (areaCode.equals("GB-GI")) {
260
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SPA-GI");
261
            } else if (areaCode.equals("GB-GRB")) {
262
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("GRB-OO");
263
            } else if (areaCode.equals("GB-NI")) {
264
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("IRE-NI");
265
            } else if (areaCode.equals("GR-GRC")) {
266
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("GRC-OO");
267
            } else if (areaCode.equals("HR")) {
268
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG-CR");
269
            } else if (areaCode.equals("HU")) {
270
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("HUN-OO");
271
            } else if (areaCode.equals("IE")) {
272
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("IRE-IR");
273
            } else if (areaCode.equals("IS")) {
274
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ICE-OO");
275
            } else if (areaCode.equals("IT-ITA")) {
276
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ITA-IT");
277
            } else if (areaCode.equals("IT-SAR")) {
278
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SAR-OO");
279
            } else if (areaCode.equals("IT-SI")) {
280
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SIC-SI");
281
            } else if (areaCode.equals("LI")) {
282
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("AUT-LI");
283
            } else if (areaCode.equals("LT")) {
284
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLT-LI");
285
            } else if (areaCode.equals("LU")) {
286
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BGM-LU");
287
            } else if (areaCode.equals("LV")) {
288
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLT-LA");
289
            } else if (areaCode.equals("MC")) {
290
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("FRA-MO");
291
            } else if (areaCode.equals("MD")) {
292
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("UKR-MO");
293
            } else if (areaCode.equals("MK")) {
294
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG-MA");
295
            } else if (areaCode.equals("MT")) {
296
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SIC-MA");
297
            } else if (areaCode.equals("NL")) {
298
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("NET-OO");
299
            } else if (areaCode.equals("NO-NOR")) {
300
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("NOR-OO");
301
            } else if (areaCode.equals("NO-SVA")) {
302
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SVA-OO");
303
            } else if (areaCode.equals("PL")) {
304
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("POL-OO");
305
            } else if (areaCode.equals("PT-AZO")) {
306
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("AZO-OO");
307
            } else if (areaCode.equals("PT-MDR")) {
308
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("MDR-OO");
309
            } else if (areaCode.equals("PT-POR")) {
310
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("POR-OO");
311
            } else if (areaCode.equals("PT-SEL")) {
312
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SEL-OO");
313
            } else if (areaCode.equals("RO")) {
314
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ROM-OO");
315
            } else if (areaCode.equals("RU-KGD")) {
316
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("BLT-KA");
317
            } else if (areaCode.equals("RU-RUC")) {
318
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUC-OO");
319
            } else if (areaCode.equals("RU-RUE")) {
320
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUE-OO");
321
            } else if (areaCode.equals("RU-RUN")) {
322
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUN-OO");
323
            } else if (areaCode.equals("RU-RUS")) {
324
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUS-OO");
325
            } else if (areaCode.equals("RU-RUW")) {
326
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("RUW-OO");
327
            } else if (areaCode.equals("SE")) {
328
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("SWE-OO");
329
            } else if (areaCode.equals("SI")) {
330
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG-SL");
331
            } else if (areaCode.equals("SK")) {
332
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("CZE-SK");
333
            } else if (areaCode.equals("SM")) {
334
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ITA-SM");
335
            } else if (areaCode.equals("TR-TUE")) {
336
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("TUE-OO");
337
                //else if (areaCode.equals("UA")) tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("UKR-UK"); //UKraine including Crimea
338
            } else if (areaCode.equals("VA")) {
339
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("ITA-VC");
340
            } else if (areaCode.equals("YU")) {
341
                tdwgArea = TdwgAreaProvider.getAreaByTdwgAbbreviation("YUG");
342
            } else {
343
                throw new UnknownCdmTypeException("Unknown Area " + areaCode);
344
            }
345

    
346
			if (logger.isDebugEnabled()) {
347
				logger.debug(areaId + ", " + areaName + ", " + areaCode + ", " + extraLimital);
348
			}
349

    
350
		} catch (Exception e) {
351
			//e.printStackTrace();
352
			logger.debug("Exception occurred. Area could not be mapped." + fauEuDistribution.getAreaName());
353
			return null;
354
		}
355

    
356
		return tdwgArea;
357
	}
358

    
359
	public static UUID uuidAreaAUS = UUID.fromString("cf979ca8-8cb6-42df-b2ce-1f432ec7c26b");
360
	public static UUID uuidAreaAFR = UUID.fromString("07ac5e75-9fc9-4aa0-938c-1324c9618b97");
361
	public static UUID uuidAreaEPA = UUID.fromString("e83446d7-7379-4beb-be05-295f8da6f5ae");
362
	public static UUID uuidAreaGR_AEG = UUID.fromString("6bd422aa-9911-4b80-8595-0f6d1ecd5eee");
363
	public static UUID uuidAreaGR_CYC = UUID.fromString("8e7d7f1e-3e4d-4f7c-96ec-93ec91e528d6");
364
	public static UUID uuidAreaGR_DOD = UUID.fromString("6d6f6842-924e-440b-9e7e-3df1922bf4a6");
365
	public static UUID uuidAreaNAF = UUID.fromString("d2c54b1e-5f9f-455d-b308-6859cb153c7b");
366
	public static UUID uuidAreaNEA = UUID.fromString("aa87f6b8-110b-44b5-a329-91a08f1a4cc9");
367
	public static UUID uuidAreaNEO = UUID.fromString("0e6e0ce9-c6ab-46bc-80b9-aee4a0620e78");
368
	public static UUID uuidAreaNRE = UUID.fromString("d51876c2-eaf6-4c7f-963e-337dd3e0d729");
369
	public static UUID uuidAreaORR = UUID.fromString("04cab4f8-b316-4e21-9bcc-236a45e4e83d");
370
	public static UUID uuidAreaGR_CR = UUID.fromString("2ef9fa6c-7c3f-431a-96c9-5980c55fc440");
371
	public static UUID uuidAreaGR_GRC = UUID.fromString("b5d33c78-91e7-467a-9c2d-6c337b78d31a");
372
	public static UUID uuidAreaUA = UUID.fromString("859cf055-a208-4f30-8e6e-361f165c6fa9");
373
	public static UUID uuidAreaRU_FJL = UUID.fromString("84671068-2f18-40cb-933a-e7e1c0e37cc8");
374
	public static UUID uuidAreaRU_NOZ = UUID.fromString("64cce0aa-0222-4740-8fa2-dbf0330e9266");
375

    
376

    
377
	public final static HashMap<String, UUID> abbrToUUID = new HashMap<String,UUID>();
378
	 	static
379
	 	{
380
	 		abbrToUUID.put("AUS", uuidAreaAUS);
381
	 		abbrToUUID.put("AFR", uuidAreaAFR);
382
	 		abbrToUUID.put("EPA", uuidAreaEPA);
383
	 		abbrToUUID.put("GR-AEG", uuidAreaGR_AEG);
384
	 		abbrToUUID.put("GR-CYC", uuidAreaGR_CYC);
385
	 		abbrToUUID.put("GR-DOD", uuidAreaGR_DOD);
386
	 		abbrToUUID.put("NAF", uuidAreaNAF);
387
	 		abbrToUUID.put("NEA", uuidAreaNEA);
388
	 		abbrToUUID.put("NEO", uuidAreaNEO);
389
	 		abbrToUUID.put("NRE", uuidAreaNRE);
390
	 		abbrToUUID.put("ORR", uuidAreaORR);
391
	 		abbrToUUID.put("GR-KRI", uuidAreaGR_CR);
392
	 		abbrToUUID.put("GR-GRC", uuidAreaGR_GRC);
393
	 		abbrToUUID.put("UA", uuidAreaUA);
394
	 		abbrToUUID.put("RU-FJL", uuidAreaRU_FJL);
395
	 		abbrToUUID.put("RU-NOZ", uuidAreaRU_NOZ);
396

    
397

    
398
	 	}
399
	 	
400
	 	public final static HashMap<Integer, Language> languageFK2Language  = new HashMap<Integer,Language>();
401
	 	static
402
	 	{
403
	 		languageFK2Language.put(10, Language.DANISH());
404
	 		languageFK2Language.put(19, Language.GREEK_MODERN());
405
	 		languageFK2Language.put(18, Language.GERMAN());
406
	 		languageFK2Language.put(59, Language.UKRAINIAN());
407
	 		languageFK2Language.put(83, Language.ENGLISH());
408
	 		languageFK2Language.put(58, Language.TURKISH());
409
	 		languageFK2Language.put(26, Language.LITHUANIAN());
410
	 		languageFK2Language.put(34, Language.RUSSIAN());
411
	 		languageFK2Language.put(55, Language.SLOVENIAN());
412
	 		languageFK2Language.put(57, Language.SWEDISH());
413
	 		languageFK2Language.put(11, Language.DUTCH_MIDDLE());
414
	 		languageFK2Language.put(100, Language.NORWEGIAN_BOKMOL());
415
	 		languageFK2Language.put(101, Language.NORWEGIAN_NYNORSK());
416
	 		
417

    
418

    
419
	 	} 	
420
	public static UUID getUUIDByAreaAbbr(String abbr){
421
		return abbrToUUID.get(abbr);
422
	}
423

    
424
	public static UUID uuidNomStatusTempNamed = UUID.fromString("aa6ada5a-ca21-4fef-b76f-9ae237e9c4ae");
425

    
426
	static NomenclaturalStatusType nomStatusTempNamed;
427

    
428
    private static DefinedTerm taxonomicSpecialistType;
429

    
430
    private static UUID uuidTaxonomicSpecialistType = UUID.fromString("006879e4-cf99-405a-a720-2e81d9cbc34c");
431

    
432
    private static DefinedTerm groupCoordinatorType;
433

    
434
    private static UUID uuidGroupCoordinatorType = UUID.fromString("3a827ebe-4410-40e5-a241-941b17028e11");
435

    
436
	private static DefinedTerm associateSpecialistType;
437

    
438
	private static UUID uuidAssociateSpecialistType = UUID.fromString("8258f73c-e0ad-4f87-a88c-53c58c08bba9");
439

    
440
	public static NomenclaturalStatusType getNomStatusTempNamed(ITermService termService){
441
		if (nomStatusTempNamed == null){
442
			nomStatusTempNamed = (NomenclaturalStatusType)termService.find(uuidNomStatusTempNamed);
443
			if (nomStatusTempNamed == null){
444
				nomStatusTempNamed = NomenclaturalStatusType.NewInstance("temporary named", "temporary named", "temp. named", Language.ENGLISH());
445
				Representation repLatin = Representation.NewInstance("", "", "", Language.LATIN());
446
				nomStatusTempNamed.addRepresentation(repLatin);
447
				nomStatusTempNamed.setUuid(uuidNomStatusTempNamed);
448
				NomenclaturalStatusType.ALTERNATIVE().getVocabulary().addTerm(nomStatusTempNamed);
449
				termService.save(nomStatusTempNamed);
450
			}
451
		}
452
		return nomStatusTempNamed;
453
	}
454
    /**
455
     * @return
456
     */
457
    public static DefinedTerm getTaxonomicSpecialistType(ITermService termService) {
458
        if (taxonomicSpecialistType == null){
459
            taxonomicSpecialistType = (DefinedTerm)termService.find(uuidTaxonomicSpecialistType);
460
            if (taxonomicSpecialistType == null){
461
                taxonomicSpecialistType = DefinedTerm.NewInstance(TermType.TaxonNodeAgentRelationType, "taxonomic specialist", "taxonomic specialist", "TS");
462

    
463
                taxonomicSpecialistType.setUuid(uuidTaxonomicSpecialistType);
464

    
465
                termService.save(taxonomicSpecialistType);
466
            }
467
        }
468
        return taxonomicSpecialistType;
469
    }
470
    /**
471
     * @return
472
     */
473
    public static DefinedTerm getGroupCoordinatorType(ITermService termService) {
474
        if (groupCoordinatorType == null){
475
            groupCoordinatorType = (DefinedTerm)termService.find(uuidGroupCoordinatorType);
476
            if (groupCoordinatorType == null){
477
                groupCoordinatorType = DefinedTerm.NewInstance(TermType.TaxonNodeAgentRelationType, "group coordinator", "group coordinator", "GC");
478

    
479
                groupCoordinatorType.setUuid(uuidGroupCoordinatorType);
480

    
481
                termService.save(groupCoordinatorType);
482
            }
483
        }
484
        return groupCoordinatorType;
485
    }
486
    
487
    /**
488
     * @return
489
     */
490
    public static DefinedTerm getAssociateSpecialistType(ITermService termService) {
491
        if (associateSpecialistType == null){
492
        	associateSpecialistType = (DefinedTerm)termService.find(uuidAssociateSpecialistType);
493
            if (associateSpecialistType == null){
494
            	associateSpecialistType = DefinedTerm.NewInstance(TermType.TaxonNodeAgentRelationType, "associate specialist", "associate specialist", "AS");
495

    
496
            	associateSpecialistType.setUuid(uuidAssociateSpecialistType);
497

    
498
                termService.save(associateSpecialistType);
499
            }
500
        }
501
        return associateSpecialistType;
502
    }
503
	public static Language langFK2Language(
504
			int languageFk) {
505
		
506
		return null;
507
	}
508

    
509

    
510
}
(16-16/20)