Project

General

Profile

Download (41.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
package eu.etaxonomy.cdm.model.name;
10

    
11
import java.util.ArrayList;
12
import java.util.HashMap;
13
import java.util.List;
14
import java.util.Map;
15
import java.util.UUID;
16

    
17
import javax.persistence.Entity;
18
import javax.persistence.Transient;
19
import javax.validation.constraints.NotNull;
20
import javax.xml.bind.annotation.XmlAccessType;
21
import javax.xml.bind.annotation.XmlAccessorType;
22
import javax.xml.bind.annotation.XmlAttribute;
23
import javax.xml.bind.annotation.XmlType;
24

    
25
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
26
import org.hibernate.annotations.Type;
27
import org.hibernate.envers.Audited;
28

    
29
import eu.etaxonomy.cdm.model.common.Language;
30
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
31
import eu.etaxonomy.cdm.model.term.OrderedTermBase;
32
import eu.etaxonomy.cdm.model.term.Representation;
33
import eu.etaxonomy.cdm.model.term.TermType;
34
import eu.etaxonomy.cdm.model.term.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
 * @since 10.07.2008
59
 */
60
@XmlAccessorType(XmlAccessType.FIELD)
61
@XmlType(name = "NomenclaturalStatusType", propOrder = {
62
        "nomenclaturalStanding"}
63
)
64
@Entity
65
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
66
//@Indexed(index = "eu.etaxonomy.cdm.model.term.DefinedTermBase")
67
@Audited
68
public class NomenclaturalStatusType
69
        extends OrderedTermBase<NomenclaturalStatusType>
70
        implements INomenclaturalStanding {
71

    
72
	private static final long serialVersionUID = 1337101678484153972L;
73

    
74
	private static Logger logger = LogManager.getLogger(NomenclaturalStatusType.class);
75

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

    
79
	private static final UUID uuidAmbiguous = UUID.fromString("90f5012b-705b-4488-b4c6-002d2bc5198e");
80
	private static final UUID uuidDoubtful = UUID.fromString("0ffeb39e-872e-4c0f-85ba-a4150d9f9e7d");
81
	private static final UUID uuidConfusum = UUID.fromString("24955174-aa5c-4e71-a2fd-3efc79e885db");
82
	private static final UUID uuidIllegitimate = UUID.fromString("b7c544cf-a375-4145-9d3e-4b97f3f18108");
83
	private static final UUID uuidSuperfluous = UUID.fromString("6890483a-c6ba-4ae1-9ab1-9fbaa5736ce9");
84
	private static final UUID uuidRejected = UUID.fromString("48107cc8-7a5b-482e-b438-efbba050b851");
85
	private static final UUID uuidUtiqueRejected = UUID.fromString("04338fdd-c12a-402f-a1ca-68b4bf0be042");
86
	private static final UUID uuidConservedProp = UUID.fromString("82bab006-5aed-4301-93ec-980deb30cbb1");
87
	private static final UUID uuidOrthographyConservedProp = UUID.fromString("02f82bc5-1066-454b-a023-11967cba9092");
88
	private static final UUID uuidLegitimate = UUID.fromString("51a3613c-b53b-4561-b0cd-9163d91c15aa");
89
	private static final UUID uuidAlternative = UUID.fromString("3b8a8519-420f-4dfa-b050-b410cc257961");
90
	private static final UUID uuidNovum = UUID.fromString("05fcb68f-af60-4851-b912-892512058897");
91
	private static final UUID uuidUtiqueRejectedProp = UUID.fromString("643ee07f-026c-426c-b838-c778c8613383");
92
	private static final UUID uuidOrthographyConserved = UUID.fromString("34a7d383-988b-4117-b8c0-52b947f8c711");
93
	private static final UUID uuidRejectedProp = UUID.fromString("248e44c2-5436-4526-a352-f7467ecebd56");
94
	private static final UUID uuidConserved = UUID.fromString("6330f719-e2bc-485f-892b-9f882058a966");
95
	private static final UUID uuidSanctioned = UUID.fromString("1afe55c4-76aa-46c0-afce-4dc07f512733");
96
	private static final UUID uuidInvalid = UUID.fromString("b09d4f51-8a77-442a-bbce-e7832aaf46b7");
97
	private static final UUID uuidNudum = UUID.fromString("e0d733a8-7777-4b27-99a3-05ab50e9f312");
98
	private static final UUID uuidCombinationInvalid = UUID.fromString("f858e619-7b7f-4225-913b-880a2143ec83");
99
	private static final UUID uuidCombinationIllegitimate = UUID.fromString("d901d455-4e01-45cb-b653-01a840b97eed");
100
	private static final UUID uuidProvisional = UUID.fromString("a277507e-ad93-4978-9419-077eb889c951");
101
	private static final UUID uuidValid = UUID.fromString("bd036217-5499-4ccd-8f4c-72e06158db93");
102
	private static final UUID uuidOpusUtiqueOppr = UUID.fromString("a5055d80-dbba-4660-b091-a1835d59fe7c");
103
	private static final UUID uuidSubnudum = UUID.fromString("92a76bd0-6ea8-493f-98e0-4be0b98c092f");
104
	private static final UUID uuidOrthographyRejected = UUID.fromString("39a25673-f716-4ec7-ae27-2498fce43166");
105
	private static final UUID uuidConservedDesig = UUID.fromString("4e9c9702-a74d-4033-9d47-792ad123712c");
106
	private static final UUID uuidIned = UUID.fromString("51429574-c6f9-4aa1-bab9-0bbc5b160ba1");
107
    private static final UUID uuidProtected = UUID.fromString("d071187a-512d-4955-b75c-d1706702f098");
108
    private static final UUID uuidScheda = UUID.fromString("f080cee4-6e0a-466f-986e-bad59e9f4ea7");
109
    private static final UUID uuidProSynonymo = UUID.fromString("54900d07-a18f-4e11-b4be-3929bb78416a");
110
    private static final UUID uuidOrthVar = UUID.fromString("6703745b-9834-42b5-8ddd-fcc6ce572372");
111
    private static final UUID uuidCombIned = UUID.fromString("71c13910-19a4-46b2-9ec8-2a8dbd45cd83");
112

    
113

    
114
	private static final UUID uuidCombNov = UUID.fromString("ed508710-deef-44b1-96f6-1ce6d2c9c884");
115

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

    
119
	private static final UUID uuidZooNotAvailable = UUID.fromString("6d9ed462-b761-4da3-9304-4749e883d4eb");
120
	private static final UUID uuidZooInvalid = UUID.fromString("2bef7039-c129-410b-815e-2a1f7249127b");
121
	private static final UUID uuidZooSuppressed = UUID.fromString("a61602c7-fbd4-4eb4-98a2-44919db8920b");
122
	private static final UUID uuidZooOblitum = UUID.fromString("6a6f7a88-991f-4f76-8ce9-4110839fae8b");
123

    
124

    
125
    public static NomenclaturalStatusType NewLatinInstance(String description, String label, String labelAbbrev) {
126
        return new NomenclaturalStatusType(description, label, labelAbbrev, Language.LATIN());
127
    }
128

    
129
	public static NomenclaturalStatusType NewInstance(String description, String label, String labelAbbrev, Language language) {
130
		return new NomenclaturalStatusType(description, label, labelAbbrev, language);
131
	}
132

    
133
	public static NomenclaturalStatusType NewInstance(String description, String label, String labelAbbrev) {
134
		return new NomenclaturalStatusType(description, label, labelAbbrev);
135
	}
136

    
137
	protected static Map<UUID, NomenclaturalStatusType> termMap = null;
138
	private static Map<String, UUID> abbrevMap = null;
139
	private static Map<String, UUID> labelMap = null;
140

    
141

    
142
	protected static Map<UUID, NomenclaturalStatusType> zooTermMap = null;
143
	private static Map<String, UUID> zooAbbrevMap = null;
144
	private static Map<String, UUID> zooLabelMap = null;
145

    
146
	protected static NomenclaturalStatusType getTermByUuid(UUID uuid){
147
	    if ((termMap == null || termMap.isEmpty()) && (zooTermMap == null || zooTermMap.isEmpty())){
148
	        return getTermByClassAndUUID(NomenclaturalStatusType.class, uuid);
149
	    }
150
		NomenclaturalStatusType result = null;
151
		if (termMap != null){
152
			result = termMap.get(uuid);
153
		}
154
		if (result == null && zooTermMap != null){
155
			result = zooTermMap.get(uuid);
156
		}
157
		return result;
158
	}
159

    
160
    /**
161
     * The {@link NomenclaturalStanding nomenclatural standing} of a name with a given
162
     * nomenclatural status.
163
     * It is usually needed for correct formatting of a name in a synonymy by e.g. using
164
     * a dash instead of equal sign in front.
165
     */
166
    @XmlAttribute(name ="NomenclaturalStanding")
167
    @NotNull
168
    @Type(type = "eu.etaxonomy.cdm.hibernate.EnumUserType",
169
        parameters = {@org.hibernate.annotations.Parameter(name="enumClass", value="eu.etaxonomy.cdm.model.name.NomenclaturalStanding")}
170
    )
171
    @Audited
172
    private NomenclaturalStanding nomenclaturalStanding;
173

    
174

    
175
//********************************** Constructor *********************************/
176

    
177
  	//for hibernate use only
178
  	@Deprecated
179
  	protected NomenclaturalStatusType() {
180
		super(TermType.NomenclaturalStatusType);
181
	}
182

    
183
	/**
184
	 * Class constructor: creates an additional nomenclatural status type
185
	 * instance with a description (in the {@link eu.etaxonomy.cdm.model.common.Language#DEFAULT() default language}), a label
186
	 * and a label abbreviation.
187
	 *
188
	 * @param	term  		 the string (in the default language) describing the
189
	 * 						 new nomenclatural status type to be created
190
	 * @param	label  		 the string identifying the new nomenclatural status
191
	 * 						 type to be created
192
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
193
	 * 						 new nomenclatural status type to be created
194
	 * @see 				 #NomenclaturalStatusType()
195
	 * @see 				 #readCsvLine(List, Language)
196
	 * @see 				 #readCsvLine(List)
197
	 */
198
	private NomenclaturalStatusType(String term, String label, String labelAbbrev) {
199
		super(TermType.NomenclaturalStatusType, term, label, labelAbbrev);
200
	}
201

    
202
	private NomenclaturalStatusType(String term, String label, String labelAbbrev, Language language) {
203
		super(TermType.NomenclaturalStatusType);
204
		this.addRepresentation(new Representation(term, label, labelAbbrev, language));
205
	}
206

    
207
// ************************ GETTER / SETTER ******************/
208

    
209
    public NomenclaturalStanding getNomenclaturalStanding() {
210
        return nomenclaturalStanding;
211
    }
212

    
213
    public void setNomenclaturalStanding(NomenclaturalStanding nomenclaturalStanding) {
214
        this.nomenclaturalStanding = nomenclaturalStanding;
215
    }
216

    
217
//********* METHODS **************************************
218

    
219
	@Override
220
	public void resetTerms(){
221
		termMap = null;
222
		zooTermMap = null;
223
	}
224

    
225
    @Override
226
    @Transient
227
    public boolean isDesignationOnly(){
228
        //rejected, definitely rejected, confused, ined., comb. ined., ambigous, orth. var., orth. rej.
229
        //cons. prop., orth. cons. prop.
230
        return this.getNomenclaturalStanding() == NomenclaturalStanding.OTHER_DESIGNATION;
231
    }
232

    
233
	@Override
234
    @Transient
235
	public boolean isInvalid(){
236
	    return this.getNomenclaturalStanding().isInvalid();
237
	}
238

    
239
    @Override
240
    @Transient
241
    public boolean isValid(){
242
        return this.getNomenclaturalStanding().isValid();
243
    }
244

    
245
    @Override
246
    @Transient
247
    public boolean isValidExplicit(){
248
        //valid: valid, legitimate, conserved, sanctioned, protected, orth. cons., alternative
249
        //       rej. prop, utique rej prop, nom. cons. des.
250
        return this.getNomenclaturalStanding().isValidExplicit();
251
    }
252

    
253
    @Override
254
    @Transient
255
    public boolean isNoStatus(){
256
        //nom. dub., novum, comb. nov., nom. cons. prop., nom. orth. cons. prop., nom. subnud.
257
        return this.getNomenclaturalStanding().isNoStatus();
258
    }
259

    
260
    @Override
261
    @Transient
262
    public boolean isInvalidExplicit(){
263
        //nom. inval., comb. inval., nom. nud., nom. prov., op. utique oppr., in sched.
264
        //pro syn., "published with alternative name" (TODO)
265
        return this.getNomenclaturalStanding() == NomenclaturalStanding.INVALID;
266
    }
267

    
268
	/**
269
	 * Returns the boolean value indicating whether <i>this</i> nomenclatural status
270
	 * type is itself "legitimate" or a kind of "legitimate" (true)
271
	 * or not (false). Corresponds to "valid" for {@link IZoologicalName zoological names}.<BR>
272
	 * Returns false if <i>this</i> nomenclatural status type is null.<BR>
273
	 * A "valid" (zool.: "available") {@link TaxonName taxon name}, unless "rejected",
274
	 * is "legitimate" if it was not "superfluous" when published
275
	 * or has been later "conserved".<BR>
276
	 *
277
	 * @see  #isInvalid()
278
	 * @see  #isIllegitimate()
279
	 * @see  eu.etaxonomy.cdm.model.term.DefinedTermBase#getKindOf()
280
	 */
281
	@Override
282
    @Transient
283
	public boolean isLegitimate(){
284
	    return this.nomenclaturalStanding.isLegitimate();
285
	}
286

    
287
	/**
288
	 * Returns the boolean value indicating whether <i>this</i> nomenclatural status
289
	 * type is itself "illegitimate" or a kind of "illegitimate" (true)
290
	 * or not (false) - this corresponds to "invalid" for {@link IZoologicalName zoological names} -.
291
	 * Returns false if <i>this</i> nomenclatural status type is null.<BR>
292
	 * A "valid" ("available") {@link TaxonName taxon name}, unless "conserved" or
293
	 * "sanctioned", is "illegitimate" if it was "superfluous" when published
294
	 * or has been later "rejected".
295
	 *
296
	 * @see  #VALID()
297
	 * @see  #isInvalid()
298
	 * @see  #ILLEGITIMATE()
299
	 * @see  #CONSERVED()
300
	 * @see  #SANCTIONED()
301
	 * @see  eu.etaxonomy.cdm.model.term.DefinedTermBase#getKindOf()
302
	 */
303
	@Override
304
    @Transient
305
	public boolean isIllegitimate(){
306
	    //nom. illeg., comb. illeg., nom. superfl.,
307
	    //zoo nom. inval., zoo suppressed,
308
	    return this.nomenclaturalStanding.isIllegitimate();
309
	}
310

    
311
	/**
312
	 * Returns the nomenclatural status type "ambiguous". A "valid"
313
	 * ("available") {@link TaxonName taxon name} is "ambiguous" if it has been used so long
314
	 * by different authors in different senses (other than the originally
315
	 * intended) that it has become a persistent cause of error and confusion.<BR>
316
	 * An "ambiguous" taxon name is treated as if "rejected" and is therefore
317
	 * also "illegitimate" ("invalid" for {@link IZoologicalName zoological names}).
318
	 *
319
	 * @see  #VALID()
320
	 * @see  #REJECTED()
321
	 * @see  #isIllegitimate()
322
	 */
323
	public static final NomenclaturalStatusType AMBIGUOUS(){
324
		return getTermByUuid(uuidAmbiguous);
325
	}
326

    
327
	/**
328
	 * Returns the nomenclatural status type "doubtful" (dubious). A "valid"
329
	 * ("available") {@link TaxonName taxon name} is "doubtful" if its
330
	 * application is uncertain; the confusion being derived from an incomplete
331
	 * or confusing description.<BR>
332
	 * A "doubtful" taxon name is treated as if "rejected" and is therefore
333
	 * also "illegitimate" (("invalid" for {@link IZoologicalName zoological names}).
334
	 *
335
	 * @see  #VALID()
336
	 * @see  #REJECTED()
337
	 * @see  #isIllegitimate()
338
	 */
339
	public static final NomenclaturalStatusType DOUBTFUL(){
340
		return getTermByUuid(uuidDoubtful);
341
	}
342

    
343
	/**
344
	 * Returns the nomenclatural status type "confusum". A "valid" ("available")
345
	 * {@link TaxonName taxon name} is "confusum" if it has been widely
346
	 * and persistently used for a taxon or taxa not including its type.<BR>
347
	 * A "confusum" taxon name is treated as if "rejected" and is therefore
348
	 * also "illegitimate" ("invalid" for {@link IZoologicalName zoological names}).
349
	 *
350
	 * @see  #VALID()
351
	 * @see  #REJECTED()
352
	 * @see  #isIllegitimate()
353
	 */
354
	public static final NomenclaturalStatusType CONFUSUM(){
355
		return getTermByUuid(uuidConfusum);
356
	}
357

    
358
	/**
359
	 * Returns the nomenclatural status type "illegitimate" ("invalid" for
360
	 * {@link IZoologicalName zoological names}). A "valid" ("available")
361
	 * {@link TaxonName taxon name}, unless "conserved" or "sanctioned", is "illegitimate"
362
	 * if it was "superfluous" when published or has been later "rejected".<BR>
363
	 *
364
	 * @see  #VALID()
365
	 * @see  #SUPERFLUOUS()
366
	 * @see  #REJECTED()
367
	 */
368
	public static final NomenclaturalStatusType ILLEGITIMATE(){
369
		return getTermByUuid(uuidIllegitimate);
370
	}
371

    
372
	/**
373
	 * Returns the nomenclatural status type "superfluous". A "valid"
374
	 * ("available") {@link TaxonName taxon name} is "superfluous" if, when published,
375
	 * the taxon to which it was applied, as circumscribed by its {@link NonViralName#getCombinationAuthorship() author},
376
	 * definitely included the type of a name which ought to have been adopted,
377
	 * or of which the epithet ought to have been adopted, under the rules of
378
	 * the {@link NomenclaturalCode nomenclature code}, and if it has not been later declared
379
	 * "conserved" or "sanctioned" by the competent authorities.<BR>
380
	 * A "superfluous" taxon name is therefore also "illegitimate" ("invalid" for
381
	 * {@link IZoologicalName zoological names}).
382
	 *
383
	 * @see  #VALID()
384
	 * @see  #CONSERVED()
385
	 * @see  #SANCTIONED()
386
	 * @see  #isIllegitimate()
387
	 */
388
	public static final NomenclaturalStatusType SUPERFLUOUS(){
389
		return getTermByUuid(uuidSuperfluous);
390
	}
391

    
392
	/**
393
	 * Returns the nomenclatural status type "rejected". A "valid" ("available")
394
	 * {@link TaxonName taxon name} is "rejected" if, even though by the strict
395
	 * application of the rules of the {@link NomenclaturalCode nomenclature code}, and especially
396
	 * of the principle of priority, it should be "legitimate" ("valid" for
397
	 * {@link IZoologicalName zoological names}), competent authorities decided to handle
398
	 * it as "illegitimate".<BR>
399
	 * A "rejected" taxon name is therefore also "illegitimate" ("invalid" for
400
	 * zoological names). A "rejected" taxon name is always rejected in favour
401
	 * of a "conserved" taxon name.
402
	 *
403
	 * @see  #VALID()
404
	 * @see  #isLegitimate()
405
	 * @see  #isIllegitimate()
406
	 * @see  #CONSERVED()
407
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
408
	 */
409
	public static final NomenclaturalStatusType REJECTED(){
410
		return getTermByUuid(uuidRejected);
411
	}
412

    
413
	/**
414
	 * Returns the nomenclatural status type "utique rejected". A "valid"
415
	 * ("available") {@link TaxonName taxon name} is "utique rejected" if it is rejected
416
	 * outright (without being rejected in favour of a "conserved" taxon name).<BR>
417
	 * An "utique rejected" taxon name is therefore also "illegitimate"
418
	 * ("invalid" for zoological names).
419
	 *
420
	 * @see  #REJECTED()
421
	 * @see  #VALID()
422
	 * @see  #isIllegitimate()
423
	 * @see  #CONSERVED()
424
	 */
425
	public static final NomenclaturalStatusType UTIQUE_REJECTED(){
426
		return getTermByUuid(uuidUtiqueRejected);
427
	}
428

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

    
453
    /**
454
     * Returns the nomenclatural status type "designated to be conserved". A
455
     * "valid" ("available") {@link TaxonName taxon name} is "designated to be conserved".
456
     * The name is considered to be legitimate as it has been decided by the General Committee
457
     * though not yet ratified by the Int. Bot./Zool. Congr.
458
     *
459
     * NOTE: This interpretation needs further clarification.
460
     *
461
     * {@link https://dev.e-taxonomy.eu/redmine/issues/5662}
462
     *
463
     * @see  #VALID()
464
     * @see  #isIllegitimate()
465
     * @see  #isLegitimate()
466
     * @see  #CONSERVED()
467
     * @see  #CONSERVED_PROP()()
468
     * @see  NameRelationshipType#CONSERVED_AGAINST()
469
     */
470
    public static final NomenclaturalStatusType CONSERVED_DESIG(){
471
        return getTermByUuid(uuidConservedDesig);
472
    }
473

    
474
	/**
475
	 * Returns the nomenclatural status type "proposed to be conserved
476
	 * (orthography)". A {@link TaxonName taxon name} is "proposed to be conserved
477
	 * (orthography)" if, even though originally published with another
478
	 * spelling, it has been submitted to competent authorities in order to
479
	 * decide whether the proposed alternative spelling should be "conserved".<BR>
480
	 * A "proposed to be conserved (orthography)" taxon name is therefore still
481
	 * "illegitimate" ("invalid" for {@link IZoologicalName zoological names}).
482
	 *
483
	 * @see  #isIllegitimate()
484
	 * @see  #CONSERVED_PROP()
485
	 * @see  #CONSERVED()
486
	 * @see  NameRelationshipType#ORTHOGRAPHIC_VARIANT()
487
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
488
	 */
489
	public static final NomenclaturalStatusType ORTHOGRAPHY_CONSERVED_PROP(){
490
		return getTermByUuid(uuidOrthographyConservedProp);
491
	}
492

    
493
	/**
494
	 * Returns the nomenclatural status type "legitimate" ("valid" for
495
	 * {@link IZoologicalName zoological names}). A "valid" ("available")
496
	 * {@link TaxonName taxon name}, unless "rejected", is "legitimate" if it was not
497
	 * "superfluous" when published or has been later "conserved".<BR>
498
	 *
499
	 * @see  #VALID()
500
	 * @see  #SUPERFLUOUS()
501
	 * @see  #CONSERVED()
502
	 */
503
	public static final NomenclaturalStatusType LEGITIMATE(){
504
		return getTermByUuid(uuidLegitimate);
505
	}
506

    
507
	/**
508
	 * Returns the nomenclatural status type "alternative". A family
509
	 * {@link BotanicalName botanical name} is "alternative" if it is a classical name
510
	 * long in use, in some cases even before 1753, and is considered as
511
	 * {@link NomenclaturalStatusType#VALID() "valid"} although it does not follow the rules for
512
	 * family names (see Article 18 of the ICBN).<BR>
513
	 * An "alternative" taxon name is treated as if "conserved" and is therefore
514
	 * also "legitimate".
515
	 *
516
	 * @see  #VALID()
517
	 * @see  #CONSERVED()
518
	 * @see  #isLegitimate()
519
	 * @see  NameRelationshipType#ALTERNATIVE_NAME()
520
	 */
521
	public static final NomenclaturalStatusType ALTERNATIVE(){
522
		return getTermByUuid(uuidAlternative);
523
	}
524

    
525
	/**
526
	 * Returns the nomenclatural status type "novum". A "valid"
527
	 * ("available") {@link TaxonName taxon name} is "novum" if it has been created
528
	 * in order either to replace an earlier name that is "illegitimate" or to
529
	 * avoid the building of a "later homonym".<BR>
530
	 * A "novum" taxon name is therefore also "legitimate" ("valid" for
531
	 * {@link IZoologicalName zoological names}).
532
	 *
533
	 * @see  #VALID()
534
	 * @see  #isIllegitimate()
535
	 * @see  NameRelationshipType#REPLACED_SYNONYM()
536
	 * @see  NameRelationshipType#BLOCKING_NAME_FOR()
537
	 */
538
	public static final NomenclaturalStatusType NOVUM(){
539
		return getTermByUuid(uuidNovum);
540
	}
541

    
542
	/**
543
	 * Returns the nomenclatural status type "proposed to be utique rejected". A
544
	 * "valid" ("available") {@link TaxonName taxon name} is "proposed to be utique rejected"
545
	 * if, even though by the strict application of the rules of
546
	 * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority,
547
	 * it is "legitimate" ("valid" for {@link IZoologicalName zoological names}),
548
	 * it has been submitted to competent authorities in order to decide whether
549
	 * it should be handled as "illegitimate" (without to be rejected in favour
550
	 * of a "conserved" taxon name).<BR>
551
	 * A "proposed to be utique rejected" taxon name is therefore still "legitimate"
552
	 * ("valid" for zoological names).
553
	 *
554
	 * @see  #VALID()
555
	 * @see  #isLegitimate()
556
	 * @see  #isIllegitimate()
557
	 * @see  #REJECTED()
558
	 * @see  #REJECTED_PROP()
559
	 */
560
	public static final NomenclaturalStatusType UTIQUE_REJECTED_PROP(){
561
		return getTermByUuid(uuidUtiqueRejectedProp);
562
	}
563

    
564
	/**
565
	 * Returns the nomenclatural status type "conserved (orthography)". A
566
	 * {@link TaxonName taxon name} is "conserved (orthography)" if competent authorities
567
	 * decided to conserve a different spelling to the one published originally.<BR>
568
	 * A "conserved (orthography)" taxon name is "conserved" and hence
569
	 * "legitimate" ("valid" for {@link IZoologicalName zoological names}).
570
	 *
571
	 * @see  #isLegitimate()
572
	 * @see  #CONSERVED()
573
	 * @see  #ORTHOGRAPHY_CONSERVED_PROP()
574
	 * @see  NameRelationshipType#ORTHOGRAPHIC_VARIANT()
575
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
576
	 */
577
	public static final NomenclaturalStatusType ORTHOGRAPHY_CONSERVED(){
578
		return getTermByUuid(uuidOrthographyConserved);
579
	}
580

    
581
    /**
582
     * Returns the nomenclatural status type "orthography rejected". <BR>
583
     * TBC.
584
     * See also {@link https://dev.e-taxonomy.eu/redmine/issues/5649}
585
     *
586
     * @see  #ORTHOGRAPHY_CONSERVED()
587
     * @see  #REJECTED()
588
     * @see  #isIllegitimate()
589
     */
590
    public static final NomenclaturalStatusType ORTHOGRAPHY_REJECTED(){
591
        return getTermByUuid(uuidOrthographyRejected);
592
    }
593

    
594
	/**
595
	 * Returns the nomenclatural status type "proposed to be rejected". A
596
	 * "valid" ("available") {@link TaxonName taxon name} is "proposed to be rejected"
597
	 * if, even though by the strict application of the rules of
598
	 * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority,
599
	 * it should be "legitimate" ("valid" for {@link IZoologicalName zoological names}),
600
	 * it has been submitted to competent authorities in order to decide whether
601
	 * it should be handled as "illegitimate".<BR>
602
	 * A "proposed to be rejected" taxon name is therefore still "legitimate"
603
	 * ("valid" for zoological names). A "proposed to be rejected" taxon name is always
604
	 * to be rejected in favour of a "proposed to be conserved" taxon name.
605
	 *
606
	 * @see  #VALID()
607
	 * @see  #isLegitimate()
608
	 * @see  #isIllegitimate()
609
	 * @see  #REJECTED()
610
	 * @see  #CONSERVED_PROP()
611
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
612
	 */
613
	public static final NomenclaturalStatusType REJECTED_PROP(){
614
		return getTermByUuid(uuidRejectedProp);
615
	}
616

    
617

    
618
	/**
619
	 * Returns the nomenclatural status type "conserved". A "valid"
620
	 * ("available") {@link TaxonName taxon name} is "conserved" if, even though by the strict
621
	 * application of the rules of the {@link NomenclaturalCode nomenclature code}, and especially of
622
	 * the principle of priority, it should be "illegitimate" ("invalid" for
623
	 * {@link IZoologicalName zoological names}), competent authorities decided to handle
624
	 * it as "legitimate".<BR>
625
	 * A "conserved" taxon name is therefore also "legitimate" ("valid" for
626
	 * zoological names).
627
	 *
628
	 * @see  #VALID()
629
	 * @see  #isIllegitimate()
630
	 * @see  #isLegitimate()
631
	 * @see  NameRelationshipType#CONSERVED_AGAINST()
632
	 */
633
	public static final NomenclaturalStatusType CONSERVED(){
634
		return getTermByUuid(uuidConserved);
635
	}
636

    
637
	/**
638
	 * Returns the nomenclatural status type "sanctioned". {@link BotanicalName Botanical names}
639
	 * for fungi are "sanctioned" if they were published in the opera mentioned
640
	 * in Article 13.1d of the {@link NomenclaturalCode#ICBN() ICBN}.<BR>
641
	 * A "sanctioned" taxon name is treated as if "conserved" and is therefore
642
	 * also "legitimate".
643
	 *
644
	 * @see  #VALID()
645
	 * @see  #CONSERVED()
646
	 * @see  #isLegitimate()
647
	 */
648
	public static final NomenclaturalStatusType SANCTIONED(){
649
		return getTermByUuid(uuidSanctioned);
650
	}
651

    
652
	/**
653
	 * Returns the nomenclatural status type "invalid" (this corresponds to
654
	 * "not available" for {@link IZoologicalName zoological names}). The use of "invalid"
655
	 * {@link TaxonName taxon names} should be avoided.<BR>
656
	 * A taxon name is "invalid" if it is not "valid"; this means that
657
	 * the taxon name:<ul>
658
	 * <li>has not been effectively published or
659
	 * <li>has a form which does not comply with the rules of the
660
	 * 	   {@link NomenclaturalCode nomenclature code} or
661
	 * <li>is not accompanied by a description or diagnosis or by a reference to
662
	 * 	   such a previously published description or diagnosis
663
	 * </ul>
664
	 *
665
	 * @see  #VALID()
666
	 * @see  #isInvalid()
667
	 * @see  #ILLEGITIMATE()
668
	 */
669
	public static final NomenclaturalStatusType INVALID(){
670
		return getTermByUuid(uuidInvalid);
671
	}
672

    
673
	/**
674
	 * Returns the nomenclatural status type "nudum". A {@link TaxonName taxon name} is "nudum"
675
	 * if its publication is not accompanied by a description or diagnosis or
676
	 * by a reference to such a previously published description or diagnosis.<BR>
677
	 * A "nudum" taxon name is therefore also "invalid" ("not available" for
678
	 * {@link IZoologicalName zoological names}).
679
	 *
680
	 * @see  #isInvalid()
681
	 */
682
	public static final NomenclaturalStatusType NUDUM(){
683
		return getTermByUuid(uuidNudum);
684
	}
685

    
686
	/**
687
	 * Returns the nomenclatural status type "invalid combination". A
688
	 * {@link TaxonName bi- or trinomial} is an "invalid combination" if its
689
	 * {@link NonViralName#getCombinationAuthorship() author} did not definitely associate the final
690
	 * epithet with the name of the genus or species, or with its abbreviation.<BR>
691
	 * An "invalid combination" taxon name is therefore also "invalid"
692
	 * ("not available" for {@link IZoologicalName zoological names}).
693
	 *
694
	 * @see  #isInvalid()
695
	 */
696
	public static final NomenclaturalStatusType COMBINATION_INVALID(){
697
		return getTermByUuid(uuidCombinationInvalid);
698
	}
699

    
700
	/**
701
	 * Returns the nomenclatural status type "illegitimate combination".
702
	 * TODO explanation
703
	 *
704
	 * @see  #isInvalid()
705
	 */
706
	public static final NomenclaturalStatusType COMBINATION_ILLEGITIMATE(){
707
		return getTermByUuid(uuidCombinationIllegitimate);
708
	}
709

    
710
	/**
711
	 * Returns the nomenclatural status type "provisional". A {@link TaxonName taxon name} is
712
	 * "provisional" if it is not validly published, because not finally accepted by the author<BR>
713
	 * Some people use it in the same way as {@link #INED() ined.}
714
	 *
715
	 * @see #INED()
716
	 * @see  #isInvalid()
717
	 */
718
	public static final NomenclaturalStatusType PROVISIONAL(){
719
		return getTermByUuid(uuidProvisional);
720
	}
721

    
722
    /**
723
     * Returns the nomenclatural status type "ined.". A {@link TaxonName taxon name} is
724
     * "inedited" if it it has not yet been published.<BR>
725
     * An inedited taxon name is therefore also "invalid" (bot.) / "not available (zool.)
726
     *<BR>
727
     * see also https://dev.e-taxonomy.eu/redmine/issues/5896
728
     *
729
     * @see #PROVISIONAL()
730
     * @see  #isInvalid()
731
     * @return
732
     */
733
    public static final NomenclaturalStatusType INED(){
734
        return getTermByUuid(uuidIned);
735
    }
736

    
737
	/**
738
	 * Returns the nomenclatural status type "valid" (this corresponds to
739
	 * "available" for {@link IZoologicalName zoological names}).<BR>
740
	 * A {@link TaxonName taxon name} is "valid" if it:<ul>
741
	 * <li>has been effectively published and
742
	 * <li>has a form which complies with the rules of the
743
	 * 	   {@link NomenclaturalCode nomenclature code} and
744
	 * <li>is accompanied by a description or diagnosis or by a reference to
745
	 * 	   such a previously published description or diagnosis
746
	 * </ul>
747
	 *
748
	 * @see  #INVALID()
749
	 * @see  #LEGITIMATE()
750
	 */
751
	public static final NomenclaturalStatusType VALID(){
752
		return getTermByUuid(uuidValid);
753
	}
754

    
755
	/**
756
	 * Returns the nomenclatural status type "subnudum". This type is not
757
	 * covered by {@link NomenclaturalCode nomenclature codes}. It appears
758
	 * sometimes in literature and represents the opinion of the author who
759
	 * considers the {@link TaxonName taxon name} to be unusable for an unambiguous
760
	 * taxonomic use.
761
	 *
762
	 * As the name is not explicitly invalid we handle it as valid name.
763
	 * For discussion see #3046#comment:4
764
	 *
765
	 * @see  #AMBIGUOUS()
766
	 * @see  #CONFUSUM()
767
	 *
768
	 */
769
	public static final NomenclaturalStatusType SUBNUDUM(){
770
		return getTermByUuid(uuidSubnudum);
771
	}
772

    
773
	/**
774
	 * Returns the nomenclatural status type "comb. nov.". No further information available for now.
775
	 * @return
776
	 */
777
	//TODO javadoc. this term was added for Flore du Gabon
778
	public static final NomenclaturalStatusType COMB_NOV(){
779
		return getTermByUuid(uuidCombNov);
780
	}
781

    
782
	/**
783
	 * Returns the nomenclatural status type "opus utique oppressum". This type
784
	 * relates to article 32.7 (old ICBN) and article 32.9 as well as App. 6
785
	 * (new {@link NomenclaturalCode#ICBN() ICBN}). This is a reference list of botanical opera, in which all
786
	 * {@link BotanicalName taxon names} (or names of a certain rank) are oppressed. Such a name has the
787
	 * status "invalid" but in contrary to "rejected" not a single name
788
	 * is rejected by the commission but an opus with regard to the validity of
789
	 * all taxon names occurring in it.<BR>
790
	 * An "opus utique oppressum" taxon name is therefore also "invalid"
791
	 * ("not available" for {@link IZoologicalName zoological names}).
792
	 *
793
	 * @see  #isInvalid()
794
	 */
795
	public static final NomenclaturalStatusType OPUS_UTIQUE_OPPR(){
796
		return getTermByUuid(uuidOpusUtiqueOppr);
797
	}
798

    
799
    /**
800
     * Returns the nomenclatural status type "protected name".
801
     * It indicates a valid name.
802
     * "The name of an organism treated as a fungus listed (in App. IIA, III, and IV)
803
     * with its type and treated as conserved against any competing listed or unlisted
804
     * synonyms or homonyms (including sanctioned names), although conservation
805
     * under Art. 14 overrides this protection (Art. F.2.1)."
806
     *
807
     * See also #9272.
808
     *
809
     * @return the nomenclatural status type "protected name"
810
     */
811
    public static final NomenclaturalStatusType PROTECTED_NAME(){
812
        return getTermByUuid(uuidProtected);
813
    }
814

    
815
    /**
816
     * Returns the nomenclatural status type "herbarium designation".
817
     * It indicates an invalid designation (invalid name).
818
     *
819
     * See also #9272.
820
     *
821
     * @return the nomenclatural status type "herbarium designation"
822
     */
823
    public static final NomenclaturalStatusType IN_SCHEDA(){
824
        return getTermByUuid(uuidScheda);
825
    }
826

    
827
    /**
828
     * Returns the nomenclatural status type "published in synonymy".
829
     * It indicates an invalid designation (invalid name).
830
     *
831
     * See also #9272.
832
     *
833
     * @return the nomenclatural status type "published in synonymy"
834
     */
835
    public static final NomenclaturalStatusType PRO_SYNONYMO(){
836
        return getTermByUuid(uuidProSynonymo);
837
    }
838

    
839
    /**
840
     * Returns the nomenclatural status type "orthographical variant".
841
     * This status should only be used if the other name this name is
842
     * an orth. var. for is not known for some reason.
843
     * Otherwise use name relationship {@link NameRelationshipType#ORTHOGRAPHIC_VARIANT()}.
844
     * These 2 types may be unified in future (#9273).
845
     *
846
     * See also #9272.
847
     *
848
     * @return the nomenclatural status type "orthographical variant"
849
     */
850
    public static final NomenclaturalStatusType ORTH_VAR(){
851
        return getTermByUuid(uuidOrthVar);
852
    }
853

    
854
    /**
855
     * Returns the nomenclatural status type "unpublished combination".
856
     * A {@link TaxonName combination} is "inedited" if it it has not yet been published.<BR>
857
     * An inedited taxon name is therefore also "invalid" (bot.) / "not available (zool.)
858
     * <BR><BR>
859
     * {@link https://dev.e-taxonomy.eu/redmine/issues/5795}
860
     *
861
     * @see #INED()
862
     * @see #PROVISIONAL()
863
     * @see #isInvalid()
864
     * @return the nomenclatural status type "comb. ined."
865
     */
866
    public static final NomenclaturalStatusType COMB_INED(){
867
        return getTermByUuid(uuidCombIned);
868
    }
869

    
870
	/**
871
	 * TODO
872
	 * @return
873
	 */
874
	public static final  NomenclaturalStatusType ZOO_NOT_AVAILABLE (){
875
		return getTermByUuid(uuidZooNotAvailable);
876
	}
877

    
878
	/**
879
	 * TODO
880
	 * @return
881
	 */
882
	public static final  NomenclaturalStatusType ZOO_INVALID (){
883
		return getTermByUuid(uuidZooInvalid);
884
	}
885

    
886
	/**
887
	 * TODO
888
	 * @return
889
	 */
890
	public static final  NomenclaturalStatusType ZOO_SUPPRESSED (){
891
		return getTermByUuid(uuidZooSuppressed);
892
	}
893

    
894
	/**
895
	 * TODO
896
	 * @return
897
	 */
898
	public static final  NomenclaturalStatusType ZOO_OBLITUM (){
899
        return getTermByUuid(uuidZooOblitum);
900
    }
901

    
902
	//TODO further Zoological status
903

    
904
	// TODO
905
	// Preliminary implementation for BotanicalNameParser.
906
	// not yet complete
907
	/**
908
	 * Returns the nomenclatural status type identified through its label
909
	 * abbreviation. Preliminary implementation for BotanicalNameParser.
910
	 *
911
	 * @param statusAbbreviation	the label abbreviation
912
	 * @param name                  the taxon name
913
	 * @return  					the nomenclatural status type
914
	 *
915
	 */
916
	public static NomenclaturalStatusType getNomenclaturalStatusTypeByAbbreviation(String statusAbbreviation, ITaxonNameBase name) throws UnknownCdmTypeException{
917
		if (statusAbbreviation == null){
918
			throw new NullPointerException("Abbreviation is NULL in getNomenclaturalStatusTypeByAbbreviation");
919
		}
920
		NomenclaturalStatusType result = null;
921
		statusAbbreviation = normalizeStatusAbbrev(statusAbbreviation);
922

    
923
		//TODO handle undefined names correctly
924
		boolean isZooname = name == null? false : name.getNameType().equals(NomenclaturalCode.ICZN);
925

    
926
		Map<String, UUID> map = isZooname ? zooAbbrevMap : abbrevMap;
927
		if (map == null ){
928
			return null;
929
		}
930
		//non unique abbrev
931
		if (! isZooname && statusAbbreviation.equalsIgnoreCase("nom. alternativ.")){
932
			return NomenclaturalStatusType.ALTERNATIVE();
933
		}
934
		UUID uuid = map.get(statusAbbreviation);
935
		if (uuid != null ){
936
			result = getTermByUuid(uuid);
937
		}
938
		if (result != null){
939
			return result;
940
		}else {
941
			throw new UnknownCdmTypeException("Unknown nom. status abbreviation: " + statusAbbreviation);
942
		}
943
	}
944

    
945
    private static String normalizeStatusAbbrev(String statusAbbreviation) {
946
        //#7109 should not happen anymore
947
        if (statusAbbreviation.equalsIgnoreCase("nom. valid")){
948
            statusAbbreviation = "nom. val.";
949
        }
950
        return statusAbbreviation;
951
    }
952

    
953
    /**
954
	 * Returns the nomenclatural status type identified through its label.
955
	 *
956
	 * @param	statusLabel	the nomenclatural status label
957
	 * @return  the nomenclatural status type
958
	 *
959
	 */
960
	public static NomenclaturalStatusType getNomenclaturalStatusTypeByLabel(String statusLabel) throws UnknownCdmTypeException{
961
		if (statusLabel == null){
962
			throw new NullPointerException("Status label is NULL in getNomenclaturalStatusTypeBylabel");
963
		}
964
		NomenclaturalStatusType result = null;
965
		if (labelMap == null){
966
			return null;
967
		}
968
		statusLabel = statusLabel.toLowerCase();
969
		UUID uuid = labelMap.get(statusLabel);
970
		if (uuid != null ){
971
			result = getTermByUuid(uuid);
972
		}
973
		if (result != null){
974
			return result;
975
		}else {
976
			if (statusLabel == null){
977
				statusLabel = "(null)";
978
			}
979
			throw new UnknownCdmTypeException("Unknown nom. status label: " + statusLabel);
980
		}
981
	}
982

    
983
	/**
984
	 * Fills <i>this</i> nomenclatural status type with contents (uuid, uri,
985
	 * description text, label and label abbreviation) coming from a csv line.
986
	 * The implicit language for the description text is "latin".
987
	 * This method overrides the method of {@link eu.etaxonomy.cdm.model.term.DefinedTermBase DefinedTermBase}.
988
	 *
989
	 * @param	csvLine 	the (ordered) list of substrings from a csv string
990
	 * 						to be used to fill <i>this</i> nomenclatural status type
991
	 * @see					#NomenclaturalStatusType(String, String, String)
992
	 * @see					#readCsvLine(List, Language)
993
	 * @see					eu.etaxonomy.cdm.model.term.DefinedTermBase#readCsvLine(List)
994
	 */
995

    
996
	@Override
997
    public NomenclaturalStatusType readCsvLine(Class<NomenclaturalStatusType> termClass, List<String> csvLine, TermType termType,
998
            Map<UUID,DefinedTermBase> terms, boolean abbrevAsId) {   //TODO should be List<String> but makes error for some strange reason
999
		try {
1000
			NomenclaturalStatusType newInstance = termClass.newInstance();
1001
			newInstance.setTermType(termType);
1002
			DefinedTermBase.readCsvLine(newInstance, csvLine, Language.LATIN(), abbrevAsId);
1003
		    String nomenclaturalStanding = csvLine.get(5).trim();  //not in use yet?
1004
		    newInstance.setNomenclaturalStanding(NomenclaturalStanding.getByKey(nomenclaturalStanding));
1005

    
1006
			return newInstance;
1007
		} catch (Exception e) {
1008
			e.printStackTrace();
1009
			throw new RuntimeException(e);
1010
		}
1011
	}
1012

    
1013
	@Override
1014
	protected void setDefaultTerms(TermVocabulary<NomenclaturalStatusType> termVocabulary) {
1015
		if (termVocabulary.getUuid().equals(uuidIcnafpNomStatusVocabulary)){
1016
			termMap = new HashMap<>();
1017
			abbrevMap = new HashMap<>();
1018
			labelMap = new HashMap<>();
1019
			for (NomenclaturalStatusType term : termVocabulary.getTerms()){
1020
				termMap.put(term.getUuid(), term);
1021
				addStatusType(term, abbrevMap, labelMap);
1022
			}
1023
		}else if (termVocabulary.getUuid().equals(uuidIcznNomStatusVocabulary)){
1024
			zooTermMap = new HashMap<>();
1025
			zooAbbrevMap = new HashMap<>();
1026
			zooLabelMap = new HashMap<>();
1027
			for (NomenclaturalStatusType term : termVocabulary.getTerms()){
1028
				zooTermMap.put(term.getUuid(), term);
1029
				addStatusType(term, zooAbbrevMap, zooLabelMap);
1030
			}
1031
		}else{
1032
			throw new IllegalArgumentException("Unknown Nom.Status Vocabulary");
1033
		}
1034
	}
1035

    
1036
	public static void initDefaultTerms() {
1037
        TermVocabulary<NomenclaturalStatusType> vocabulary = getTermByUuid(uuidDoubtful).getVocabulary();
1038
        (new NomenclaturalStatusType()).setDefaultTerms(vocabulary);
1039
    }
1040

    
1041
	/**
1042
	 * Adds the status type to the (abbreviated) label maps
1043
	 * @param term
1044
	 */
1045
	private void addStatusType(NomenclaturalStatusType statusType, Map<String, UUID> abbrevMap, Map<String, UUID> labelMap ) {
1046
		if (statusType == null){
1047
			logger.warn("statusType is NULL");
1048
			return;
1049
		}
1050
		List<Language> list = new ArrayList<>();
1051
		list.add(Language.LATIN());
1052
		list.add(Language.ENGLISH());
1053
		list.add(Language.DEFAULT());
1054

    
1055
		Representation representation = statusType.getPreferredRepresentation(list);
1056
		if (representation != null){
1057

    
1058
			String abbrevLabel = representation.getAbbreviatedLabel();
1059
			String label = representation.getLabel();
1060
			if (abbrevLabel == null){
1061
				logger.warn("label is NULL");
1062
				return;
1063
			}
1064

    
1065
			//add to map
1066
			abbrevMap.put(abbrevLabel, statusType.getUuid());
1067
			labelMap.put(label.toLowerCase(), statusType.getUuid());
1068
		}
1069

    
1070
	}
1071

    
1072
	/**
1073
	 * NomenclaturalStatusType should always be shown in latin, therefore the only existing representation
1074
	 * is the latin one. In case we pass in another Language to this method it will return a <code>null</code> representation.
1075
	 *
1076
	 * In case the representation becomes null, we fall back to the latin representation.
1077
	 *
1078
	 */
1079
	@Override
1080
	public Representation getRepresentation(Language lang) {
1081
		Representation representation = super.getRepresentation(lang);
1082

    
1083
		if(representation == null){
1084
			representation = super.getRepresentation(Language.LATIN());
1085
		}
1086

    
1087
		return representation;
1088
	}
1089
}
(25-25/39)