(no commit message)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / name / NomenclaturalStatusType.java
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 eu.etaxonomy.cdm.model.common.OrderedTermBase;
15 import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
16
17 import org.apache.log4j.Logger;
18
19 import java.util.*;
20 import javax.persistence.*;
21 import javax.xml.bind.annotation.XmlAccessType;
22 import javax.xml.bind.annotation.XmlAccessorType;
23 import javax.xml.bind.annotation.XmlType;
24
25 /**
26 * http://rs.tdwg.org/ontology/voc/TaxonName.rdf#PublicationStatus
27 * @author m.doering
28 * @version 1.0
29 * @created 08-Nov-2007 13:06:39
30 */
31 @XmlAccessorType(XmlAccessType.FIELD)
32 @XmlType(name = "")
33 @Entity
34 public class NomenclaturalStatusType extends OrderedTermBase<NomenclaturalStatusType> {
35 static Logger logger = Logger.getLogger(NomenclaturalStatusType.class);
36
37 private static final UUID uuidAmbiguous = UUID.fromString("90f5012b-705b-4488-b4c6-002d2bc5198e");
38 private static final UUID uuidDoubtful = UUID.fromString("0ffeb39e-872e-4c0f-85ba-a4150d9f9e7d");
39 private static final UUID uuidConfusum = UUID.fromString("24955174-aa5c-4e71-a2fd-3efc79e885db");
40 private static final UUID uuidIllegitimate = UUID.fromString("b7c544cf-a375-4145-9d3e-4b97f3f18108");
41 private static final UUID uuidSuperfluous = UUID.fromString("6890483a-c6ba-4ae1-9ab1-9fbaa5736ce9");
42 private static final UUID uuidRejected = UUID.fromString("48107cc8-7a5b-482e-b438-efbba050b851");
43 private static final UUID uuidUtiqueRejected = UUID.fromString("04338fdd-c12a-402f-a1ca-68b4bf0be042");
44 private static final UUID uuidConservedProp = UUID.fromString("82bab006-5aed-4301-93ec-980deb30cbb1");
45 private static final UUID uuidOrthographyConservedProp = UUID.fromString("02f82bc5-1066-454b-a023-11967cba9092");
46 private static final UUID uuidLegitimate = UUID.fromString("51a3613c-b53b-4561-b0cd-9163d91c15aa");
47 private static final UUID uuidAlternative = UUID.fromString("3b8a8519-420f-4dfa-b050-b410cc257961");
48 private static final UUID uuidNovum = UUID.fromString("05fcb68f-af60-4851-b912-892512058897");
49 private static final UUID uuidUtiqueRejectedProp = UUID.fromString("643ee07f-026c-426c-b838-c778c8613383");
50 private static final UUID uuidOrthographyConserved = UUID.fromString("34a7d383-988b-4117-b8c0-52b947f8c711");
51 private static final UUID uuidRejectedProp = UUID.fromString("248e44c2-5436-4526-a352-f7467ecebd56");
52 private static final UUID uuidConserved = UUID.fromString("6330f719-e2bc-485f-892b-9f882058a966");
53 private static final UUID uuidSanctioned = UUID.fromString("1afe55c4-76aa-46c0-afce-4dc07f512733");
54 private static final UUID uuidInvalid = UUID.fromString("b09d4f51-8a77-442a-bbce-e7832aaf46b7");
55 private static final UUID uuidNudum = UUID.fromString("e0d733a8-7777-4b27-99a3-05ab50e9f312");
56 private static final UUID uuidCombinationInvalid = UUID.fromString("f858e619-7b7f-4225-913b-880a2143ec83");
57 private static final UUID uuidProvisional = UUID.fromString("a277507e-ad93-4978-9419-077eb889c951");
58 private static final UUID uuidValid = UUID.fromString("bd036217-5499-4ccd-8f4c-72e06158db93");
59 private static final UUID uuidOpusUtiqueOppr = UUID.fromString("a5055d80-dbba-4660-b091-a1835d59fe7c");
60 private static final UUID uuidSubnudum = UUID.fromString("92a76bd0-6ea8-493f-98e0-4be0b98c092f");
61
62
63 public NomenclaturalStatusType() {
64 super();
65 }
66
67 public NomenclaturalStatusType(String term, String label, String labelAbbrev) {
68 super(term, label, labelAbbrev);
69 }
70
71 public static final NomenclaturalStatusType getByUuid(UUID uuid){
72 return (NomenclaturalStatusType) findByUuid(uuid);
73 }
74
75
76 @Transient
77 public boolean isInvalidType(){
78 if (this.equals(INVALID())
79 || this.equals(NUDUM())
80 || this.equals(PROVISIONAL())
81 || this.equals(COMBINATION_INVALID())
82 || this.equals(OPUS_UTIQUE_OPPR())
83 ){
84 return true;
85 }else{
86 return false;
87 }
88 }
89
90 @Transient
91 public boolean isLegitimateType(){
92 if (this.equals(LEGITIMATE()) ||
93 this.equals(NOVUM()) ||
94 this.equals(ALTERNATIVE()) ||
95 this.equals(CONSERVED()) ||
96 this.equals(ORTHOGRAPHY_CONSERVED()) ||
97 this.equals(REJECTED_PROP()) ||
98 this.equals(UTIQUE_REJECTED_PROP())
99 ){
100 return true;
101 }else{
102 return false;
103 }
104 }
105
106 @Transient
107 public boolean isIllegitimateType(){
108 if (this.equals(ILLEGITIMATE()) ||
109 this.equals(SUPERFLUOUS()) ||
110 this.equals(REJECTED()) ||
111 this.equals(UTIQUE_REJECTED()) ||
112 this.equals(CONSERVED_PROP()) ||
113 this.equals(ORTHOGRAPHY_CONSERVED_PROP())
114 ){
115 return true;
116 }else{
117 return false;
118 }
119 }
120
121 public static final NomenclaturalStatusType AMBIGUOUS(){
122 return getByUuid(uuidAmbiguous);
123 }
124
125 public static final NomenclaturalStatusType DOUBTFUL(){
126 return getByUuid(uuidDoubtful);
127 }
128
129 public static final NomenclaturalStatusType CONFUSUM(){
130 return getByUuid(uuidConfusum);
131 }
132
133 public static final NomenclaturalStatusType ILLEGITIMATE(){
134 return getByUuid(uuidIllegitimate);
135 }
136
137 public static final NomenclaturalStatusType SUPERFLUOUS(){
138 return getByUuid(uuidSuperfluous);
139 }
140
141 public static final NomenclaturalStatusType REJECTED(){
142 return getByUuid(uuidRejected);
143 }
144
145 public static final NomenclaturalStatusType UTIQUE_REJECTED(){
146 return getByUuid(uuidUtiqueRejected);
147 }
148
149 public static final NomenclaturalStatusType CONSERVED_PROP(){
150 return getByUuid(uuidConservedProp);
151 }
152
153 public static final NomenclaturalStatusType ORTHOGRAPHY_CONSERVED_PROP(){
154 return getByUuid(uuidOrthographyConservedProp);
155 }
156
157 public static final NomenclaturalStatusType LEGITIMATE(){
158 return getByUuid(uuidLegitimate);
159 }
160
161 public static final NomenclaturalStatusType ALTERNATIVE(){
162 return getByUuid(uuidAlternative);
163 }
164
165 public static final NomenclaturalStatusType NOVUM(){
166 return getByUuid(uuidNovum);
167 }
168
169 public static final NomenclaturalStatusType UTIQUE_REJECTED_PROP(){
170 return getByUuid(uuidUtiqueRejectedProp);
171 }
172
173 public static final NomenclaturalStatusType ORTHOGRAPHY_CONSERVED(){
174 return getByUuid(uuidOrthographyConserved);
175 }
176
177 public static final NomenclaturalStatusType REJECTED_PROP(){
178 return getByUuid(uuidRejectedProp);
179 }
180
181 public static final NomenclaturalStatusType CONSERVED(){
182 return getByUuid(uuidConserved);
183 }
184
185 public static final NomenclaturalStatusType SANCTIONED(){
186 return getByUuid(uuidSanctioned);
187 }
188
189 public static final NomenclaturalStatusType INVALID(){
190 return getByUuid(uuidInvalid);
191 }
192
193 public static final NomenclaturalStatusType NUDUM(){
194 return getByUuid(uuidNudum);
195 }
196
197 public static final NomenclaturalStatusType COMBINATION_INVALID(){
198 return getByUuid(uuidCombinationInvalid);
199 }
200
201 public static final NomenclaturalStatusType PROVISIONAL(){
202 return getByUuid(uuidProvisional);
203 }
204
205 public static final NomenclaturalStatusType VALID(){
206 return getByUuid(uuidValid);
207 }
208
209 /**
210 * Nomenclatural status that is not covered by the ICBN. It appears sometimes in literature and
211 * represents the opinion of the author who considers the name to be unusable for an unambiguous
212 * taxonomic use.
213 * @return
214 */
215 public static final NomenclaturalStatusType SUBNUDUM(){
216 return getByUuid(uuidSubnudum);
217 }
218
219 /**
220 * Relates to article 32.7 (old ICBN) and article 32.9 (new - McNeill et al. 2006: 32) and
221 * App. 5. (Greuter et al. 2000) as well as App. 6 (McNeill et al. 2006) of the International
222 * Code of Botanical Nomenclature. This is a reference list of botanical opera, in which all
223 * names (or names of a certain rank) are oppressed.
224 * Such a name has the status "invalid" but in contrary to "nom. rej." not a single name is rejected
225 * by the commission but an opus with regard to the validity of of the names occurring in it.
226 * @return
227 */
228 public static final NomenclaturalStatusType OPUS_UTIQUE_OPPR(){
229 return getByUuid(uuidOpusUtiqueOppr);
230 }
231
232 //TODO Soraya
233 // orth. var.: orthographic variant
234 // pro syn.: pro synonymo
235
236 /** TODO
237 * preliminary implementation for BotanicalNameParser
238 * * not yet complete
239 */
240 @Transient
241 public static NomenclaturalStatusType getNomenclaturalStatusTypeByAbbreviation(String statusAbbreviation) throws UnknownCdmTypeException{
242 if (statusAbbreviation == null){ throw new NullPointerException("statusAbbreviation is 'null' in getNomenclaturalStatusTypeByAbbreviation");
243 }else if (statusAbbreviation.equalsIgnoreCase("nom. superfl.")){ return NomenclaturalStatusType.SUPERFLUOUS();
244 }else if (statusAbbreviation.equalsIgnoreCase("nom. nud.")){ return NomenclaturalStatusType.NUDUM();
245 }else if (statusAbbreviation.equalsIgnoreCase("nom. illeg.")){return NomenclaturalStatusType.ILLEGITIMATE();
246 }else if (statusAbbreviation.equalsIgnoreCase("nom. inval.")) { return NomenclaturalStatusType.INVALID();
247 }else if (statusAbbreviation.equalsIgnoreCase("nom. cons.")) { return NomenclaturalStatusType.CONSERVED();
248 }else if (statusAbbreviation.equalsIgnoreCase("nom. alternativ.")) { return NomenclaturalStatusType.ALTERNATIVE();
249 }else if (statusAbbreviation.equalsIgnoreCase("nom. altern.")) { return NomenclaturalStatusType.ALTERNATIVE();
250 }else if (statusAbbreviation.equalsIgnoreCase("nom. rej.")) { return NomenclaturalStatusType.REJECTED();
251 }else if (statusAbbreviation.equalsIgnoreCase("nom. rej. prop.")) { return NomenclaturalStatusType.REJECTED_PROP();
252 }else if (statusAbbreviation.equalsIgnoreCase("nom. provis.")) { return NomenclaturalStatusType.PROVISIONAL();
253 }else if (statusAbbreviation.equalsIgnoreCase("nom. subnud.")) { return NomenclaturalStatusType.SUBNUDUM();
254 }else if (statusAbbreviation.equalsIgnoreCase("opus utique oppr.")) { return NomenclaturalStatusType.OPUS_UTIQUE_OPPR();
255
256 //TODO
257 }else {
258 if (statusAbbreviation == null){
259 statusAbbreviation = "(null)";
260 }
261 throw new eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException("Unknown NomenclaturalStatusType abbreviation: " + statusAbbreviation);
262 }
263 }
264
265 }