| 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.HashMap; |
|---|
| 15 | import java.util.List; |
|---|
| 16 | import java.util.Map; |
|---|
| 17 | import java.util.UUID; |
|---|
| 18 | |
|---|
| 19 | import javax.persistence.Entity; |
|---|
| 20 | import javax.persistence.Transient; |
|---|
| 21 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 22 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 23 | import javax.xml.bind.annotation.XmlType; |
|---|
| 24 | |
|---|
| 25 | import org.apache.log4j.Logger; |
|---|
| 26 | import org.hibernate.envers.Audited; |
|---|
| 27 | import org.hibernate.search.annotations.Indexed; |
|---|
| 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.TermVocabulary; |
|---|
| 34 | import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException; |
|---|
| 35 | |
|---|
| 36 | /** |
|---|
| 37 | * The class representing categories of nomenclatural status (like "invalid", |
|---|
| 38 | * "conserved" or "novum") to qualify the use of a particular taxon name string |
|---|
| 39 | * depending on its {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} (original publication), |
|---|
| 40 | * on its {@link NomenclaturalCode nomenclatural code} and on possible decisions of the corresponding |
|---|
| 41 | * competent authorities. Unfortunately the ICBN and the ICZN use sometimes |
|---|
| 42 | * different words for the same meaning or the same word for different meanings |
|---|
| 43 | * (for instance "valid" and "legitimate"). |
|---|
| 44 | * <P> |
|---|
| 45 | * A standard (ordered) list of nomenclatural status type instances will be |
|---|
| 46 | * automatically created as the project starts. But this class allows to extend |
|---|
| 47 | * this standard list by creating new instances of additional nomenclatural |
|---|
| 48 | * status types if needed. The present standard list follows the ICBN |
|---|
| 49 | * terminology. |
|---|
| 50 | * <P> |
|---|
| 51 | * This class corresponds more or less to: <ul> |
|---|
| 52 | * <li> NomenclaturalNoteTypeTerm according to the TDWG ontology |
|---|
| 53 | * <li> NomenclaturalNoteType according to the TCS |
|---|
| 54 | * </ul> |
|---|
| 55 | * |
|---|
| 56 | * @author a.mueller |
|---|
| 57 | * @created 10.07.2008 |
|---|
| 58 | * @version 1.0 |
|---|
| 59 | */ |
|---|
| 60 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 61 | @XmlType(name = "NomenclaturalStatusType") |
|---|
| 62 | @Entity |
|---|
| 63 | @Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase") |
|---|
| 64 | @Audited |
|---|
| 65 | public class NomenclaturalStatusType extends OrderedTermBase<NomenclaturalStatusType> { |
|---|
| 66 | private static final long serialVersionUID = 1337101678484153972L; |
|---|
| 67 | |
|---|
| 68 | private static Logger logger = Logger.getLogger(NomenclaturalStatusType.class); |
|---|
| 69 | |
|---|
| 70 | private static final UUID uuidAmbiguous = UUID.fromString("90f5012b-705b-4488-b4c6-002d2bc5198e"); |
|---|
| 71 | private static final UUID uuidDoubtful = UUID.fromString("0ffeb39e-872e-4c0f-85ba-a4150d9f9e7d"); |
|---|
| 72 | private static final UUID uuidConfusum = UUID.fromString("24955174-aa5c-4e71-a2fd-3efc79e885db"); |
|---|
| 73 | private static final UUID uuidIllegitimate = UUID.fromString("b7c544cf-a375-4145-9d3e-4b97f3f18108"); |
|---|
| 74 | private static final UUID uuidSuperfluous = UUID.fromString("6890483a-c6ba-4ae1-9ab1-9fbaa5736ce9"); |
|---|
| 75 | private static final UUID uuidRejected = UUID.fromString("48107cc8-7a5b-482e-b438-efbba050b851"); |
|---|
| 76 | private static final UUID uuidUtiqueRejected = UUID.fromString("04338fdd-c12a-402f-a1ca-68b4bf0be042"); |
|---|
| 77 | private static final UUID uuidConservedProp = UUID.fromString("82bab006-5aed-4301-93ec-980deb30cbb1"); |
|---|
| 78 | private static final UUID uuidOrthographyConservedProp = UUID.fromString("02f82bc5-1066-454b-a023-11967cba9092"); |
|---|
| 79 | private static final UUID uuidLegitimate = UUID.fromString("51a3613c-b53b-4561-b0cd-9163d91c15aa"); |
|---|
| 80 | private static final UUID uuidAlternative = UUID.fromString("3b8a8519-420f-4dfa-b050-b410cc257961"); |
|---|
| 81 | private static final UUID uuidNovum = UUID.fromString("05fcb68f-af60-4851-b912-892512058897"); |
|---|
| 82 | private static final UUID uuidUtiqueRejectedProp = UUID.fromString("643ee07f-026c-426c-b838-c778c8613383"); |
|---|
| 83 | private static final UUID uuidOrthographyConserved = UUID.fromString("34a7d383-988b-4117-b8c0-52b947f8c711"); |
|---|
| 84 | private static final UUID uuidRejectedProp = UUID.fromString("248e44c2-5436-4526-a352-f7467ecebd56"); |
|---|
| 85 | private static final UUID uuidConserved = UUID.fromString("6330f719-e2bc-485f-892b-9f882058a966"); |
|---|
| 86 | private static final UUID uuidSanctioned = UUID.fromString("1afe55c4-76aa-46c0-afce-4dc07f512733"); |
|---|
| 87 | private static final UUID uuidInvalid = UUID.fromString("b09d4f51-8a77-442a-bbce-e7832aaf46b7"); |
|---|
| 88 | private static final UUID uuidNudum = UUID.fromString("e0d733a8-7777-4b27-99a3-05ab50e9f312"); |
|---|
| 89 | private static final UUID uuidCombinationInvalid = UUID.fromString("f858e619-7b7f-4225-913b-880a2143ec83"); |
|---|
| 90 | private static final UUID uuidCombinationIllegitimate = UUID.fromString("d901d455-4e01-45cb-b653-01a840b97eed"); |
|---|
| 91 | private static final UUID uuidProvisional = UUID.fromString("a277507e-ad93-4978-9419-077eb889c951"); |
|---|
| 92 | private static final UUID uuidValid = UUID.fromString("bd036217-5499-4ccd-8f4c-72e06158db93"); |
|---|
| 93 | private static final UUID uuidOpusUtiqueOppr = UUID.fromString("a5055d80-dbba-4660-b091-a1835d59fe7c"); |
|---|
| 94 | private static final UUID uuidSubnudum = UUID.fromString("92a76bd0-6ea8-493f-98e0-4be0b98c092f"); |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | private static Map<String, UUID> abbrevMap = null; |
|---|
| 98 | private static Map<String, UUID> labelMap = null; |
|---|
| 99 | |
|---|
| 100 | protected static Map<UUID, NomenclaturalStatusType> termMap = null; |
|---|
| 101 | |
|---|
| 102 | protected static NomenclaturalStatusType getTermByUuid(UUID uuid){ |
|---|
| 103 | if (termMap == null){ |
|---|
| 104 | // DefaultTermInitializer vocabularyStore = new DefaultTermInitializer(); |
|---|
| 105 | // vocabularyStore.initialize(); |
|---|
| 106 | return null; |
|---|
| 107 | } |
|---|
| 108 | return (NomenclaturalStatusType)termMap.get(uuid); |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | // ************* CONSTRUCTORS *************/ |
|---|
| 114 | /** |
|---|
| 115 | * Class constructor: creates a new empty nomenclatural status type instance. |
|---|
| 116 | * |
|---|
| 117 | * @see #NomenclaturalStatusType(String, String, String) |
|---|
| 118 | * @see #readCsvLine(List, Language) |
|---|
| 119 | * @see #readCsvLine(List) |
|---|
| 120 | */ |
|---|
| 121 | public NomenclaturalStatusType() { |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | /** |
|---|
| 125 | * Class constructor: creates an additional nomenclatural status type |
|---|
| 126 | * instance with a description (in the {@link eu.etaxonomy.cdm.model.common.Language#DEFAULT() default language}), a label |
|---|
| 127 | * and a label abbreviation. |
|---|
| 128 | * |
|---|
| 129 | * @param term the string (in the default language) describing the |
|---|
| 130 | * new nomenclatural status type to be created |
|---|
| 131 | * @param label the string identifying the new nomenclatural status |
|---|
| 132 | * type to be created |
|---|
| 133 | * @param labelAbbrev the string identifying (in abbreviated form) the |
|---|
| 134 | * new nomenclatural status type to be created |
|---|
| 135 | * @see #NomenclaturalStatusType() |
|---|
| 136 | * @see #readCsvLine(List, Language) |
|---|
| 137 | * @see #readCsvLine(List) |
|---|
| 138 | */ |
|---|
| 139 | public NomenclaturalStatusType(String term, String label, String labelAbbrev) { |
|---|
| 140 | super(term, label, labelAbbrev); |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | //********* METHODS ************************************** |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | /* (non-Javadoc) |
|---|
| 147 | * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms() |
|---|
| 148 | */ |
|---|
| 149 | @Override |
|---|
| 150 | public void resetTerms(){ |
|---|
| 151 | termMap = null; |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | /** |
|---|
| 155 | * Returns the boolean value indicating whether <i>this</i> nomenclatural status |
|---|
| 156 | * type is itself "invalid" or a kind of "invalid" (true) or not (false) - |
|---|
| 157 | * this corresponds to "not available" for {@link ZoologicalName zoological names} -. |
|---|
| 158 | * Returns false if <i>this</i> nomenclatural status type is null. The use |
|---|
| 159 | * of "invalid" {@link TaxonNameBase taxon names} should be avoided.<BR> |
|---|
| 160 | * A taxon name is "invalid" if it is not "valid"; this means that |
|---|
| 161 | * the taxon name:<ul> |
|---|
| 162 | * <li>has not been effectively published or |
|---|
| 163 | * <li>has a form which does not comply with the rules of the |
|---|
| 164 | * {@link NomenclaturalCode nomenclature code} or |
|---|
| 165 | * <li>is not accompanied by a description or diagnosis or by a reference to |
|---|
| 166 | * such a previously published description or diagnosis |
|---|
| 167 | * </ul> |
|---|
| 168 | * |
|---|
| 169 | * @see #VALID() |
|---|
| 170 | * @see #isIllegitimateType() |
|---|
| 171 | * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#getKindOf() |
|---|
| 172 | */ |
|---|
| 173 | @Transient |
|---|
| 174 | public boolean isInvalidType(){ |
|---|
| 175 | if (this.equals(INVALID()) |
|---|
| 176 | || this.equals(NUDUM()) |
|---|
| 177 | || this.equals(PROVISIONAL()) |
|---|
| 178 | || this.equals(COMBINATION_INVALID()) |
|---|
| 179 | || this.equals(OPUS_UTIQUE_OPPR()) |
|---|
| 180 | ){ |
|---|
| 181 | return true; |
|---|
| 182 | }else{ |
|---|
| 183 | return false; |
|---|
| 184 | } |
|---|
| 185 | } |
|---|
| 186 | |
|---|
| 187 | /** |
|---|
| 188 | * Returns the boolean value indicating whether <i>this</i> nomenclatural status |
|---|
| 189 | * type is itself "legitimate" or a kind of "legitimate" (true) |
|---|
| 190 | * or not (false). - this corresponds to "valid" for {@link ZoologicalName zoological names} -. |
|---|
| 191 | * Returns false if <i>this</i> nomenclatural status type is null.<BR> |
|---|
| 192 | * A "valid" ("available") {@link TaxonNameBase taxon name}, unless "rejected", |
|---|
| 193 | * is "legitimate" if it was not "superfluous" when published |
|---|
| 194 | * or has been later "conserved".<BR> |
|---|
| 195 | * |
|---|
| 196 | * @see #isInvalidType() |
|---|
| 197 | * @see #isIllegitimateType() |
|---|
| 198 | * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#getKindOf() |
|---|
| 199 | */ |
|---|
| 200 | @Transient |
|---|
| 201 | public boolean isLegitimateType(){ |
|---|
| 202 | if (this.equals(LEGITIMATE()) || |
|---|
| 203 | this.equals(NOVUM()) || |
|---|
| 204 | this.equals(ALTERNATIVE()) || |
|---|
| 205 | this.equals(CONSERVED()) || |
|---|
| 206 | this.equals(ORTHOGRAPHY_CONSERVED()) || |
|---|
| 207 | this.equals(REJECTED_PROP()) || |
|---|
| 208 | this.equals(UTIQUE_REJECTED_PROP()) |
|---|
| 209 | ){ |
|---|
| 210 | return true; |
|---|
| 211 | }else{ |
|---|
| 212 | return false; |
|---|
| 213 | } |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | /** |
|---|
| 217 | * Returns the boolean value indicating whether <i>this</i> nomenclatural status |
|---|
| 218 | * type is itself "illegitimate" or a kind of "illegitimate" (true) |
|---|
| 219 | * or not (false) - this corresponds to "invalid" for {@link ZoologicalName zoological names} -. |
|---|
| 220 | * Returns false if <i>this</i> nomenclatural status type is null.<BR> |
|---|
| 221 | * A "valid" ("available") {@link TaxonNameBase taxon name}, unless "conserved" or |
|---|
| 222 | * "sanctioned", is "illegitimate" if it was "superfluous" when published |
|---|
| 223 | * or has been later "rejected". |
|---|
| 224 | * |
|---|
| 225 | * @see #VALID() |
|---|
| 226 | * @see #isInvalidType() |
|---|
| 227 | * @see #ILLEGITIMATE() |
|---|
| 228 | * @see #CONSERVED() |
|---|
| 229 | * @see #SANCTIONED() |
|---|
| 230 | * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#getKindOf() |
|---|
| 231 | */ |
|---|
| 232 | @Transient |
|---|
| 233 | public boolean isIllegitimateType(){ |
|---|
| 234 | if (this.equals(ILLEGITIMATE()) || |
|---|
| 235 | this.equals(SUPERFLUOUS()) || |
|---|
| 236 | this.equals(REJECTED()) || |
|---|
| 237 | this.equals(UTIQUE_REJECTED()) || |
|---|
| 238 | this.equals(CONSERVED_PROP()) || |
|---|
| 239 | this.equals(ORTHOGRAPHY_CONSERVED_PROP()) |
|---|
| 240 | ){ |
|---|
| 241 | return true; |
|---|
| 242 | }else{ |
|---|
| 243 | return false; |
|---|
| 244 | } |
|---|
| 245 | } |
|---|
| 246 | |
|---|
| 247 | /** |
|---|
| 248 | * Returns the nomenclatural status type "ambiguous". A "valid" |
|---|
| 249 | * ("available") {@link TaxonNameBase taxon name} is "ambiguous" if it has been used so long |
|---|
| 250 | * by different authors in different senses (other than the originally |
|---|
| 251 | * intended) that it has become a persistent cause of error and confusion.<BR> |
|---|
| 252 | * An "ambiguous" taxon name is treated as if "rejected" and is therefore |
|---|
| 253 | * also "illegitimate" ("invalid" for {@link ZoologicalName zoological names}). |
|---|
| 254 | * |
|---|
| 255 | * @see #VALID() |
|---|
| 256 | * @see #REJECTED() |
|---|
| 257 | * @see #isIllegitimateType() |
|---|
| 258 | */ |
|---|
| 259 | public static final NomenclaturalStatusType AMBIGUOUS(){ |
|---|
| 260 | return getTermByUuid(uuidAmbiguous); |
|---|
| 261 | } |
|---|
| 262 | |
|---|
| 263 | /** |
|---|
| 264 | * Returns the nomenclatural status type "doubtful" (dubious). A "valid" |
|---|
| 265 | * ("available") {@link TaxonNameBase taxon name} is "doubtful" if its |
|---|
| 266 | * application is uncertain; the confusion being derived from an incomplete |
|---|
| 267 | * or confusing description.<BR> |
|---|
| 268 | * A "doubtful" taxon name is treated as if "rejected" and is therefore |
|---|
| 269 | * also "illegitimate" (("invalid" for {@link ZoologicalName zoological names}). |
|---|
| 270 | * |
|---|
| 271 | * @see #VALID() |
|---|
| 272 | * @see #REJECTED() |
|---|
| 273 | * @see #isIllegitimateType() |
|---|
| 274 | */ |
|---|
| 275 | public static final NomenclaturalStatusType DOUBTFUL(){ |
|---|
| 276 | return getTermByUuid(uuidDoubtful); |
|---|
| 277 | } |
|---|
| 278 | |
|---|
| 279 | /** |
|---|
| 280 | * Returns the nomenclatural status type "confusum". A "valid" ("available") |
|---|
| 281 | * {@link TaxonNameBase taxon name} is "confusum" if it has been widely |
|---|
| 282 | * and persistently used for a taxon or taxa not including its type.<BR> |
|---|
| 283 | * A "confusum" taxon name is treated as if "rejected" and is therefore |
|---|
| 284 | * also "illegitimate" ("invalid" for {@link ZoologicalName zoological names}). |
|---|
| 285 | * |
|---|
| 286 | * @see #VALID() |
|---|
| 287 | * @see #REJECTED() |
|---|
| 288 | * @see #isIllegitimateType() |
|---|
| 289 | */ |
|---|
| 290 | public static final NomenclaturalStatusType CONFUSUM(){ |
|---|
| 291 | return getTermByUuid(uuidConfusum); |
|---|
| 292 | } |
|---|
| 293 | |
|---|
| 294 | /** |
|---|
| 295 | * Returns the nomenclatural status type "illegitimate" ("invalid" for |
|---|
| 296 | * {@link ZoologicalName zoological names}). A "valid" ("available") |
|---|
| 297 | * {@link TaxonNameBase taxon name}, unless "conserved" or "sanctioned", is "illegitimate" |
|---|
| 298 | * if it was "superfluous" when published or has been later "rejected".<BR> |
|---|
| 299 | * |
|---|
| 300 | * @see #VALID() |
|---|
| 301 | * @see #SUPERFLUOUS() |
|---|
| 302 | * @see #REJECTED() |
|---|
| 303 | */ |
|---|
| 304 | public static final NomenclaturalStatusType ILLEGITIMATE(){ |
|---|
| 305 | return getTermByUuid(uuidIllegitimate); |
|---|
| 306 | } |
|---|
| 307 | |
|---|
| 308 | /** |
|---|
| 309 | * Returns the nomenclatural status type "superfluous". A "valid" |
|---|
| 310 | * ("available") {@link TaxonNameBase taxon name} is "superfluous" if, when published, |
|---|
| 311 | * the taxon to which it was applied, as circumscribed by its {@link NonViralName#getCombinationAuthorTeam() author}, |
|---|
| 312 | * definitely included the type of a name which ought to have been adopted, |
|---|
| 313 | * or of which the epithet ought to have been adopted, under the rules of |
|---|
| 314 | * the {@link NomenclaturalCode nomenclature code}, and if it has not been later declared |
|---|
| 315 | * "conserved" or "sanctioned" by the competent authorities.<BR> |
|---|
| 316 | * A "superfluous" taxon name is therefore also "illegitimate" ("invalid" for |
|---|
| 317 | * {@link ZoologicalName zoological names}). |
|---|
| 318 | * |
|---|
| 319 | * @see #VALID() |
|---|
| 320 | * @see #CONSERVED() |
|---|
| 321 | * @see #SANCTIONED() |
|---|
| 322 | * @see #isIllegitimateType() |
|---|
| 323 | */ |
|---|
| 324 | public static final NomenclaturalStatusType SUPERFLUOUS(){ |
|---|
| 325 | return getTermByUuid(uuidSuperfluous); |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | /** |
|---|
| 329 | * Returns the nomenclatural status type "rejected". A "valid" ("available") |
|---|
| 330 | * {@link TaxonNameBase taxon name} is "rejected" if, even though by the strict |
|---|
| 331 | * application of the rules of the {@link NomenclaturalCode nomenclature code}, and especially |
|---|
| 332 | * of the principle of priority, it should be "legitimate" ("valid" for |
|---|
| 333 | * {@link ZoologicalName zoological names}), competent authorities decided to handle |
|---|
| 334 | * it as "illegitimate".<BR> |
|---|
| 335 | * A "rejected" taxon name is therefore also "illegitimate" ("invalid" for |
|---|
| 336 | * zoological names). A "rejected" taxon name is always rejected in favour |
|---|
| 337 | * of a "conserved" taxon name. |
|---|
| 338 | * |
|---|
| 339 | * @see #VALID() |
|---|
| 340 | * @see #isLegitimateType() |
|---|
| 341 | * @see #isIllegitimateType() |
|---|
| 342 | * @see #CONSERVED() |
|---|
| 343 | * @see NameRelationshipType#CONSERVED_AGAINST() |
|---|
| 344 | */ |
|---|
| 345 | public static final NomenclaturalStatusType REJECTED(){ |
|---|
| 346 | return getTermByUuid(uuidRejected); |
|---|
| 347 | } |
|---|
| 348 | |
|---|
| 349 | /** |
|---|
| 350 | * Returns the nomenclatural status type "utique rejected". A "valid" |
|---|
| 351 | * ("available") {@link TaxonNameBase taxon name} is "utique rejected" if it is rejected |
|---|
| 352 | * outright (without being rejected in favour of a "conserved" taxon name).<BR> |
|---|
| 353 | * An "utique rejected" taxon name is therefore also "illegitimate" |
|---|
| 354 | * ("invalid" for zoological names). |
|---|
| 355 | * |
|---|
| 356 | * @see #REJECTED() |
|---|
| 357 | * @see #VALID() |
|---|
| 358 | * @see #isIllegitimateType() |
|---|
| 359 | * @see #CONSERVED() |
|---|
| 360 | */ |
|---|
| 361 | public static final NomenclaturalStatusType UTIQUE_REJECTED(){ |
|---|
| 362 | return getTermByUuid(uuidUtiqueRejected); |
|---|
| 363 | } |
|---|
| 364 | |
|---|
| 365 | /** |
|---|
| 366 | * Returns the nomenclatural status type "proposed to be conserved". A |
|---|
| 367 | * "valid" ("available") {@link TaxonNameBase taxon name} is "proposed to be conserved" |
|---|
| 368 | * if, even though by the strict application of the rules of |
|---|
| 369 | * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority, |
|---|
| 370 | * it is "illegitimate" ("invalid" for {@link ZoologicalName zoological names}), |
|---|
| 371 | * it has been submitted to competent authorities in order to decide whether |
|---|
| 372 | * it should be handled as "legitimate".<BR> |
|---|
| 373 | * A "proposed to be conserved" taxon name is therefore still "illegitimate" |
|---|
| 374 | * ("invalid" for zoological names). |
|---|
| 375 | * |
|---|
| 376 | * @see #VALID() |
|---|
| 377 | * @see #isIllegitimateType() |
|---|
| 378 | * @see #isLegitimateType() |
|---|
| 379 | * @see #CONSERVED() |
|---|
| 380 | * @see NameRelationshipType#CONSERVED_AGAINST() |
|---|
| 381 | */ |
|---|
| 382 | public static final NomenclaturalStatusType CONSERVED_PROP(){ |
|---|
| 383 | return getTermByUuid(uuidConservedProp); |
|---|
| 384 | } |
|---|
| 385 | |
|---|
| 386 | /** |
|---|
| 387 | * Returns the nomenclatural status type "proposed to be conserved |
|---|
| 388 | * (orthography)". A {@link TaxonNameBase taxon name} is "proposed to be conserved |
|---|
| 389 | * (orthography)" if, even though originally published with another |
|---|
| 390 | * spelling, it has been submitted to competent authorities in order to |
|---|
| 391 | * decide whether the proposed alternative spelling should be "conserved".<BR> |
|---|
| 392 | * A "proposed to be conserved (orthography)" taxon name is therefore still |
|---|
| 393 | * "illegitimate" ("invalid" for {@link ZoologicalName zoological names}). |
|---|
| 394 | * |
|---|
| 395 | * @see #isIllegitimateType() |
|---|
| 396 | * @see #CONSERVED_PROP() |
|---|
| 397 | * @see #CONSERVED() |
|---|
| 398 | * @see NameRelationshipType#ORTHOGRAPHIC_VARIANT() |
|---|
| 399 | * @see NameRelationshipType#CONSERVED_AGAINST() |
|---|
| 400 | */ |
|---|
| 401 | public static final NomenclaturalStatusType ORTHOGRAPHY_CONSERVED_PROP(){ |
|---|
| 402 | return getTermByUuid(uuidOrthographyConservedProp); |
|---|
| 403 | } |
|---|
| 404 | |
|---|
| 405 | /** |
|---|
| 406 | * Returns the nomenclatural status type "legitimate" ("valid" for |
|---|
| 407 | * {@link ZoologicalName zoological names}). A "valid" ("available") |
|---|
| 408 | * {@link TaxonNameBase taxon name}, unless "rejected", is "legitimate" if it was not |
|---|
| 409 | * "superfluous" when published or has been later "conserved".<BR> |
|---|
| 410 | * |
|---|
| 411 | * @see #VALID() |
|---|
| 412 | * @see #SUPERFLUOUS() |
|---|
| 413 | * @see #CONSERVED() |
|---|
| 414 | */ |
|---|
| 415 | public static final NomenclaturalStatusType LEGITIMATE(){ |
|---|
| 416 | return getTermByUuid(uuidLegitimate); |
|---|
| 417 | } |
|---|
| 418 | |
|---|
| 419 | /** |
|---|
| 420 | * Returns the nomenclatural status type "alternative". A family |
|---|
| 421 | * {@link BotanicalName botanical name} is "alternative" if it is a classical name |
|---|
| 422 | * long in use, in some cases even before 1753, and is considered as |
|---|
| 423 | * {@link NomenclaturalStatusType#VALID() "valid"} although it does not follow the rules for |
|---|
| 424 | * family names (see Article 18 of the ICBN).<BR> |
|---|
| 425 | * An "alternative" taxon name is treated as if "conserved" and is therefore |
|---|
| 426 | * also "legitimate". |
|---|
| 427 | * |
|---|
| 428 | * @see #VALID() |
|---|
| 429 | * @see #CONSERVED() |
|---|
| 430 | * @see #isLegitimateType() |
|---|
| 431 | * @see NameRelationshipType#ALTERNATIVE_NAME() |
|---|
| 432 | */ |
|---|
| 433 | public static final NomenclaturalStatusType ALTERNATIVE(){ |
|---|
| 434 | return getTermByUuid(uuidAlternative); |
|---|
| 435 | } |
|---|
| 436 | |
|---|
| 437 | /** |
|---|
| 438 | * Returns the nomenclatural status type "novum". A "valid" |
|---|
| 439 | * ("available") {@link TaxonNameBase taxon name} is "novum" if it has been created |
|---|
| 440 | * in order either to replace an earlier name that is "illegitimate" or to |
|---|
| 441 | * avoid the building of a "later homonym".<BR> |
|---|
| 442 | * A "novum" taxon name is therefore also "legitimate" ("valid" for |
|---|
| 443 | * {@link ZoologicalName zoological names}). |
|---|
| 444 | * |
|---|
| 445 | * @see #VALID() |
|---|
| 446 | * @see #isIllegitimateType() |
|---|
| 447 | * @see NameRelationshipType#REPLACED_SYNONYM() |
|---|
| 448 | * @see NameRelationshipType#BLOCKING_NAME_FOR() |
|---|
| 449 | */ |
|---|
| 450 | public static final NomenclaturalStatusType NOVUM(){ |
|---|
| 451 | return getTermByUuid(uuidNovum); |
|---|
| 452 | } |
|---|
| 453 | |
|---|
| 454 | /** |
|---|
| 455 | * Returns the nomenclatural status type "proposed to be utique rejected". A |
|---|
| 456 | * "valid" ("available") {@link TaxonNameBase taxon name} is "proposed to be utique rejected" |
|---|
| 457 | * if, even though by the strict application of the rules of |
|---|
| 458 | * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority, |
|---|
| 459 | * it is "legitimate" ("valid" for {@link ZoologicalName zoological names}), |
|---|
| 460 | * it has been submitted to competent authorities in order to decide whether |
|---|
| 461 | * it should be handled as "illegitimate" (without to be rejected in favour |
|---|
| 462 | * of a "conserved" taxon name).<BR> |
|---|
| 463 | * A "proposed to be utique rejected" taxon name is therefore still "legitimate" |
|---|
| 464 | * ("valid" for zoological names). |
|---|
| 465 | * |
|---|
| 466 | * @see #VALID() |
|---|
| 467 | * @see #isLegitimateType() |
|---|
| 468 | * @see #isIllegitimateType() |
|---|
| 469 | * @see #REJECTED() |
|---|
| 470 | * @see #REJECTED_PROP() |
|---|
| 471 | */ |
|---|
| 472 | public static final NomenclaturalStatusType UTIQUE_REJECTED_PROP(){ |
|---|
| 473 | return getTermByUuid(uuidUtiqueRejectedProp); |
|---|
| 474 | } |
|---|
| 475 | |
|---|
| 476 | /** |
|---|
| 477 | * Returns the nomenclatural status type "conserved (orthography)". A |
|---|
| 478 | * {@link TaxonNameBase taxon name} is "conserved (orthography)" if competent authorities |
|---|
| 479 | * decided to conserve a different spelling to the one published originally.<BR> |
|---|
| 480 | * A "conserved (orthography)" taxon name is "conserved" and hence |
|---|
| 481 | * "legitimate" ("valid" for {@link ZoologicalName zoological names}). |
|---|
| 482 | * |
|---|
| 483 | * @see #isLegitimateType() |
|---|
| 484 | * @see #CONSERVED() |
|---|
| 485 | * @see #ORTHOGRAPHY_CONSERVED_PROP() |
|---|
| 486 | * @see NameRelationshipType#ORTHOGRAPHIC_VARIANT() |
|---|
| 487 | * @see NameRelationshipType#CONSERVED_AGAINST() |
|---|
| 488 | */ |
|---|
| 489 | public static final NomenclaturalStatusType ORTHOGRAPHY_CONSERVED(){ |
|---|
| 490 | return getTermByUuid(uuidOrthographyConserved); |
|---|
| 491 | } |
|---|
| 492 | |
|---|
| 493 | /** |
|---|
| 494 | * Returns the nomenclatural status type "proposed to be rejected". A |
|---|
| 495 | * "valid" ("available") {@link TaxonNameBase taxon name} is "proposed to be rejected" |
|---|
| 496 | * if, even though by the strict application of the rules of |
|---|
| 497 | * the {@link NomenclaturalCode nomenclature code}, and especially of the principle of priority, |
|---|
| 498 | * it should be "legitimate" ("valid" for {@link ZoologicalName zoological names}), |
|---|
| 499 | * it has been submitted to competent authorities in order to decide whether |
|---|
| 500 | * it should be handled as "illegitimate".<BR> |
|---|
| 501 | * A "proposed to be rejected" taxon name is therefore still "legitimate" |
|---|
| 502 | * ("valid" for zoological names). A "proposed to be rejected" taxon name is always |
|---|
| 503 | * to be rejected in favour of a "proposed to be conserved" taxon name. |
|---|
| 504 | * |
|---|
| 505 | * @see #VALID() |
|---|
| 506 | * @see #isLegitimateType() |
|---|
| 507 | * @see #isIllegitimateType() |
|---|
| 508 | * @see #REJECTED() |
|---|
| 509 | * @see #CONSERVED_PROP() |
|---|
| 510 | * @see NameRelationshipType#CONSERVED_AGAINST() |
|---|
| 511 | */ |
|---|
| 512 | public static final NomenclaturalStatusType REJECTED_PROP(){ |
|---|
| 513 | return getTermByUuid(uuidRejectedProp); |
|---|
| 514 | } |
|---|
| 515 | |
|---|
| 516 | /** |
|---|
| 517 | * Returns the nomenclatural status type "conserved". A "valid" |
|---|
| 518 | * ("available") {@link TaxonNameBase taxon name} is "conserved" if, even though by the strict |
|---|
| 519 | * application of the rules of the {@link NomenclaturalCode nomenclature code}, and especially of |
|---|
| 520 | * the principle of priority, it should be "illegitimate" ("invalid" for |
|---|
| 521 | * {@link ZoologicalName zoological names}), competent authorities decided to handle |
|---|
| 522 | * it as "legitimate".<BR> |
|---|
| 523 | * A "conserved" taxon name is therefore also "legitimate" ("valid" for |
|---|
| 524 | * zoological names). |
|---|
| 525 | * |
|---|
| 526 | * @see #VALID() |
|---|
| 527 | * @see #isIllegitimateType() |
|---|
| 528 | * @see #isLegitimateType() |
|---|
| 529 | * @see NameRelationshipType#CONSERVED_AGAINST() |
|---|
| 530 | */ |
|---|
| 531 | public static final NomenclaturalStatusType CONSERVED(){ |
|---|
| 532 | return getTermByUuid(uuidConserved); |
|---|
| 533 | } |
|---|
| 534 | |
|---|
| 535 | /** |
|---|
| 536 | * Returns the nomenclatural status type "sanctioned". {@link BotanicalName Botanical names} |
|---|
| 537 | * for fungi are "sanctioned" if they were published in the opera mentioned |
|---|
| 538 | * in Article 13.1d of the {@link NomenclaturalCode#ICBN() ICBN}.<BR> |
|---|
| 539 | * A "sanctioned" taxon name is treated as if "conserved" and is therefore |
|---|
| 540 | * also "legitimate". |
|---|
| 541 | * |
|---|
| 542 | * @see #VALID() |
|---|
| 543 | * @see #CONSERVED() |
|---|
| 544 | * @see #isLegitimateType() |
|---|
| 545 | */ |
|---|
| 546 | public static final NomenclaturalStatusType SANCTIONED(){ |
|---|
| 547 | return getTermByUuid(uuidSanctioned); |
|---|
| 548 | } |
|---|
| 549 | |
|---|
| 550 | /** |
|---|
| 551 | * Returns the nomenclatural status type "invalid" (this corresponds to |
|---|
| 552 | * "not available" for {@link ZoologicalName zoological names}). The use of "invalid" |
|---|
| 553 | * {@link TaxonNameBase taxon names} should be avoided.<BR> |
|---|
| 554 | * A taxon name is "invalid" if it is not "valid"; this means that |
|---|
| 555 | * the taxon name:<ul> |
|---|
| 556 | * <li>has not been effectively published or |
|---|
| 557 | * <li>has a form which does not comply with the rules of the |
|---|
| 558 | * {@link NomenclaturalCode nomenclature code} or |
|---|
| 559 | * <li>is not accompanied by a description or diagnosis or by a reference to |
|---|
| 560 | * such a previously published description or diagnosis |
|---|
| 561 | * </ul> |
|---|
| 562 | * |
|---|
| 563 | * @see #VALID() |
|---|
| 564 | * @see #isInvalidType() |
|---|
| 565 | * @see #ILLEGITIMATE() |
|---|
| 566 | */ |
|---|
| 567 | public static final NomenclaturalStatusType INVALID(){ |
|---|
| 568 | return getTermByUuid(uuidInvalid); |
|---|
| 569 | } |
|---|
| 570 | |
|---|
| 571 | /** |
|---|
| 572 | * Returns the nomenclatural status type "nudum". A {@link TaxonNameBase taxon name} is "nudum" |
|---|
| 573 | * if its publication is not accompanied by a description or diagnosis or |
|---|
| 574 | * by a reference to such a previously published description or diagnosis.<BR> |
|---|
| 575 | * A "nudum" taxon name is therefore also "invalid" ("not available" for |
|---|
| 576 | * {@link ZoologicalName zoological names}). |
|---|
| 577 | * |
|---|
| 578 | * @see #isInvalidType() |
|---|
| 579 | */ |
|---|
| 580 | public static final NomenclaturalStatusType NUDUM(){ |
|---|
| 581 | return getTermByUuid(uuidNudum); |
|---|
| 582 | } |
|---|
| 583 | |
|---|
| 584 | /** |
|---|
| 585 | * Returns the nomenclatural status type "invalid combination". A |
|---|
| 586 | * {@link TaxonNameBase bi- or trinomial} is an "invalid combination" if its |
|---|
| 587 | * {@link NonViralName#getCombinationAuthorTeam() author} did not definitely associate the final |
|---|
| 588 | * epithet with the name of the genus or species, or with its abbreviation.<BR> |
|---|
| 589 | * An "invalid combination" taxon name is therefore also "invalid" |
|---|
| 590 | * ("not available" for {@link ZoologicalName zoological names}). |
|---|
| 591 | * |
|---|
| 592 | * @see #isInvalidType() |
|---|
| 593 | */ |
|---|
| 594 | public static final NomenclaturalStatusType COMBINATION_INVALID(){ |
|---|
| 595 | return getTermByUuid(uuidCombinationInvalid); |
|---|
| 596 | } |
|---|
| 597 | |
|---|
| 598 | /** |
|---|
| 599 | * Returns the nomenclatural status type "illegitimate combination". |
|---|
| 600 | * TODO explanation |
|---|
| 601 | * |
|---|
| 602 | * @see #isInvalidType() |
|---|
| 603 | */ |
|---|
| 604 | public static final NomenclaturalStatusType COMBINATION_ILLEGITIMATE(){ |
|---|
| 605 | return getTermByUuid(uuidCombinationIllegitimate); |
|---|
| 606 | } |
|---|
| 607 | |
|---|
| 608 | /** |
|---|
| 609 | * Returns the nomenclatural status type "provisional". A {@link TaxonNameBase taxon name} is |
|---|
| 610 | * "provisional" if it has not been yet effectively published.<BR> |
|---|
| 611 | * A "provisional" taxon name is therefore also "invalid" |
|---|
| 612 | * ("not available" for {@link ZoologicalName zoological names}). |
|---|
| 613 | * |
|---|
| 614 | * @see #isInvalidType() |
|---|
| 615 | */ |
|---|
| 616 | public static final NomenclaturalStatusType PROVISIONAL(){ |
|---|
| 617 | return getTermByUuid(uuidProvisional); |
|---|
| 618 | } |
|---|
| 619 | |
|---|
| 620 | /** |
|---|
| 621 | * Returns the nomenclatural status type "valid" (this corresponds to |
|---|
| 622 | * "available" for {@link ZoologicalName zoological names}).<BR> |
|---|
| 623 | * A {@link TaxonNameBase taxon name} is "valid" if it:<ul> |
|---|
| 624 | * <li>has been effectively published and |
|---|
| 625 | * <li>has a form which complies with the rules of the |
|---|
| 626 | * {@link NomenclaturalCode nomenclature code} and |
|---|
| 627 | * <li>is accompanied by a description or diagnosis or by a reference to |
|---|
| 628 | * such a previously published description or diagnosis |
|---|
| 629 | * </ul> |
|---|
| 630 | * |
|---|
| 631 | * @see #INVALID() |
|---|
| 632 | * @see #LEGITIMATE() |
|---|
| 633 | */ |
|---|
| 634 | public static final NomenclaturalStatusType VALID(){ |
|---|
| 635 | return getTermByUuid(uuidValid); |
|---|
| 636 | } |
|---|
| 637 | |
|---|
| 638 | /** |
|---|
| 639 | * Returns the nomenclatural status type "subnudum". This type is not |
|---|
| 640 | * covered by {@link NomenclaturalCode nomenclature codes}. It appears sometimes in literature and |
|---|
| 641 | * represents the opinion of the author who considers the {@link TaxonNameBase taxon name} to be |
|---|
| 642 | * unusable for an unambiguous taxonomic use. |
|---|
| 643 | * |
|---|
| 644 | * @see #AMBIGUOUS() |
|---|
| 645 | * @see #CONFUSUM() |
|---|
| 646 | * |
|---|
| 647 | */ |
|---|
| 648 | public static final NomenclaturalStatusType SUBNUDUM(){ |
|---|
| 649 | return getTermByUuid(uuidSubnudum); |
|---|
| 650 | } |
|---|
| 651 | |
|---|
| 652 | /** |
|---|
| 653 | * Returns the nomenclatural status type "opus utique oppressum". This type |
|---|
| 654 | * relates to article 32.7 (old ICBN) and article 32.9 as well as App. 6 |
|---|
| 655 | * (new {@link NomenclaturalCode#ICBN() ICBN}). This is a reference list of botanical opera, in which all |
|---|
| 656 | * {@link BotanicalName taxon names} (or names of a certain rank) are oppressed. Such a name has the |
|---|
| 657 | * status "invalid" but in contrary to "rejected" not a single name |
|---|
| 658 | * is rejected by the commission but an opus with regard to the validity of |
|---|
| 659 | * all taxon names occurring in it.<BR> |
|---|
| 660 | * An "opus utique oppressum" taxon name is therefore also "invalid" |
|---|
| 661 | * ("not available" for {@link ZoologicalName zoological names}). |
|---|
| 662 | * |
|---|
| 663 | * @see #isInvalidType() |
|---|
| 664 | */ |
|---|
| 665 | public static final NomenclaturalStatusType OPUS_UTIQUE_OPPR(){ |
|---|
| 666 | return getTermByUuid(uuidOpusUtiqueOppr); |
|---|
| 667 | } |
|---|
| 668 | |
|---|
| 669 | |
|---|
| 670 | //TODO Soraya |
|---|
| 671 | // orth. var.: orthographic variant |
|---|
| 672 | // pro syn.: pro synonymo |
|---|
| 673 | |
|---|
| 674 | // TODO |
|---|
| 675 | // Preliminary implementation for BotanicalNameParser. |
|---|
| 676 | // not yet complete |
|---|
| 677 | /** |
|---|
| 678 | * Returns the nomenclatural status type identified through its label |
|---|
| 679 | * abbreviation. Preliminary implementation for BotanicalNameParser. |
|---|
| 680 | * |
|---|
| 681 | * @param statusAbbreviation the label abbreviation |
|---|
| 682 | * @return the nomenclatural status type |
|---|
| 683 | * |
|---|
| 684 | */ |
|---|
| 685 | public static NomenclaturalStatusType getNomenclaturalStatusTypeByAbbreviation(String statusAbbreviation) throws UnknownCdmTypeException{ |
|---|
| 686 | if (statusAbbreviation == null){ |
|---|
| 687 | throw new NullPointerException("statusAbbreviation is NULL in getNomenclaturalStatusTypeByAbbreviation"); |
|---|
| 688 | } |
|---|
| 689 | NomenclaturalStatusType result = null; |
|---|
| 690 | if (statusAbbreviation == null){ |
|---|
| 691 | throw new NullPointerException("Abbreviation is NULL in getNomenclaturalStatusTypeByAbbreviation"); |
|---|
| 692 | } |
|---|
| 693 | if (abbrevMap == null){ |
|---|
| 694 | return null; |
|---|
| 695 | } |
|---|
| 696 | //non unique abbrev |
|---|
| 697 | if (statusAbbreviation.equalsIgnoreCase("nom. alternativ.")){ |
|---|
| 698 | return NomenclaturalStatusType.ALTERNATIVE(); |
|---|
| 699 | } |
|---|
| 700 | UUID uuid = abbrevMap.get(statusAbbreviation); |
|---|
| 701 | if (uuid != null ){ |
|---|
| 702 | result = getTermByUuid(uuid); |
|---|
| 703 | } |
|---|
| 704 | if (result != null){ |
|---|
| 705 | return result; |
|---|
| 706 | }else { |
|---|
| 707 | if (statusAbbreviation == null){ |
|---|
| 708 | statusAbbreviation = "(null)"; |
|---|
| 709 | } |
|---|
| 710 | throw new UnknownCdmTypeException("Unknown nom. status abbreviation: " + statusAbbreviation); |
|---|
| 711 | } |
|---|
| 712 | |
|---|
| 713 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. ambig.")) { return NomenclaturalStatusType.AMBIGUOUS(); |
|---|
| 714 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. dub.")) { return NomenclaturalStatusType.DOUBTFUL(); |
|---|
| 715 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. confus.")) { return NomenclaturalStatusType.CONFUSUM(); |
|---|
| 716 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. illeg.")){return NomenclaturalStatusType.ILLEGITIMATE(); |
|---|
| 717 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. superfl.")){ return NomenclaturalStatusType.SUPERFLUOUS(); |
|---|
| 718 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. rej.")) { return NomenclaturalStatusType.REJECTED(); |
|---|
| 719 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. utique rej.")) { return NomenclaturalStatusType.UTIQUE_REJECTED(); |
|---|
| 720 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. cons. prop.")) { return NomenclaturalStatusType.CONSERVED_PROP(); |
|---|
| 721 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. orth. cons. prop.")) { return NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED_PROP(); |
|---|
| 722 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. legit.")) { return NomenclaturalStatusType.LEGITIMATE(); |
|---|
| 723 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. altern.")) { return NomenclaturalStatusType.ALTERNATIVE(); |
|---|
| 724 | |
|---|
| 725 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. alternativ.")) { return NomenclaturalStatusType.ALTERNATIVE(); |
|---|
| 726 | |
|---|
| 727 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. nov.")) { return NomenclaturalStatusType.NOVUM(); |
|---|
| 728 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. utique rej. prop.")) { return NomenclaturalStatusType.UTIQUE_REJECTED_PROP(); |
|---|
| 729 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. orth. cons.")) { return NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED(); |
|---|
| 730 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. rej. prop.")) { return NomenclaturalStatusType.REJECTED_PROP(); |
|---|
| 731 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. cons.")) { return NomenclaturalStatusType.CONSERVED(); |
|---|
| 732 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. sanct.")) { return NomenclaturalStatusType.SANCTIONED(); |
|---|
| 733 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. inval.")) { return NomenclaturalStatusType.INVALID(); |
|---|
| 734 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. nud.")){ return NomenclaturalStatusType.NUDUM(); |
|---|
| 735 | // }else if (statusAbbreviation.equalsIgnoreCase("comb. inval.")){ return NomenclaturalStatusType.COMBINATION_INVALID(); |
|---|
| 736 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. provis.")) { return NomenclaturalStatusType.PROVISIONAL(); |
|---|
| 737 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. valid")) { return NomenclaturalStatusType.VALID(); |
|---|
| 738 | // }else if (statusAbbreviation.equalsIgnoreCase("opus. utique oppr.")) { return NomenclaturalStatusType.OPUS_UTIQUE_OPPR(); |
|---|
| 739 | // }else if (statusAbbreviation.equalsIgnoreCase("nom. subnud.")) { return NomenclaturalStatusType.SUBNUDUM(); |
|---|
| 740 | // //TODO make generic, use labels for map |
|---|
| 741 | // }else { |
|---|
| 742 | // if (statusAbbreviation == null){ |
|---|
| 743 | // statusAbbreviation = "(null)"; |
|---|
| 744 | // } |
|---|
| 745 | // throw new eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException("Unknown NomenclaturalStatusType abbreviation: " + statusAbbreviation); |
|---|
| 746 | // } |
|---|
| 747 | } |
|---|
| 748 | |
|---|
| 749 | /** |
|---|
| 750 | * Returns the nomenclatural status type identified through its label. |
|---|
| 751 | * |
|---|
| 752 | * @param statusLabel the nomenclatural status label |
|---|
| 753 | * @return the nomenclatural status type |
|---|
| 754 | * |
|---|
| 755 | */ |
|---|
| 756 | public static NomenclaturalStatusType getNomenclaturalStatusTypeByLabel(String statusLabel) throws UnknownCdmTypeException{ |
|---|
| 757 | if (statusLabel == null){ |
|---|
| 758 | throw new NullPointerException("Status label is NULL in getNomenclaturalStatusTypeBylabel"); |
|---|
| 759 | } |
|---|
| 760 | NomenclaturalStatusType result = null; |
|---|
| 761 | if (statusLabel == null){ |
|---|
| 762 | throw new NullPointerException("Status label is NULL in getNomenclaturalStatusTypeByLabel"); |
|---|
| 763 | } |
|---|
| 764 | if (labelMap == null){ |
|---|
| 765 | return null; |
|---|
| 766 | } |
|---|
| 767 | statusLabel = statusLabel.toLowerCase(); |
|---|
| 768 | UUID uuid = labelMap.get(statusLabel); |
|---|
| 769 | if (uuid != null ){ |
|---|
| 770 | result = getTermByUuid(uuid); |
|---|
| 771 | } |
|---|
| 772 | if (result != null){ |
|---|
| 773 | return result; |
|---|
| 774 | }else { |
|---|
| 775 | if (statusLabel == null){ |
|---|
| 776 | statusLabel = "(null)"; |
|---|
| 777 | } |
|---|
| 778 | throw new UnknownCdmTypeException("Unknown nom. status label: " + statusLabel); |
|---|
| 779 | } |
|---|
| 780 | |
|---|
| 781 | // if (statusLabel == null){ throw new NullPointerException("statusLabel is 'null' in getNomenclaturalStatusTypeByLabel"); |
|---|
| 782 | // }else if (statusLabel.equalsIgnoreCase("Ambiguous")) { return NomenclaturalStatusType.AMBIGUOUS(); |
|---|
| 783 | // }else if (statusLabel.equalsIgnoreCase("Doubtful")) { return NomenclaturalStatusType.DOUBTFUL(); |
|---|
| 784 | // }else if (statusLabel.equalsIgnoreCase("Confusum")) { return NomenclaturalStatusType.CONFUSUM(); |
|---|
| 785 | // }else if (statusLabel.equalsIgnoreCase("Illegitimate")){return NomenclaturalStatusType.ILLEGITIMATE(); |
|---|
| 786 | // }else if (statusLabel.equalsIgnoreCase("Superfluous")){ return NomenclaturalStatusType.SUPERFLUOUS(); |
|---|
| 787 | // }else if (statusLabel.equalsIgnoreCase("Rejected")) { return NomenclaturalStatusType.REJECTED(); |
|---|
| 788 | // }else if (statusLabel.equalsIgnoreCase("Utique Rejected")) { return NomenclaturalStatusType.UTIQUE_REJECTED(); |
|---|
| 789 | // }else if (statusLabel.equalsIgnoreCase("Conserved Prop")) { return NomenclaturalStatusType.CONSERVED_PROP(); |
|---|
| 790 | // }else if (statusLabel.equalsIgnoreCase("Orthography Conserved Prop")) { return NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED_PROP(); |
|---|
| 791 | // }else if (statusLabel.equalsIgnoreCase("Legitimate")) { return NomenclaturalStatusType.LEGITIMATE(); |
|---|
| 792 | // }else if (statusLabel.equalsIgnoreCase("Alternative")) { return NomenclaturalStatusType.ALTERNATIVE(); |
|---|
| 793 | // }else if (statusLabel.equalsIgnoreCase("Novum")) { return NomenclaturalStatusType.NOVUM(); |
|---|
| 794 | // }else if (statusLabel.equalsIgnoreCase("Utique Rejected Prop")) { return NomenclaturalStatusType.UTIQUE_REJECTED_PROP(); |
|---|
| 795 | // }else if (statusLabel.equalsIgnoreCase("Orthography Conserved")) { return NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED(); |
|---|
| 796 | // }else if (statusLabel.equalsIgnoreCase("Rejected Prop")) { return NomenclaturalStatusType.REJECTED_PROP(); |
|---|
| 797 | // }else if (statusLabel.equalsIgnoreCase("Conserved")) { return NomenclaturalStatusType.CONSERVED(); |
|---|
| 798 | // }else if (statusLabel.equalsIgnoreCase("Sanctioned")) { return NomenclaturalStatusType.SANCTIONED(); |
|---|
| 799 | // }else if (statusLabel.equalsIgnoreCase("Invalid")) { return NomenclaturalStatusType.INVALID(); |
|---|
| 800 | // }else if (statusLabel.equalsIgnoreCase("Nudum")){ return NomenclaturalStatusType.NUDUM(); |
|---|
| 801 | // }else if (statusLabel.equalsIgnoreCase("Combination Invalid")){ return NomenclaturalStatusType.COMBINATION_INVALID(); |
|---|
| 802 | // }else if (statusLabel.equalsIgnoreCase("Provisional")) { return NomenclaturalStatusType.PROVISIONAL(); |
|---|
| 803 | // }else if (statusLabel.equalsIgnoreCase("Valid")) { return NomenclaturalStatusType.VALID(); |
|---|
| 804 | // }else if (statusLabel.equalsIgnoreCase("Opus Utique Oppr")) { return NomenclaturalStatusType.OPUS_UTIQUE_OPPR(); |
|---|
| 805 | // }else if (statusLabel.equalsIgnoreCase("Subnudum")) { return NomenclaturalStatusType.SUBNUDUM(); |
|---|
| 806 | // }else { |
|---|
| 807 | // if (statusLabel == null){ |
|---|
| 808 | // statusLabel = "(null)"; |
|---|
| 809 | // } |
|---|
| 810 | // throw new eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException("Unknown NomenclaturalStatusType abbreviation: " + statusLabel); |
|---|
| 811 | // } |
|---|
| 812 | } |
|---|
| 813 | |
|---|
| 814 | /* (non-Javadoc) |
|---|
| 815 | * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#readCsvLine(java.util.List) |
|---|
| 816 | */ |
|---|
| 817 | /** |
|---|
| 818 | * Fills <i>this</i> nomenclatural status type with contents (uuid, uri, |
|---|
| 819 | * description text, label and label abbreviation) coming from a csv line. |
|---|
| 820 | * The implicit language for the description text is "latin". |
|---|
| 821 | * This method overrides the method of {@link eu.etaxonomy.cdm.model.common.DefinedTermBase DefinedTermBase}. |
|---|
| 822 | * |
|---|
| 823 | * @param csvLine the (ordered) list of substrings from a csv string |
|---|
| 824 | * to be used to fill <i>this</i> nomenclatural status type |
|---|
| 825 | * @see #NomenclaturalStatusType(String, String, String) |
|---|
| 826 | * @see #readCsvLine(List, Language) |
|---|
| 827 | * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#readCsvLine(List) |
|---|
| 828 | */ |
|---|
| 829 | |
|---|
| 830 | public NomenclaturalStatusType readCsvLine(Class<NomenclaturalStatusType> termClass, List<String> csvLine, Map<UUID,DefinedTermBase> terms) { //TODO should be List<String> but makes error for some strange reason |
|---|
| 831 | try { |
|---|
| 832 | NomenclaturalStatusType newInstance = termClass.newInstance(); |
|---|
| 833 | DefinedTermBase.readCsvLine(newInstance, csvLine, Language.LATIN()); |
|---|
| 834 | return newInstance; |
|---|
| 835 | } catch (Exception e) { |
|---|
| 836 | // TODO Auto-generated catch block |
|---|
| 837 | e.printStackTrace(); |
|---|
| 838 | } |
|---|
| 839 | return null; |
|---|
| 840 | |
|---|
| 841 | } |
|---|
| 842 | |
|---|
| 843 | @Override |
|---|
| 844 | protected void setDefaultTerms(TermVocabulary<NomenclaturalStatusType> termVocabulary) { |
|---|
| 845 | termMap = new HashMap<UUID, NomenclaturalStatusType>(); |
|---|
| 846 | for (NomenclaturalStatusType term : termVocabulary.getTerms()){ |
|---|
| 847 | termMap.put(term.getUuid(), term); |
|---|
| 848 | addStatusType(term); |
|---|
| 849 | } |
|---|
| 850 | |
|---|
| 851 | } |
|---|
| 852 | |
|---|
| 853 | /** |
|---|
| 854 | * Adds the status type to the (abbreviated) label maps |
|---|
| 855 | * @param term |
|---|
| 856 | */ |
|---|
| 857 | private void addStatusType(NomenclaturalStatusType statusType) { |
|---|
| 858 | if (statusType == null){ |
|---|
| 859 | logger.warn("statusType is NULL"); |
|---|
| 860 | return; |
|---|
| 861 | } |
|---|
| 862 | Language lang = Language.LATIN(); |
|---|
| 863 | Representation representation = statusType.getRepresentation(lang); |
|---|
| 864 | String abbrevLabel = representation.getAbbreviatedLabel(); |
|---|
| 865 | String label = representation.getLabel(); |
|---|
| 866 | if (abbrevLabel == null){ |
|---|
| 867 | logger.warn("label is NULL"); |
|---|
| 868 | return; |
|---|
| 869 | } |
|---|
| 870 | //initialize maps |
|---|
| 871 | if (abbrevMap == null){ |
|---|
| 872 | abbrevMap = new HashMap<String, UUID>(); |
|---|
| 873 | } |
|---|
| 874 | if (labelMap == null){ |
|---|
| 875 | labelMap = new HashMap<String, UUID>(); |
|---|
| 876 | } |
|---|
| 877 | //add to map |
|---|
| 878 | abbrevMap.put(abbrevLabel, statusType.getUuid()); |
|---|
| 879 | labelMap.put(label.toLowerCase(), statusType.getUuid()); |
|---|
| 880 | } |
|---|
| 881 | |
|---|
| 882 | |
|---|
| 883 | |
|---|
| 884 | |
|---|
| 885 | /** |
|---|
| 886 | * NomenclaturalStatusType should always be shown in latin, therefore the only existing representation |
|---|
| 887 | * is the latin one. In case we pass in another Language to this method it will return a <code>null</code> representation. |
|---|
| 888 | * |
|---|
| 889 | * In case the representation becomes null, we fall back to the latin representation. |
|---|
| 890 | * |
|---|
| 891 | */ |
|---|
| 892 | @Override |
|---|
| 893 | public Representation getRepresentation(Language lang) { |
|---|
| 894 | Representation representation = super.getRepresentation(lang); |
|---|
| 895 | |
|---|
| 896 | if(representation == null){ |
|---|
| 897 | representation = super.getRepresentation(Language.LATIN()); |
|---|
| 898 | } |
|---|
| 899 | |
|---|
| 900 | return representation; |
|---|
| 901 | } |
|---|
| 902 | |
|---|
| 903 | |
|---|
| 904 | } |
|---|