Project

General

Profile

Download (42.8 KB) Statistics
| Branch: | Tag: | 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.model.name;
11

    
12

    
13

    
14
import java.util.ArrayList;
15
import java.util.HashMap;
16
import java.util.List;
17
import java.util.Map;
18
import java.util.UUID;
19

    
20
import javax.persistence.Entity;
21
import javax.persistence.Transient;
22
import javax.xml.bind.annotation.XmlAccessType;
23
import javax.xml.bind.annotation.XmlAccessorType;
24
import javax.xml.bind.annotation.XmlType;
25

    
26
import org.apache.log4j.Logger;
27
import org.hibernate.envers.Audited;
28

    
29
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
30
import eu.etaxonomy.cdm.model.common.Language;
31
import eu.etaxonomy.cdm.model.common.OrderedTermBase;
32
import eu.etaxonomy.cdm.model.common.Representation;
33
import eu.etaxonomy.cdm.model.common.TermType;
34
import eu.etaxonomy.cdm.model.common.TermVocabulary;
35
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
36

    
37
/**
38
 * The class representing categories of nomenclatural status (like "invalid",
39
 * "conserved" or "novum") to qualify the use of a particular taxon name string
40
 * depending on its {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} (original publication),
41
 * on its {@link NomenclaturalCode nomenclatural code} and on possible decisions of the corresponding
42
 * competent authorities. Unfortunately the ICBN and the ICZN use sometimes
43
 * different words for the same meaning or the same word for different meanings
44
 * (for instance "valid" and "legitimate").
45
 * <P>
46
 * A standard (ordered) list of nomenclatural status type instances will be
47
 * automatically created as the project starts. But this class allows to extend
48
 * this standard list by creating new instances of additional nomenclatural
49
 * status types if needed. The present standard list follows the ICBN
50
 * terminology.
51
 * <P>
52
 * This class corresponds more or less to: <ul>
53
 * <li> NomenclaturalNoteTypeTerm according to the TDWG ontology
54
 * <li> NomenclaturalNoteType  according to the TCS
55
 * </ul>
56
 *
57
 * @author a.mueller
58
 * @created 10.07.2008
59
 */
