3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.io
.cuba
;
13 import java
.util
.UUID
;
15 import org
.apache
.commons
.lang
.StringUtils
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.InputTransformerBase
;
19 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.UndefinedTransformerMethodException
;
20 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTerm
;
26 public final class CubaTransformer
extends InputTransformerBase
{
27 private static final long serialVersionUID
= 1070018208741186271L;
29 @SuppressWarnings("unused")
30 private static final Logger logger
= Logger
.getLogger(CubaTransformer
.class);
33 public static final UUID uuidRefFRC
= UUID
.fromString("c1caf6a2-5083-4f44-8f97-9abe23a84cd8");
34 public static final UUID uuidRefAS
= UUID
.fromString("1f15291a-b4c5-4e15-960f-d0145a250539");
35 public static final UUID uuidRefFC
= UUID
.fromString("c5a0bfb8-85b2-422d-babe-423aa2e24c35");
38 public static final UUID uuidAlternativeFamily
= UUID
.fromString("a005f8a1-6377-4641-a826-185f67136860");
39 public static final UUID uuidAlternativeFamily2
= UUID
.fromString("ff15b54a-6785-4ba0-acb6-8fb2eab80a6a");
42 protected static final UUID nonNativeDoubtfullyNaturalisedUuid
= UUID
.fromString("a1e26234-831e-4190-9fe3-011aca09ddba");
43 // private static final UUID adventiveAlienUuid = UUID.fromString("06e48a0b-3e48-4ef8-9bdd-0755880e99ce");
44 // private static final UUID cultivatedOnlyUuid = UUID.fromString("9cca5c3b-aced-41c4-accc-f800b67168f8");
45 protected static final UUID occasionallyCultivatedUuid
= UUID
.fromString("936c3f9a-6099-4322-9792-0a72c6c2ce25");
46 // private static final UUID doubtfulIndigenousUuid = UUID.fromString("f47f4f4e-9d84-459a-b747-27a1af24ab7a");
47 protected static final UUID doubtfulIndigenousDoubtfulUuid
= UUID
.fromString("7ddfd94d-01a4-496c-a6d6-18584c00af59");
48 protected static final UUID rareCasualUuid
= UUID
.fromString("8914ce0d-7d31-4c88-8317-985f2b3a493b");
50 protected static final UUID endemicDoubtfullyPresentUuid
= UUID
.fromString("5f954f08-267a-4928-b073-12328f74c187");
51 protected static final UUID naturalisedDoubtfullyPresentUuid
= UUID
.fromString("9e0b413b-5a68-4e5b-91f2-227b4f832466");
52 protected static final UUID nonNativeDoubtfullyPresentUuid
= UUID
.fromString("c42ca644-1773-4230-a2ee-328a5d4a21ab");
53 private static final UUID endemicInErrorUuid
= UUID
.fromString("679b215d-c231-4ee2-ae12-3ffc3dd528ad");
54 private static final UUID adventiveInErrorUuid
= UUID
.fromString("9b910b7b-43e3-4260-961c-6063b11cb7dc");
55 private static final UUID nonNativeInErrorUuid
= UUID
.fromString("b9153d90-9e31-465a-a28c-79077a8ed4c2");
56 private static final UUID naturalisedInErrorUuid
= UUID
.fromString("8d918a37-3add-4e1c-a233-c37dbee209aa");
61 public static final UUID uuidCubaVocabulary
= UUID
.fromString("2119f610-1f93-4d87-af28-40aeefaca100");
62 // public static final UUID uuidCyprusDivisionsAreaLevel = UUID.fromString("ff52bbd9-f73d-4476-af39-f3991fa892bd");
64 public static final UUID uuidCuba
= UUID
.fromString("d0144a6e-0e17-4a1d-bce5-d464a2aa7229");
66 public static final UUID uuidWesternCuba
= UUID
.fromString("53ee35a5-03dd-4c1e-9b23-1a0d08489684");
67 public static final UUID uuidPinarDelRio
= UUID
.fromString("ee1bae89-b6a8-4b89-a864-238fe3c4dbf3");
68 public static final UUID uuidHabana
= UUID
.fromString("ff906b63-6e74-4a38-b492-73d32817ad3a");
69 public static final UUID uuidCiudadHabana
= UUID
.fromString("af96dc90-ef03-4e2c-9c65-50dd1cca4f4f");
70 public static final UUID uuidMayabeque
= UUID
.fromString("7813fc47-1038-49d0-9fc7-07d245abcf2d");
71 public static final UUID uuidArtemisa
= UUID
.fromString("7e236945-1097-43f7-9deb-dedf3f45dfe1");
72 public static final UUID uuidMatanzas
= UUID
.fromString("bc280278-1b67-4766-ba28-e3a5c215d6a9");
73 public static final UUID uuidIslaDeLaJuventud
= UUID
.fromString("0e0683d6-90d4-4b0f-834e-05737ca9b2b4");
75 public static final UUID uuidCentralCuba
= UUID
.fromString("25eb5879-358e-4ff7-837d-101569d5d843");
76 public static final UUID uuidVillaClara
= UUID
.fromString("4de5e35d-fdad-49d0-a5c8-dc44e4e844a0");
77 public static final UUID uuidCienfuegos
= UUID
.fromString("c4189205-4543-4f4d-b211-6f899734a2f1");
78 public static final UUID uuidSanctiSpiritus
= UUID
.fromString("70ee99b9-d006-4a08-a8c2-19269d60865f");
79 public static final UUID uuidCiegoDeAvila
= UUID
.fromString("2ce7f4bc-4142-4866-b156-cf5300973c6d");
80 public static final UUID uuidCamaguey
= UUID
.fromString("4a4e2ab9-bce1-4018-8654-e7dfe6ea9a0f");
81 public static final UUID uuidLasTunas
= UUID
.fromString("6e0e9c28-23fe-4ea7-8ae1-75e1dce385e9");
83 public static final UUID uuidEastCuba
= UUID
.fromString("6a9ed0e2-7d3a-4620-9376-720c166674ee");
84 public static final UUID uuidGranma
= UUID
.fromString("7098418f-992a-4888-b4a0-722870bc7c69");
85 public static final UUID uuidHolguin
= UUID
.fromString("1595e1f2-5ae6-4db7-982c-552c26130051");
86 public static final UUID uuidSantiagoDeCuba
= UUID
.fromString("838a2e44-f3cc-4d89-83a8-6f83c6f9726d");
87 public static final UUID uuidGuantanamo
= UUID
.fromString("3a76b1af-da3a-44a3-859f-eeba5ad6f58b");
89 public static final UUID uuidEspanola
= UUID
.fromString("27d9d0f3-cd5f-4f3e-979d-64e47b6b5768");
90 public static final UUID uuidJamaica
= UUID
.fromString("2825a0ee-0bd1-49d5-afb4-bac80db5551f");
91 public static final UUID uuidPuertoRico
= UUID
.fromString("9fca701d-4899-4266-a29f-0d136670c795");
92 public static final UUID uuidSmallerAntilles
= UUID
.fromString("9720309a-2467-4aad-992e-b3c34b95d8d7");
93 public static final UUID uuidBahamas
= UUID
.fromString("23615e27-e916-48f4-8d49-8c148106216c");
94 public static final UUID uuidCaymanIslands
= UUID
.fromString("f53ea0b5-3bca-4e95-9a10-2d13edcd7501");
95 public static final UUID uuidNorthAmerica
= UUID
.fromString("5ab08324-baa2-4121-8c37-e1d558b51f2f");
96 public static final UUID uuidCentralAmerica
= UUID
.fromString("4d972402-5ef8-43d8-a377-f0b6dd88d32e");
97 public static final UUID uuidSouthAmerica
= UUID
.fromString("0fccc041-ce9d-40d5-8b9b-d7d833feed38");
98 public static final UUID uuidOldWorld
= UUID
.fromString("c6b45544-01df-4c97-bb29-9058964c5b57");
101 public UUID
getNamedAreaUuid(String key
) throws UndefinedTransformerMethodException
{
102 if (StringUtils
.isBlank(key
)){return null;
105 }else if (key
.equalsIgnoreCase("Cu")){return uuidCuba
;
106 }else if (key
.equalsIgnoreCase("CuW")){return uuidWesternCuba
;
107 }else if (key
.equalsIgnoreCase("PR*")){return uuidPinarDelRio
;
108 }else if (key
.equalsIgnoreCase("PR PR*")){return uuidPinarDelRio
;
109 // }else if (key.equals("HAB")){return uuidHabana;
110 }else if (key
.equalsIgnoreCase("Hab*")){return uuidCiudadHabana
;
111 }else if (key
.equalsIgnoreCase("Hab(*)")){return uuidCiudadHabana
;
112 }else if (key
.equalsIgnoreCase("May")){return uuidMayabeque
;
113 }else if (key
.equalsIgnoreCase("Art")){return uuidArtemisa
;
115 }else if (key
.equalsIgnoreCase("Mat")){return uuidMatanzas
;
116 }else if (key
.equalsIgnoreCase("IJ")){return uuidIslaDeLaJuventud
;
118 }else if (key
.equalsIgnoreCase("CuC")){return uuidCentralCuba
;
119 }else if (key
.equalsIgnoreCase("VC")){return uuidVillaClara
;
120 }else if (key
.equalsIgnoreCase("Ci")){return uuidCienfuegos
;
121 }else if (key
.equalsIgnoreCase("SS")){return uuidSanctiSpiritus
;
122 }else if (key
.equalsIgnoreCase("CA")){return uuidCiegoDeAvila
;
123 }else if (key
.equalsIgnoreCase("Cam")){return uuidCamaguey
;
124 }else if (key
.equalsIgnoreCase("LT")){return uuidLasTunas
;
126 }else if (key
.equalsIgnoreCase("CuE")){return uuidEastCuba
;
127 }else if (key
.equalsIgnoreCase("Gr")){return uuidGranma
;
128 }else if (key
.equalsIgnoreCase("Ho")){return uuidHolguin
;
129 }else if (key
.equalsIgnoreCase("SC")){return uuidSantiagoDeCuba
;
130 }else if (key
.equalsIgnoreCase("Gu")){return uuidGuantanamo
;
132 }else if (key
.equalsIgnoreCase("Esp")){return uuidEspanola
;
133 }else if (key
.equalsIgnoreCase("Ja")){return uuidJamaica
;
134 }else if (key
.equalsIgnoreCase("PR")){return uuidPuertoRico
;
135 }else if (key
.equalsIgnoreCase("Men")){return uuidSmallerAntilles
;
136 }else if (key
.equalsIgnoreCase("Bah")){return uuidBahamas
;
137 }else if (key
.equalsIgnoreCase("Cay")){return uuidCaymanIslands
;
138 }else if (key
.equalsIgnoreCase("AmN")){return uuidNorthAmerica
;
139 }else if (key
.equalsIgnoreCase("AmC")){return uuidCentralAmerica
;
140 }else if (key
.equalsIgnoreCase("AmS")){return uuidSouthAmerica
;
141 }else if (key
.equalsIgnoreCase("VM")){return uuidOldWorld
;
150 public UUID
getPresenceTermUuid(String key
) throws UndefinedTransformerMethodException
{
151 if (StringUtils
.isBlank(key
)){return null;
152 // }else if (key.equalsIgnoreCase("Ind.")){return CyprusTransformer.indigenousUuid;
153 // }else if (key.equalsIgnoreCase("+")){return CyprusTransformer.indigenousUuid;
154 // }else if (key.equalsIgnoreCase("?Ind.")){return CyprusTransformer.indigenousDoubtfulUuid;
155 // }else if (key.equalsIgnoreCase("?")){return CyprusTransformer.indigenousDoubtfulUuid;
157 // }else if (key.equalsIgnoreCase("?Cult.")){return CyprusTransformer.cultivatedDoubtfulUuid;
160 // }else if (key.equalsIgnoreCase("Ind.?")){return doubtfulIndigenousUuid;
161 // }else if (key.equalsIgnoreCase("D")){return doubtfulIndigenousUuid;
162 }else if (key
.equalsIgnoreCase("?Ind.?")){return doubtfulIndigenousDoubtfulUuid
;
163 }else if (key
.equalsIgnoreCase("??")){return doubtfulIndigenousDoubtfulUuid
;
165 }else if (key
.equalsIgnoreCase("Dud.")){return nonNativeDoubtfullyNaturalisedUuid
;
166 }else if (key
.equalsIgnoreCase("P")){return nonNativeDoubtfullyNaturalisedUuid
;
168 // }else if (key.equalsIgnoreCase("Adv.")){return adventiveAlienUuid;
169 // }else if (key.equalsIgnoreCase("A")){return adventiveAlienUuid;
170 }else if (key
.equalsIgnoreCase("(A)")){return rareCasualUuid
;
172 }else if (key
.equalsIgnoreCase("(C)")){return occasionallyCultivatedUuid
;
174 }else if (key
.equalsIgnoreCase("?E")){return endemicDoubtfullyPresentUuid
;
175 }else if (key
.equalsIgnoreCase("?Nat.")){return naturalisedDoubtfullyPresentUuid
;
176 }else if (key
.equalsIgnoreCase("?N")){return naturalisedDoubtfullyPresentUuid
;
177 }else if (key
.equalsIgnoreCase("?Dud.")){return nonNativeDoubtfullyPresentUuid
;
178 }else if (key
.equalsIgnoreCase("?P")){return nonNativeDoubtfullyPresentUuid
;
179 }else if (key
.equalsIgnoreCase("-End.")){return endemicInErrorUuid
;
180 }else if (key
.equalsIgnoreCase("-E")){return endemicInErrorUuid
;
181 }else if (key
.equalsIgnoreCase("-Nat.")){return naturalisedInErrorUuid
;
182 }else if (key
.equalsIgnoreCase("-N")){return naturalisedInErrorUuid
;
183 }else if (key
.equalsIgnoreCase("-Dud.")){return nonNativeInErrorUuid
;
184 }else if (key
.equalsIgnoreCase("-P")){return nonNativeInErrorUuid
;
185 }else if (key
.equalsIgnoreCase("-Adv.")){return adventiveInErrorUuid
;
186 }else if (key
.equalsIgnoreCase("-A")){return adventiveInErrorUuid
;
196 public PresenceAbsenceTerm
getPresenceTermByKey(String key
) throws UndefinedTransformerMethodException
{
197 if (StringUtils
.isBlank(key
)){return null;
199 }else if (key
.equalsIgnoreCase("E")){return PresenceAbsenceTerm
.ENDEMIC_FOR_THE_RELEVANT_AREA();
201 }else if (key
.equalsIgnoreCase("+")){return PresenceAbsenceTerm
.NATIVE();
202 }else if (key
.equalsIgnoreCase("Ind.")){return PresenceAbsenceTerm
.NATIVE();
203 }else if (key
.equalsIgnoreCase("Ind.?")){return PresenceAbsenceTerm
.NATIVE_DOUBTFULLY_NATIVE();
204 }else if (key
.equalsIgnoreCase("D")){return PresenceAbsenceTerm
.NATIVE_DOUBTFULLY_NATIVE();
206 }else if (key
.equalsIgnoreCase("-Ind.")){return PresenceAbsenceTerm
.NATIVE_REPORTED_IN_ERROR();
207 }else if (key
.equalsIgnoreCase("?Ind.")){return PresenceAbsenceTerm
.NATIVE_PRESENCE_QUESTIONABLE();
208 }else if (key
.equalsIgnoreCase("?")){return PresenceAbsenceTerm
.NATIVE_PRESENCE_QUESTIONABLE();
210 }else if (key
.equalsIgnoreCase("Adv.")){return PresenceAbsenceTerm
.CASUAL();
211 }else if (key
.equalsIgnoreCase("A")){return PresenceAbsenceTerm
.CASUAL();
213 }else if (key
.equalsIgnoreCase("Nat.")){return PresenceAbsenceTerm
.NATURALISED();
214 }else if (key
.equalsIgnoreCase("N")){return PresenceAbsenceTerm
.NATURALISED();
216 }else if (key
.equalsIgnoreCase("Cult.")){return PresenceAbsenceTerm
.CULTIVATED();
217 }else if (key
.equalsIgnoreCase("C")){return PresenceAbsenceTerm
.CULTIVATED();
218 }else if (key
.equalsIgnoreCase("?Cult.")){return PresenceAbsenceTerm
.CULTIVATED_PRESENCE_QUESTIONABLE();
220 }else if (key
.equalsIgnoreCase("-Cult.")){return PresenceAbsenceTerm
.CULTIVATED_REPORTED_IN_ERROR();
221 // }else if (key.equalsIgnoreCase("-C")){return PresenceAbsenceTerm.CULTIVATED_REPORTED_IN_ERROR();
223 }else if (key
.equalsIgnoreCase("--")){return PresenceAbsenceTerm
.REPORTED_IN_ERROR();
225 // }else if (key.equalsIgnoreCase("--")){return PresenceAbsenceTerm;
233 public UUID
getFeatureUuid(String key
) throws UndefinedTransformerMethodException
{
236 }else if (key
.equalsIgnoreCase("Alt.Fam.")){
237 return uuidAlternativeFamily
;
238 }else if (key
.equalsIgnoreCase("Alt.Fam.2")){
239 return uuidAlternativeFamily2
;
241 throw new RuntimeException("feature not defined: " + key
);