60
@XmlAccessorType(XmlAccessType.FIELD)
61
@XmlType(name = "NomenclaturalStatusType")
62
@Entity
63
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
64
//@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
65
@Audited
66
public class NomenclaturalStatusType extends OrderedTermBase<NomenclaturalStatusType> {
67

    
68
	private static final long serialVersionUID = 1337101678484153972L;
69

    
70
	private static Logger logger = Logger.getLogger(NomenclaturalStatusType.class);
71

    
72
	//Botanical uuids
73
	public static final UUID uuidIcnafpNomStatusVocabulary = UUID.fromString("bb28cdca-2f8a-4f11-9c21-517e9ae87f1f");
74

    
75
	private static final UUID uuidAmbiguous = UUID.fromString("90f5012b-705b-4488-b4c6-002d2bc5198e");
76
	private static final UUID uuidDoubtful = UUID.fromString("0ffeb39e-872e-4c0f-85ba-a4150d9f9e7d");
77
	private static final UUID uuidConfusum = UUID.fromString("24955174-aa5c-4e71-a2fd-3efc79e885db");
78
	private static final UUID uuidIllegitimate = UUID.fromString("b7c544cf-a375-4145-9d3e-4b97f3f18108");
79
	private static final UUID uuidSuperfluous = UUID.fromString("6890483a-c6ba-4ae1-9ab1-9fbaa5736ce9");
80
	private static final UUID uuidRejected = UUID.fromString("48107cc8-7a5b-482e-b438-efbba050b851");
81
	private static final UUID uuidUtiqueRejected = UUID.fromString("04338fdd-c12a-402f-a1ca-68b4bf0be042");
82
	private static final UUID uuidConservedProp = UUID.fromString("82bab006-5aed-4301-93ec-980deb30cbb1");
83
	private static final UUID uuidOrthographyConservedProp = UUID.fromString("02f82bc5-1066-454b-a023-11967cba9092");
84
	private static final UUID uuidLegitimate = UUID.fromString("51a3613c-b53b-4561-b0cd-9163d91c15aa");
85
	private static final UUID uuidAlternative = UUID.fromString("3b8a8519-420f-4dfa-b050-b410cc257961");
86
	private static final UUID uuidNovum = UUID.fromString("05fcb68f-af60-4851-b912-892512058897");
87
	private static final UUID uuidUtiqueRejectedProp = UUID.fromString("643ee07f-026c-426c-b838-c778c8613383");
88
	private static final UUID uuidOrthographyConserved = UUID.fromString("34a7d383-988b-4117-b8c0-52b947f8c711");
89
	private static final UUID uuidRejectedProp = UUID.fromString("248e44c2-5436-4526-a352-f7467ecebd56");
90
	private static final UUID uuidConserved = UUID.fromString("6330f719-e2bc-485f-892b-9f882058a966");
91
	private static final UUID uuidSanctioned = UUID.fromString("1afe55c4-76aa-46c0-afce-4dc07f512733");
92
	private static final UUID uuidInvalid = UUID.fromString("b09d4f51-8a77-442a-bbce-e7832aaf46b7");
93
	private static final UUID uuidNudum = UUID.fromString("e0d733a8-7777-4b27-99a3-05ab50e9f312");
94
	private static final UUID uuidCombinationInvalid = UUID.fromString("f858e619-7b7f-4225-913b-880a2143ec83");
95
	private static final UUID uuidCombinationIllegitimate = UUID.fromString("d901d455-4e01-45cb-b653-01a840b97eed");
96
	private static final UUID uuidProvisional = UUID.fromString("a277507e-ad93-4978-9419-077eb889c951");
97
	private static final UUID uuidValid = UUID.fromString("bd036217-5499-4ccd-8f4c-72e06158db93");
98
	private static final UUID uuidOpusUtiqueOppr = UUID.fromString("a5055d80-dbba-4660-b091-a1835d59fe7c");
99
	private static final UUID uuidSubnudum = UUID.fromString("92a76bd0-6ea8-493f-98e0-4be0b98c092f");
100
	private static final UUID uuidCombNov = UUID.fromString("ed508710-deef-44b1-96f6-1ce6d2c9c884");
101
	private static final UUID uuidOrthographyRejected = UUID.fromString("39a25673-f716-4ec7-ae27-2498fce43166");
102
	private static final UUID uuidConservedDesig = UUID.fromString("4e9c9702-a74d-4033-9d47-792ad123712c");
103

    
104
	//zoological uuids
105
	public static final UUID uuidIcznNomStatusVocabulary = UUID.fromString("5e3c08e9-13a9-498e-861e-b9b5656ab6ac");
106

    
107
	private static final UUID uuidZooNotAvailable = UUID.fromString("6d9ed462-b761-4da3-9304-4749e883d4eb");
108
	private static final UUID uuidZooInvalid = UUID.fromString("2bef7039-c129-410b-815e-2a1f7249127b");
109
	private static final UUID uuidZooSuppressed = UUID.fromString("a61602c7-fbd4-4eb4-98a2-44919db8920b");
110

    
111

    
112

    
113
	public static NomenclaturalStatusType NewInstance(String description, String label, String labelAbbrev, Language language) {
114
		return new NomenclaturalStatusType(description, label, labelAbbrev, language);
115
	}
116

    
117
	public static NomenclaturalStatusType NewInstance(String description, String label, String labelAbbrev) {
118
		return new NomenclaturalStatusType(description, label, labelAbbrev);
119
	}
120

    
121

    
122
	protected static Map<UUID, NomenclaturalStatusType> termMap = null;
123
	private static Map<String, UUID> abbrevMap = null;
124
	private static Map<String, UUID> labelMap = null;
125

    
126

    
127
	protected static Map<UUID, NomenclaturalStatusType> zooTermMap = null;
128
	private static Map<String, UUID> zooAbbrevMap = null;
129
	private static Map<String, UUID> zooLabelMap = null;
130

    
131

    
132

    
133
	protected static NomenclaturalStatusType getTermByUuid(UUID uuid){
134
	    if ((termMap == null || termMap.isEmpty()) && (zooTermMap == null || zooTermMap.isEmpty())){
135
	        return getTermByClassAndUUID(NomenclaturalStatusType.class, uuid);
136

    
137
	    }
138
		NomenclaturalStatusType result = null;
139
		if (termMap != null){
140
			result = termMap.get(uuid);
141
		}
142
		if (result == null && zooTermMap != null){
143
			result = zooTermMap.get(uuid);
144
		}
145
		return result;
146
	}
147

    
148

    
149
//********************************** Constructor *********************************/
150

    
151
  	//for hibernate use only
152
  	@Deprecated
153
  	protected NomenclaturalStatusType() {
154
		super(TermType.NomenclaturalStatusType);
155
	}
156

    
157
	/**
158
	 * Class constructor: creates an additional nomenclatural status type
159
	 * instance with a description (in the {@link eu.etaxonomy.cdm.model.common.Language#DEFAULT() default language}), a label
160
	 * and a label abbreviation.
161
	 *
162
	 * @param	term  		 the string (in the default language) describing the
163
	 * 						 new nomenclatural status type to be created
164
	 * @param	label  		 the string identifying the new nomenclatural status
165
	 * 						 type to be created
166
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
167
	 * 						 new nomenclatural status type to be created
168
	 * @see 				 #NomenclaturalStatusType()
169
	 * @see 				 #readCsvLine(List, Language)
170
	 * @see 				 #readCsvLine(List)
171
	 */
172
	private NomenclaturalStatusType(String term, String label, String labelAbbrev) {
173
		super(TermType.NomenclaturalStatusType, term, label, labelAbbrev);
174
	}
175

    
176
	private NomenclaturalStatusType(String term, String label, String labelAbbrev, Language language) {
177
		super(TermType.NomenclaturalStatusType);
178
		this.addRepresentation(new Representation(term, label, labelAbbrev, language));
179
	}
180

    
181
//********* METHODS **************************************
182

    
183

    
184
	@Override
185
	public void resetTerms(){
186
		termMap = null;
187
		zooTermMap = null;
188
	}
189

    
190
	/**
191
	 * Returns the boolean value indicating whether <i>this</i> nomenclatural status
192
	 * type is itself "invalid" or a kind of "invalid" (true) or not (false) -
193
	 * this corresponds to "not available" for {@link ZoologicalName zoological names} -.
194
	 * Returns false if <i>this</i> nomenclatural status type is null. The use
195
	 * of "invalid" {@link TaxonNameBase taxon names} should be avoided.<BR>
196
	 * A taxon name is "invalid" if it is not "valid"; this means that
197
	 * the taxon name:<ul>
198
	 * <li>has not been effectively published or
199
	 * <li>has a form which does not comply with the rules of the
200
	 * 	   {@link NomenclaturalCode nomenclature code} or
201
	 * <li>is not accompanied by a description or diagnosis or by a reference to
202
	 * 	   such a previously published description or diagnosis
203
	 * </ul>
204
	 *
205
	 * @see  #VALID()
206
	 * @see  #isIllegitimateType()
207
	 * @see  eu.etaxonomy.cdm.model.common.DefinedTermBase#getKindOf()
208
	 */
209
	@Transient
210
	public boolean isInvalidType(){
211
		if (this.equals(INVALID())
212
			|| this.equals(NUDUM())
213
			|| 	this.equals(PROVISIONAL())
214
			|| 	this.equals(COMBINATION_INVALID())
215
			|| 	this.equals(OPUS_UTIQUE_OPPR())
216
			||  this.equals(ZOO_NOT_AVAILABLE())
217
			){
218
			return true;
219
		}else{
220
			return false;
221
		}
222
	}
223

    
224
	/**
225
	 * Returns the boolean value indicating whether <i>this</i> nomenclatural status
226
	 * type is itself "legitimate" or a kind of "legitimate" (true)
227
	 * or not (false). Corresponds to "valid" for {@link ZoologicalName zoological names}.<BR>
228
	 * Returns false if <i>this</i> nomenclatural status type is null.<BR>
229
	 * A "valid" (zool.: "available") {@link TaxonNameBase taxon name}, unless "rejected",
230
	 * is "legitimate" if it was not "superfluous" when published
231
	 * or has been later "conserved".<BR>
232
	 *
233
	 * @see  #isInvalidType()
234
	 * @see  #isIllegitimateType()
235
	 * @see  eu.etaxonomy.cdm.model.common.DefinedTermBase#getKindOf()
236
	 */
237
	@Transient
238
	public boolean isLegitimateType(){
239
		if (this.equals(LEGITIMATE()) ||
240
				this.equals(NOVUM()) ||
241
				this.equals(ALTERNATIVE()) ||
242
				this.equals(CONSERVED()) ||
243
				this.equals(ORTHOGRAPHY_CONSERVED()) ||
244
				this.equals(REJECTED_PROP()) ||
245
				this.equals(UTIQUE_REJECTED_PROP()) ||
246
				this.equals(COMB_NOV())
247
			){
248
			return true;
249
		}else{
250
			return false;
251
		}
252
	}
253

    
254
	/**
255
	 * Returns the boolean value indicating whether <i>this</i> nomenclatural status
256
	 * type is itself "illegitimate" or a kind of "illegitimate" (true)
257
	 * or not (false) - this corresponds to "invalid" for {@link ZoologicalName zoological names} -.
258
	 * Returns false if <i>this</i> nomenclatural status type is null.<BR>
259
	 * A "valid" ("available") {@link TaxonNameBase taxon name}, unless "conserved" or
260
	 * "sanctioned", is "illegitimate" if it was "superfluous" when published
261
	 * or has been later "rejected".
262
	 *
263
	 * @see  #VALID()
264
	 * @see  #isInvalidType()
265
	 * @see  #ILLEGITIMATE()
266
	 * @see  #CONSERVED()
267
	 * @see  #SANCTIONED()
268
	 * @see  eu.etaxonomy.cdm.model.common.DefinedTermBase#getKindOf()
269
	 */
270
	@Transient
271
	public boolean isIllegitimateType(){
272
		if (this.equals(ILLEGITIMATE()) ||
273
				this.equals(SUPERFLUOUS()) ||
274
				this.equals(REJECTED()) ||
275
				this.equals(UTIQUE_REJECTED()) ||
276
				this.equals(CONSERVED_PROP()) ||
277
				this.equals(ORTHOGRAPHY_CONSERVED_PROP()) ||
278
				this.equals(ZOO_INVALID()) ||
279
				this.equals(ZOO_SUPPRESSED()) ||
280
				this.equals(ORTHOGRAPHY_REJECTED())
281
			){
282
			return true;
283
		}else{
284
			return false;
285
		}
286
	}
287

    
288

    
289
	/**
290
	 * Returns the nomenclatural status type "ambiguous". A "valid"
291
	 * ("available") {@link TaxonNameBase taxon name} is "ambiguous" if it has been used so long
292
	 * by different authors in different senses (other than the originally
293
	 * intended) that it has become a persistent cause of error and confusion.<BR>
294
	 * An "ambiguous" taxon name is treated as if "rejected" and is therefore
295
	 * also "illegitimate" ("invalid" for {@link ZoologicalName zoological names}).
296
	 *
297
	 * @see  #VALID()
298
	 * @see  #REJECTED()
299
	 * @see  #isIllegitimateType()
300
	 */
301
	public static final NomenclaturalStatusType AMBIGUOUS(){
302
		return getTermByUuid(uuidAmbiguous);
303
	}
304

    
305
	/**
306
	 * Returns the nomenclatural status type "doubtful" (dubious). A "valid"
307
	 * ("available") {@link TaxonNameBase taxon name} is "doubtful" if its
308
	 * application is uncertain; the confusion being derived from an incomplete
309
	 * or confusing description.<BR>
310
	 * A "doubtful" taxon name is treated as if "rejected" and is therefore
311
	 * also "illegitimate" (("invalid" for {@link ZoologicalName zoological names}).
312
	 *
313
	 * @see  #VALID()
314
	 * @see  #REJECTED()
315
	 * @see  #isIllegitimateType()
316
	 */
317
	public static final NomenclaturalStatusType DOUBTFUL(){
318
		return getTermByUuid(uuidDoubtful);
319
	}
320

    
321
	/**
322
	 * Returns the nomenclatural status type "confusum". A "valid" ("available")
323
	 * {@link TaxonNameBase taxon name} is "confusum" if it has been widely
324
	 * and persistently used for a taxon or taxa not including its type.<BR>
325
	 * A "confusum" taxon name is treated as if "rejected" and is therefore
326
	 * also "illegitimate" ("invalid" for {@link ZoologicalName zoological names}).
327
	 *
328
	 * @see  #VALID()
329
	 * @see  #REJECTED()
330
	 * @see  #isIllegitimateType()
331
	 */
332
	public static final NomenclaturalStatusType CONFUSUM(){
333
		return getTermByUuid(uuidConfusum);
334
	}
335

    
336
	/**
337
	 * Returns the nomenclatural status type "illegitimate" ("invalid" for
338
	 * {@link ZoologicalName zoological names}). A "valid" ("available")
339
	 * {@link TaxonNameBase taxon name}, unless "conserved" or "sanctioned", is "illegitimate"
340
	 * if it was "superfluous" when published or has been later "rejected".<BR>
341
	 *
342
	 * @see  #VALID()
343
	 * @see  #SUPERFLUOUS()
344
	 * @see  #REJECTED()
345
	 */
346
	public static final NomenclaturalStatusType ILLEGITIMATE(){
347
		return getTermByUuid(uuidIllegitimate);
348
	}
349

    
350
	/**
351
	 * Returns the nomenclatural status type "superfluous". A "valid"
352
	 * ("available") {@link TaxonNameBase taxon name} is "superfluous" if, when published,
353
	 * the taxon to which it was applied, as circumscribed by its {@link NonViralName#getCombinationAuthorship() author},
354
	 * definitely included the type of a name which ought to have been adopted,
355
	 * or of which the epithet ought to have been adopted, under the rules of
356
	 * the {@link NomenclaturalCode nomenclature code}, and if it has not been later declared
357
	 * "conserved" or "sanctioned" by the competent authorities.<BR>
358
	 * A "superfluous" taxon name is therefore also "illegitimate" ("invalid" for
359
	 * {@link ZoologicalName zoological names}).
360
	 *
361
	 * @see  #VALID()
362
	 * @see  #CONSERVED()
363
	 * @see  #SANCTIONED()
364
	 * @see  #isIllegitimateType()
365
	 */
366
	public static final NomenclaturalStatusType SUPERFLUOUS(){
367
		return getTermByUuid(uuidSuperfluous);
368
	}
369

    
370
	/**
371
	 * Returns the nomenclatural status type "rejected". A "valid" ("available")
372
	 * {@link TaxonNameBase taxon name} is "rejected" if, even though by the strict
373
	 * application of the rules of the {@link NomenclaturalCode nomenclature code}, and especially
374
	 * of the principle of priority, it should be "legitimate" ("valid" for
375
	 * {@link ZoologicalName zoological names}), competent authorities decided to handle
376
	 * it as "illegitimate".<BR>
377
	 * A "rejected" taxon name is therefore also "illegitimate" ("invalid" for
378
	 * zoological names). A "rejected" taxon name is always rejected in favour
379
	 * of a "conserved" taxon name.
380
	 *
381
	 * @see  #VALID()
382
	 * @see  #isLegitimateType()
383
	 * @see  #isIllegitimateType()
384
	 * @see  #CONSERVED()
385
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
386
	 */
387
	public static final NomenclaturalStatusType REJECTED(){
388
		return getTermByUuid(uuidRejected);
389
	}
390

    
391
	/**
392
	 * Returns the nomenclatural status type "utique rejected". A "valid"
393
	 * ("available") {@link TaxonNameBase taxon name} is "utique rejected" if it is rejected
394
	 * outright (without being rejected in favour of a "conserved" taxon name).<BR>
395
	 * An "utique rejected" taxon name is therefore also "illegitimate"
396
	 * ("invalid" for zoological names).
397
	 *
398
	 * @see  #REJECTED()
399
	 * @see  #VALID()
400
	 * @see  #isIllegitimateType()
401
	 * @see  #CONSERVED()
402
	 */
403
	public static final NomenclaturalStatusType UTIQUE_REJECTED(){
404
		return getTermByUuid(uuidUtiqueRejected);
405
	}
406

    
407
	/**
408
	 * Returns the nomenclatural status type "proposed to be conserved". A
409
	 * "valid" ("available") {@link TaxonNameBase taxon name} is "proposed to be conserved"
410
	 * if, even though by the strict application of the rules of
411
	 * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority,
412
	 * it is "illegitimate" ("invalid" for {@link ZoologicalName zoological names}),
413
	 * it has been submitted to competent authorities in order to decide whether
414
	 * it should be handled as "legitimate".<BR>
415
	 * A "proposed to be conserved" taxon name is therefore still "illegitimate"
416
	 * ("invalid" for zoological names).
417
	 *
418
	 * {@link https://dev.e-taxonomy.eu/trac/ticket/5662}
419
	 *
420
	 * @see  #VALID()
421
	 * @see  #isIllegitimateType()
422
	 * @see  #isLegitimateType()
423
	 * @see  #CONSERVED()
424
	 * @see  #CONSERVED_DESIG()
425
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
426
	 */
427
	public static final NomenclaturalStatusType CONSERVED_PROP(){
428
		return getTermByUuid(uuidConservedProp);
429
	}
430

    
431
    /**
432
     * Returns the nomenclatural status type "designated to be conserved". A
433
     * "valid" ("available") {@link TaxonNameBase taxon name} is "designated to be conserved"
434
     * if, even though by the strict application of the rules of
435
     * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority,
436
     * it is "illegitimate" ("invalid" for {@link ZoologicalName zoological names}),
437
     * it has been submitted to competent authorities in order to decide whether
438
     * it should be handled as "legitimate".<BR>
439
     * A "proposed to be conserved" taxon name is therefore still "illegitimate"
440
     * ("invalid" for zoological names).
441
     *
442
     * {@link https://dev.e-taxonomy.eu/trac/ticket/5662}
443
     *
444
     * @see  #VALID()
445
     * @see  #isIllegitimateType()
446
     * @see  #isLegitimateType()
447
     * @see  #CONSERVED()
448
     * @see  #CONSERVED_PROP()()
449
     * @see  NameRelationshipType#CONSERVED_AGAINST()
450
     */
451
    public static final NomenclaturalStatusType CONSERVED_DESIG(){
452
        return getTermByUuid(uuidConservedDesig);
453
    }
454

    
455

    
456

    
457
	/**
458
	 * Returns the nomenclatural status type "proposed to be conserved
459
	 * (orthography)". A {@link TaxonNameBase taxon name} is "proposed to be conserved
460
	 * (orthography)" if, even though originally published with another
461
	 * spelling, it has been submitted to competent authorities in order to
462
	 * decide whether the proposed alternative spelling should be "conserved".<BR>
463
	 * A "proposed to be conserved (orthography)" taxon name is therefore still
464
	 * "illegitimate" ("invalid" for {@link ZoologicalName zoological names}).
465
	 *
466
	 * @see  #isIllegitimateType()
467
	 * @see  #CONSERVED_PROP()
468
	 * @see  #CONSERVED()
469
	 * @see  NameRelationshipType#ORTHOGRAPHIC_VARIANT()
470
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
471
	 */
472
	public static final NomenclaturalStatusType ORTHOGRAPHY_CONSERVED_PROP(){
473
		return getTermByUuid(uuidOrthographyConservedProp);
474
	}
475

    
476
	/**
477
	 * Returns the nomenclatural status type "legitimate" ("valid" for
478
	 * {@link ZoologicalName zoological names}). A "valid" ("available")
479
	 * {@link TaxonNameBase taxon name}, unless "rejected", is "legitimate" if it was not
480
	 * "superfluous" when published or has been later "conserved".<BR>
481
	 *
482
	 * @see  #VALID()
483
	 * @see  #SUPERFLUOUS()
484
	 * @see  #CONSERVED()
485
	 */
486
	public static final NomenclaturalStatusType LEGITIMATE(){
487
		return getTermByUuid(uuidLegitimate);
488
	}
489

    
490
	/**
491
	 * Returns the nomenclatural status type "alternative". A family
492
	 * {@link BotanicalName botanical name} is "alternative" if it is a classical name
493
	 * long in use, in some cases even before 1753, and is considered as
494
	 * {@link NomenclaturalStatusType#VALID() "valid"} although it does not follow the rules for
495
	 * family names (see Article 18 of the ICBN).<BR>
496
	 * An "alternative" taxon name is treated as if "conserved" and is therefore
497
	 * also "legitimate".
498
	 *
499
	 * @see  #VALID()
500
	 * @see  #CONSERVED()
501
	 * @see  #isLegitimateType()
502
	 * @see  NameRelationshipType#ALTERNATIVE_NAME()
503
	 */
504
	public static final NomenclaturalStatusType ALTERNATIVE(){
505
		return getTermByUuid(uuidAlternative);
506
	}
507

    
508
	/**
509
	 * Returns the nomenclatural status type "novum". A "valid"
510
	 * ("available") {@link TaxonNameBase taxon name} is "novum" if it has been created
511
	 * in order either to replace an earlier name that is "illegitimate" or to
512
	 * avoid the building of a "later homonym".<BR>
513
	 * A "novum" taxon name is therefore also "legitimate" ("valid" for
514
	 * {@link ZoologicalName zoological names}).
515
	 *
516
	 * @see  #VALID()
517
	 * @see  #isIllegitimateType()
518
	 * @see  NameRelationshipType#REPLACED_SYNONYM()
519
	 * @see  NameRelationshipType#BLOCKING_NAME_FOR()
520
	 */
521
	public static final NomenclaturalStatusType NOVUM(){
522
		return getTermByUuid(uuidNovum);
523
	}
524

    
525
	/**
526
	 * Returns the nomenclatural status type "proposed to be utique rejected". A
527
	 * "valid" ("available") {@link TaxonNameBase taxon name} is "proposed to be utique rejected"
528
	 * if, even though by the strict application of the rules of
529
	 * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority,
530
	 * it is "legitimate" ("valid" for {@link ZoologicalName zoological names}),
531
	 * it has been submitted to competent authorities in order to decide whether
532
	 * it should be handled as "illegitimate" (without to be rejected in favour
533
	 * of a "conserved" taxon name).<BR>
534
	 * A "proposed to be utique rejected" taxon name is therefore still "legitimate"
535
	 * ("valid" for zoological names).
536
	 *
537
	 * @see  #VALID()
538
	 * @see  #isLegitimateType()
539
	 * @see  #isIllegitimateType()
540
	 * @see  #REJECTED()
541
	 * @see  #REJECTED_PROP()
542
	 */
543
	public static final NomenclaturalStatusType UTIQUE_REJECTED_PROP(){
544
		return getTermByUuid(uuidUtiqueRejectedProp);
545
	}
546

    
547
	/**
548
	 * Returns the nomenclatural status type "conserved (orthography)". A
549
	 * {@link TaxonNameBase taxon name} is "conserved (orthography)" if competent authorities
550
	 * decided to conserve a different spelling to the one published originally.<BR>
551
	 * A "conserved (orthography)" taxon name is "conserved" and hence
552
	 * "legitimate" ("valid" for {@link ZoologicalName zoological names}).
553
	 *
554
	 * @see  #isLegitimateType()
555
	 * @see  #CONSERVED()
556
	 * @see  #ORTHOGRAPHY_CONSERVED_PROP()
557
	 * @see  NameRelationshipType#ORTHOGRAPHIC_VARIANT()
558
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
559
	 */
560
	public static final NomenclaturalStatusType ORTHOGRAPHY_CONSERVED(){
561
		return getTermByUuid(uuidOrthographyConserved);
562
	}
563

    
564
    /**
565
     * Returns the nomenclatural status type "orthography rejected". <BR>
566
     * TBC.
567
     * See also {@link http://dev.e-taxonomy.eu/trac/ticket/5649}
568
     *
569
     * @see  #ORTHOGRAPHY_CONSERVED()
570
     * @see  #REJECTED()
571
     * @see  #isIllegitimateType()
572
     */
573
    public static final NomenclaturalStatusType ORTHOGRAPHY_REJECTED(){
574
        return getTermByUuid(uuidOrthographyRejected);
575
    }
576

    
577
	/**
578
	 * Returns the nomenclatural status type "proposed to be rejected". A
579
	 * "valid" ("available") {@link TaxonNameBase taxon name} is "proposed to be rejected"
580
	 * if, even though by the strict application of the rules of
581
	 * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority,
582
	 * it should be "legitimate" ("valid" for {@link ZoologicalName zoological names}),
583
	 * it has been submitted to competent authorities in order to decide whether
584
	 * it should be handled as "illegitimate".<BR>
585
	 * A "proposed to be rejected" taxon name is therefore still "legitimate"
586
	 * ("valid" for zoological names). A "proposed to be rejected" taxon name is always
587
	 * to be rejected in favour of a "proposed to be conserved" taxon name.
588
	 *
589
	 * @see  #VALID()
590
	 * @see  #isLegitimateType()
591
	 * @see  #isIllegitimateType()
592
	 * @see  #REJECTED()
593
	 * @see  #CONSERVED_PROP()
594
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
595
	 */
596
	public static final NomenclaturalStatusType REJECTED_PROP(){
597
		return getTermByUuid(uuidRejectedProp);
598
	}
599

    
600

    
601
	/**
602
	 * Returns the nomenclatural status type "conserved". A "valid"
603
	 * ("available") {@link TaxonNameBase taxon name} is "conserved" if, even though by the strict
604
	 * application of the rules of the {@link NomenclaturalCode nomenclature code}, and especially of
605
	 * the principle of priority, it should be "illegitimate" ("invalid" for
606
	 * {@link ZoologicalName zoological names}), competent authorities decided to handle
607
	 * it as "legitimate".<BR>
608
	 * A "conserved" taxon name is therefore also "legitimate" ("valid" for
609
	 * zoological names).
610
	 *
611
	 * @see  #VALID()
612
	 * @see  #isIllegitimateType()
613
	 * @see  #isLegitimateType()
614
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
615
	 */
616
	public static final NomenclaturalStatusType CONSERVED(){
617
		return getTermByUuid(uuidConserved);
618
	}
619

    
620
	/**
621
	 * Returns the nomenclatural status type "sanctioned". {@link BotanicalName Botanical names}
622
	 * for fungi are "sanctioned" if they were published in the opera mentioned
623
	 * in Article 13.1d of the {@link NomenclaturalCode#ICBN() ICBN}.<BR>
624
	 * A "sanctioned" taxon name is treated as if "conserved" and is therefore
625
	 * also "legitimate".
626
	 *
627
	 * @see  #VALID()
628
	 * @see  #CONSERVED()
629
	 * @see  #isLegitimateType()
630
	 */
631
	public static final NomenclaturalStatusType SANCTIONED(){
632
		return getTermByUuid(uuidSanctioned);
633
	}
634

    
635
	/**
636
	 * Returns the nomenclatural status type "invalid" (this corresponds to
637
	 * "not available" for {@link ZoologicalName zoological names}). The use of "invalid"
638
	 * {@link TaxonNameBase taxon names} should be avoided.<BR>
639
	 * A taxon name is "invalid" if it is not "valid"; this means that
640
	 * the taxon name:<ul>
641
	 * <li>has not been effectively published or
642
	 * <li>has a form which does not comply with the rules of the
643
	 * 	   {@link NomenclaturalCode nomenclature code} or
644
	 * <li>is not accompanied by a description or diagnosis or by a reference to
645
	 * 	   such a previously published description or diagnosis
646
	 * </ul>
647
	 *
648
	 * @see  #VALID()
649
	 * @see  #isInvalidType()
650
	 * @see  #ILLEGITIMATE()
651
	 */
652
	public static final NomenclaturalStatusType INVALID(){
653
		return getTermByUuid(uuidInvalid);
654
	}
655

    
656
	/**
657
	 * Returns the nomenclatural status type "nudum". A {@link TaxonNameBase taxon name} is "nudum"
658
	 * if its publication is not accompanied by a description or diagnosis or
659
	 * by a reference to such a previously published description or diagnosis.<BR>
660
	 * A "nudum" taxon name is therefore also "invalid" ("not available" for
661
	 * {@link ZoologicalName zoological names}).
662
	 *
663
	 * @see  #isInvalidType()
664
	 */
665
	public static final NomenclaturalStatusType NUDUM(){
666
		return getTermByUuid(uuidNudum);
667
	}
668

    
669
	/**
670
	 * Returns the nomenclatural status type "invalid combination". A
671
	 * {@link TaxonNameBase bi- or trinomial} is an "invalid combination" if its
672
	 * {@link NonViralName#getCombinationAuthorship() author} did not definitely associate the final
673
	 * epithet with the name of the genus or species, or with its abbreviation.<BR>
674
	 * An "invalid combination" taxon name is therefore also "invalid"
675
	 * ("not available" for {@link ZoologicalName zoological names}).
676
	 *
677
	 * @see  #isInvalidType()
678
	 */
679
	public static final NomenclaturalStatusType COMBINATION_INVALID(){
680
		return getTermByUuid(uuidCombinationInvalid);
681
	}
682

    
683
	/**
684
	 * Returns the nomenclatural status type "illegitimate combination".
685
	 * TODO explanation
686
	 *
687
	 * @see  #isInvalidType()
688
	 */
689
	public static final NomenclaturalStatusType COMBINATION_ILLEGITIMATE(){
690
		return getTermByUuid(uuidCombinationIllegitimate);
691
	}
692

    
693
	/**
694
	 * Returns the nomenclatural status type "provisional". A {@link TaxonNameBase taxon name} is
695
	 * "provisional" if it has not been yet effectively published.<BR>
696
	 * A "provisional" taxon name is therefore also "invalid"
697
	 * ("not available" for {@link ZoologicalName zoological names}).
698
	 *
699
	 * @see  #isInvalidType()
700
	 */
701
	public static final NomenclaturalStatusType PROVISIONAL(){
702
		return getTermByUuid(uuidProvisional);
703
	}
704

    
705
	/**
706
	 * Returns the nomenclatural status type "valid" (this corresponds to
707
	 * "available" for {@link ZoologicalName zoological names}).<BR>
708
	 * A {@link TaxonNameBase taxon name} is "valid" if it:<ul>
709
	 * <li>has been effectively published and
710
	 * <li>has a form which complies with the rules of the
711
	 * 	   {@link NomenclaturalCode nomenclature code} and
712
	 * <li>is accompanied by a description or diagnosis or by a reference to
713
	 * 	   such a previously published description or diagnosis
714
	 * </ul>
715
	 *
716
	 * @see  #INVALID()
717
	 * @see  #LEGITIMATE()
718
	 */
719
	public static final NomenclaturalStatusType VALID(){
720
		return getTermByUuid(uuidValid);
721
	}
722

    
723
	/**
724
	 * Returns the nomenclatural status type "subnudum". This type is not
725
	 * covered by {@link NomenclaturalCode nomenclature codes}. It appears sometimes in literature and
726
	 * represents the opinion of the author who considers the {@link TaxonNameBase taxon name} to be
727
	 * unusable for an unambiguous taxonomic use.
728
	 *
729
	 * @see  #AMBIGUOUS()
730
	 * @see  #CONFUSUM()
731
	 *
732
	 */
733
	public static final NomenclaturalStatusType SUBNUDUM(){
734
		return getTermByUuid(uuidSubnudum);
735
	}
736

    
737
	/**
738
	 * Returns the nomenclatural status type "comb. nov.". No further information available for now.
739
	 * @return
740
	 */
741
	//TODO javadoc. this term was added for Flore du Gabon
742
	public static final NomenclaturalStatusType COMB_NOV(){
743
		return getTermByUuid(uuidCombNov);
744
	}
745

    
746
	/**
747
	 * Returns the nomenclatural status type "opus utique oppressum". This type
748
	 * relates to article 32.7 (old ICBN) and article 32.9 as well as App. 6
749
	 * (new {@link NomenclaturalCode#ICBN() ICBN}). This is a reference list of botanical opera, in which all
750
	 * {@link BotanicalName taxon names} (or names of a certain rank) are oppressed. Such a name has the
751
	 * status "invalid" but in contrary to "rejected" not a single name
752
	 * is rejected by the commission but an opus with regard to the validity of
753
	 * all taxon names occurring in it.<BR>
754
	 * An "opus utique oppressum" taxon name is therefore also "invalid"
755
	 * ("not available" for {@link ZoologicalName zoological names}).
756
	 *
757
	 * @see  #isInvalidType()
758
	 */
759
	public static final NomenclaturalStatusType OPUS_UTIQUE_OPPR(){
760
		return getTermByUuid(uuidOpusUtiqueOppr);
761
	}
762

    
763
	/**
764
	 * TODO
765
	 * @return
766
	 */
767
	public static final  NomenclaturalStatusType ZOO_NOT_AVAILABLE (){
768
		return getTermByUuid(uuidZooNotAvailable);
769
	}
770

    
771
	/**
772
	 * TODO
773
	 * @return
774
	 */
775
	public static final  NomenclaturalStatusType ZOO_INVALID (){
776
		return getTermByUuid(uuidZooInvalid);
777
	}
778

    
779
	/**
780
	 * TODO
781
	 * @return
782
	 */
783
	public static final  NomenclaturalStatusType ZOO_SUPPRESSED (){
784
		return getTermByUuid(uuidZooSuppressed);
785
	}
786

    
787
	//TODO further Zoological status
788

    
789

    
790
	//TODO Soraya
791
	//	orth. var.: orthographic variant
792
	//	pro syn.: pro synonymo
793

    
794
	// TODO
795
	// Preliminary implementation for BotanicalNameParser.
796
	// not yet complete
797
	/**
798
	 * Returns the nomenclatural status type identified through its label
799
	 * abbreviation. Preliminary implementation for BotanicalNameParser.
800
	 *
801
	 * @param	statusAbbreviation	the label abbreviation
802
	 * @param name
803
	 * @return  					the nomenclatural status type
804
	 *
805
	 */
806
	public static NomenclaturalStatusType getNomenclaturalStatusTypeByAbbreviation(String statusAbbreviation, NonViralName<?> name) throws UnknownCdmTypeException{
807
		if (statusAbbreviation == null){
808
			throw new NullPointerException("Abbreviation is NULL in getNomenclaturalStatusTypeByAbbreviation");
809
		}
810
		NomenclaturalStatusType result = null;
811

    
812
		//TODO handle undefined names correctly
813
		boolean isZooname = name.getNomenclaturalCode().equals(NomenclaturalCode.ICZN);
814

    
815
		Map<String, UUID> map = isZooname ? zooAbbrevMap : abbrevMap;
816
		if (map == null ){
817
			return null;
818
		}
819
		//non unique abbrev
820
		if (! isZooname && statusAbbreviation.equalsIgnoreCase("nom. alternativ.")){
821
			return NomenclaturalStatusType.ALTERNATIVE();
822
		}
823
		UUID uuid = map.get(statusAbbreviation);
824
		if (uuid != null ){
825
			result = getTermByUuid(uuid);
826
		}
827
		if (result != null){
828
			return result;
829
		}else {
830
			if (statusAbbreviation == null){
831
				statusAbbreviation = "(null)";
832
			}
833
			throw new UnknownCdmTypeException("Unknown nom. status abbreviation: " + statusAbbreviation);
834
		}
835

    
836
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. ambig.")) { return NomenclaturalStatusType.AMBIGUOUS();
837
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. dub.")) { return NomenclaturalStatusType.DOUBTFUL();
838
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. confus.")) { return NomenclaturalStatusType.CONFUSUM();
839
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. illeg.")){return NomenclaturalStatusType.ILLEGITIMATE();
840
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. superfl.")){ return NomenclaturalStatusType.SUPERFLUOUS();
841
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. rej.")) { return NomenclaturalStatusType.REJECTED();
842
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. utique rej.")) { return NomenclaturalStatusType.UTIQUE_REJECTED();
843
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. cons. prop.")) { return NomenclaturalStatusType.CONSERVED_PROP();
844
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. orth. cons. prop.")) { return NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED_PROP();
845
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. legit.")) { return NomenclaturalStatusType.LEGITIMATE();
846
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. altern.")) { return NomenclaturalStatusType.ALTERNATIVE();
847

    
848
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. alternativ.")) { return NomenclaturalStatusType.ALTERNATIVE();
849

    
850
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. nov.")) { return NomenclaturalStatusType.NOVUM();
851
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. utique rej. prop.")) { return NomenclaturalStatusType.UTIQUE_REJECTED_PROP();
852
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. orth. cons.")) { return NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED();
853
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. rej. prop.")) { return NomenclaturalStatusType.REJECTED_PROP();
854
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. cons.")) { return NomenclaturalStatusType.CONSERVED();
855
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. sanct.")) { return NomenclaturalStatusType.SANCTIONED();
856
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. inval.")) { return NomenclaturalStatusType.INVALID();
857
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. nud.")){ return NomenclaturalStatusType.NUDUM();
858
//		}else if (statusAbbreviation.equalsIgnoreCase("comb. inval.")){ return NomenclaturalStatusType.COMBINATION_INVALID();
859
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. provis.")) { return NomenclaturalStatusType.PROVISIONAL();
860
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. valid")) { return NomenclaturalStatusType.VALID();
861
//		}else if (statusAbbreviation.equalsIgnoreCase("opus. utique oppr.")) { return NomenclaturalStatusType.OPUS_UTIQUE_OPPR();
862
//		}else if (statusAbbreviation.equalsIgnoreCase("nom. subnud.")) { return NomenclaturalStatusType.SUBNUDUM();
863
//		//TODO make generic, use labels for map
864
//		}else {
865
//			if (statusAbbreviation == null){
866
//				statusAbbreviation = "(null)";
867
//			}
868
//			throw new eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException("Unknown NomenclaturalStatusType abbreviation: " + statusAbbreviation);
869
//		}
870
	}
871

    
872
	/**
873
	 * Returns the nomenclatural status type identified through its label.
874
	 *
875
	 * @param	statusLabel	the nomenclatural status label
876
	 * @return  the nomenclatural status type
877
	 *
878
	 */
879
	public static NomenclaturalStatusType getNomenclaturalStatusTypeByLabel(String statusLabel) throws UnknownCdmTypeException{
880
		if (statusLabel == null){
881
			throw new NullPointerException("Status label is NULL in getNomenclaturalStatusTypeBylabel");
882
		}
883
		NomenclaturalStatusType result = null;
884
		if (labelMap == null){
885
			return null;
886
		}
887
		statusLabel = statusLabel.toLowerCase();
888
		UUID uuid = labelMap.get(statusLabel);
889
		if (uuid != null ){
890
			result = getTermByUuid(uuid);
891
		}
892
		if (result != null){
893
			return result;
894
		}else {
895
			if (statusLabel == null){
896
				statusLabel = "(null)";
897
			}
898
			throw new UnknownCdmTypeException("Unknown nom. status label: " + statusLabel);
899
		}
900

    
901
//		if (statusLabel == null){ throw new NullPointerException("statusLabel is 'null' in getNomenclaturalStatusTypeByLabel");
902
//		}else if (statusLabel.equalsIgnoreCase("Ambiguous")) { return NomenclaturalStatusType.AMBIGUOUS();
903
//		}else if (statusLabel.equalsIgnoreCase("Doubtful")) { return NomenclaturalStatusType.DOUBTFUL();
904
//		}else if (statusLabel.equalsIgnoreCase("Confusum")) { return NomenclaturalStatusType.CONFUSUM();
905
//		}else if (statusLabel.equalsIgnoreCase("Illegitimate")){return NomenclaturalStatusType.ILLEGITIMATE();
906
//		}else if (statusLabel.equalsIgnoreCase("Superfluous")){ return NomenclaturalStatusType.SUPERFLUOUS();
907
//		}else if (statusLabel.equalsIgnoreCase("Rejected")) { return NomenclaturalStatusType.REJECTED();
908
//		}else if (statusLabel.equalsIgnoreCase("Utique Rejected")) { return NomenclaturalStatusType.UTIQUE_REJECTED();
909
//		}else if (statusLabel.equalsIgnoreCase("Conserved Prop")) { return NomenclaturalStatusType.CONSERVED_PROP();
910
//		}else if (statusLabel.equalsIgnoreCase("Orthography Conserved Prop")) { return NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED_PROP();
911
//		}else if (statusLabel.equalsIgnoreCase("Legitimate")) { return NomenclaturalStatusType.LEGITIMATE();
912
//		}else if (statusLabel.equalsIgnoreCase("Alternative")) { return NomenclaturalStatusType.ALTERNATIVE();
913
//		}else if (statusLabel.equalsIgnoreCase("Novum")) { return NomenclaturalStatusType.NOVUM();
914
//		}else if (statusLabel.equalsIgnoreCase("Utique Rejected Prop")) { return NomenclaturalStatusType.UTIQUE_REJECTED_PROP();
915
//		}else if (statusLabel.equalsIgnoreCase("Orthography Conserved")) { return NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED();
916
//		}else if (statusLabel.equalsIgnoreCase("Rejected Prop")) { return NomenclaturalStatusType.REJECTED_PROP();
917
//		}else if (statusLabel.equalsIgnoreCase("Conserved")) { return NomenclaturalStatusType.CONSERVED();
918
//		}else if (statusLabel.equalsIgnoreCase("Sanctioned")) { return NomenclaturalStatusType.SANCTIONED();
919
//		}else if (statusLabel.equalsIgnoreCase("Invalid")) { return NomenclaturalStatusType.INVALID();
920
//		}else if (statusLabel.equalsIgnoreCase("Nudum")){ return NomenclaturalStatusType.NUDUM();
921
//		}else if (statusLabel.equalsIgnoreCase("Combination Invalid")){ return NomenclaturalStatusType.COMBINATION_INVALID();
922
//		}else if (statusLabel.equalsIgnoreCase("Provisional")) { return NomenclaturalStatusType.PROVISIONAL();
923
//		}else if (statusLabel.equalsIgnoreCase("Valid")) { return NomenclaturalStatusType.VALID();
924
//		}else if (statusLabel.equalsIgnoreCase("Opus Utique Oppr")) { return NomenclaturalStatusType.OPUS_UTIQUE_OPPR();
925
//		}else if (statusLabel.equalsIgnoreCase("Subnudum")) { return NomenclaturalStatusType.SUBNUDUM();
926
//		}else {
927
//			if (statusLabel == null){
928
//				statusLabel = "(null)";
929
//			}
930
//			throw new eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException("Unknown NomenclaturalStatusType abbreviation: " + statusLabel);
931
//		}
932
	}
933

    
934

    
935
	/**
936
	 * Fills <i>this</i> nomenclatural status type with contents (uuid, uri,
937
	 * description text, label and label abbreviation) coming from a csv line.
938
	 * The implicit language for the description text is "latin".
939
	 * This method overrides the method of {@link eu.etaxonomy.cdm.model.common.DefinedTermBase DefinedTermBase}.
940
	 *
941
	 * @param	csvLine 	the (ordered) list of substrings from a csv string
942
	 * 						to be used to fill <i>this</i> nomenclatural status type
943
	 * @see					#NomenclaturalStatusType(String, String, String)
944
	 * @see					#readCsvLine(List, Language)
945
	 * @see					eu.etaxonomy.cdm.model.common.DefinedTermBase#readCsvLine(List)
946
	 */
947

    
948
	@Override
949
    public NomenclaturalStatusType readCsvLine(Class<NomenclaturalStatusType> termClass, List<String> csvLine, Map<UUID,DefinedTermBase> terms, boolean abbrevAsId) {   //TODO should be List<String> but makes error for some strange reason
950
		try {
951
			NomenclaturalStatusType newInstance = termClass.newInstance();
952
			DefinedTermBase.readCsvLine(newInstance, csvLine, Language.LATIN(), abbrevAsId);
953
			return newInstance;
954
		} catch (Exception e) {
955
			e.printStackTrace();
956
			throw new RuntimeException(e);
957
		}
958
	}
959

    
960
	@Override
961
	protected void setDefaultTerms(TermVocabulary<NomenclaturalStatusType> termVocabulary) {
962
		if (termVocabulary.getUuid().equals(uuidIcnafpNomStatusVocabulary)){
963
			termMap = new HashMap<UUID, NomenclaturalStatusType>();
964
			abbrevMap = new HashMap<String, UUID>();
965
			labelMap = new HashMap<String, UUID>();
966
			for (NomenclaturalStatusType term : termVocabulary.getTerms()){
967
				termMap.put(term.getUuid(), term);
968
				addStatusType(term, abbrevMap, labelMap);
969
			}
970
		}else if (termVocabulary.getUuid().equals(uuidIcznNomStatusVocabulary)){
971
			zooTermMap = new HashMap<UUID, NomenclaturalStatusType>();
972
			zooAbbrevMap = new HashMap<String, UUID>();
973
			zooLabelMap = new HashMap<String, UUID>();
974
			for (NomenclaturalStatusType term : termVocabulary.getTerms()){
975
				zooTermMap.put(term.getUuid(), term);
976
				addStatusType(term, zooAbbrevMap, zooLabelMap);
977
			}
978
		}else{
979
			throw new IllegalArgumentException("Unknown Nom.Status Vocabulary");
980
		}
981
	}
982

    
983
	/**
984
	 * Adds the status type to the (abbreviated) label maps
985
	 * @param term
986
	 */
987
	private void addStatusType(NomenclaturalStatusType statusType, Map<String, UUID> abbrevMap, Map<String, UUID> labelMap ) {
988
		if (statusType == null){
989
			logger.warn("statusType is NULL");
990
			return;
991
		}
992
		List<Language> list = new ArrayList<Language>();
993
		list.add(Language.LATIN());
994
		list.add(Language.ENGLISH());
995
		list.add(Language.DEFAULT());
996

    
997
		Representation representation = statusType.getPreferredRepresentation(list);
998
		if (representation != null){
999

    
1000
			String abbrevLabel = representation.getAbbreviatedLabel();
1001
			String label = representation.getLabel();
1002
			if (abbrevLabel == null){
1003
				logger.warn("label is NULL");
1004
				return;
1005
			}
1006

    
1007
			//add to map
1008
			abbrevMap.put(abbrevLabel, statusType.getUuid());
1009
			labelMap.put(label.toLowerCase(), statusType.getUuid());
1010
		}
1011

    
1012
	}
1013

    
1014

    
1015

    
1016
	/**
1017
	 * NomenclaturalStatusType should always be shown in latin, therefore the only existing representation
1018
	 * is the latin one. In case we pass in another Language to this method it will return a <code>null</code> representation.
1019
	 *
1020
	 * In case the representation becomes null, we fall back to the latin representation.
1021
	 *
1022
	 */
1023
	@Override
1024
	public Representation getRepresentation(Language lang) {
1025
		Representation representation = super.getRepresentation(lang);
1026

    
1027
		if(representation == null){
1028
			representation = super.getRepresentation(Language.LATIN());
1029
		}
1030

    
1031
		return representation;
1032
	}
1033

    
1034

    
1035
}
(15-15/28)