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.io.cuba;
|
11
|
|
12
|
import java.net.URI;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
import org.springframework.stereotype.Component;
|
17
|
import org.springframework.transaction.TransactionStatus;
|
18
|
|
19
|
import eu.etaxonomy.cdm.common.DOI;
|
20
|
import eu.etaxonomy.cdm.ext.geo.GeoServiceArea;
|
21
|
import eu.etaxonomy.cdm.ext.geo.GeoServiceAreaAnnotatedMapping;
|
22
|
import eu.etaxonomy.cdm.io.common.CdmImportBase;
|
23
|
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
|
24
|
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
|
25
|
import eu.etaxonomy.cdm.model.agent.Person;
|
26
|
import eu.etaxonomy.cdm.model.agent.Team;
|
27
|
import eu.etaxonomy.cdm.model.common.TermType;
|
28
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
29
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
|
30
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
31
|
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
|
32
|
import eu.etaxonomy.cdm.model.location.NamedAreaType;
|
33
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
34
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
35
|
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
|
36
|
|
37
|
|
38
|
/**
|
39
|
* @author a.mueller
|
40
|
* @since 05.01.2016
|
41
|
*/
|
42
|
|
43
|
@Component
|
44
|
public class CubaVocabularyImport extends CdmImportBase<CubaImportConfigurator, CubaImportState> {
|
45
|
private static final long serialVersionUID = -747486709409732371L;
|
46
|
|
47
|
private static final Logger logger = Logger.getLogger(CubaVocabularyImport.class);
|
48
|
|
49
|
/**
|
50
|
* {@inheritDoc}
|
51
|
*/
|
52
|
@Override
|
53
|
protected void doInvoke(CubaImportState state) {
|
54
|
try {
|
55
|
makeAreas(state);
|
56
|
makePresenceAbsenceTerms(state);
|
57
|
makeAlternativeFloras(state);
|
58
|
} catch (UndefinedTransformerMethodException e) {
|
59
|
e.printStackTrace();
|
60
|
}
|
61
|
}
|
62
|
|
63
|
/**
|
64
|
* @param state
|
65
|
*/
|
66
|
private void makeAlternativeFloras(CubaImportState state) {
|
67
|
|
68
|
//FRC
|
69
|
Reference refFRC = ReferenceFactory.newBook();
|
70
|
refFRC.setUuid(CubaTransformer.uuidRefFRC);
|
71
|
refFRC.setTitle("Flora de la República de Cuba");
|
72
|
getReferenceService().save(refFRC);
|
73
|
|
74
|
//A&S
|
75
|
Reference refAS = ReferenceFactory.newArticle();
|
76
|
refAS.setUuid(CubaTransformer.uuidRefAS);
|
77
|
refAS.setTitle("Catalogue of seed plants of the West Indies");
|
78
|
Person acevedo = Person.NewInstance();
|
79
|
acevedo.setGivenName("Pedro");
|
80
|
acevedo.setFamilyName("Acevedo-Rodríguez");
|
81
|
Person strong = Person.NewInstance();
|
82
|
strong.setGivenName("Mark T.");
|
83
|
strong.setFamilyName("Strong");
|
84
|
Team asTeam = Team.NewInstance();
|
85
|
asTeam.addTeamMember(acevedo);
|
86
|
asTeam.addTeamMember(strong);
|
87
|
refAS.setAuthorship(asTeam);
|
88
|
refAS.setDatePublished(TimePeriodParser.parseStringVerbatim("2012-01-01"));
|
89
|
refAS.setVolume("98");
|
90
|
refAS.setPages("i-xxv, 1-1192");
|
91
|
refAS.setIssn("0081-024X");
|
92
|
refAS.setDoi(DOI.fromString("10.5479/si.0081024X.98.1"));
|
93
|
refAS.setUri(URI.create("http://hdl.handle.net/10088/17551"));
|
94
|
String abstracct = "The catalogue enumerates all taxa of Gymnosperms, Dicotyledons, and Monocotyledons occurring in the West Indies archipelago excluding the islands off the coast of Venezuela (Netherlands Antilles, Venezuelan Antilles, Tobago, and Trinidad). For each accepted taxon, nomenclature (including synonyms described from the West Indies and their references to publication), distribution in the West Indies (including endemic, native, or exotic status), common names, and a numerical listing of literature records are given. Type specimen citations are provided for accepted names and synonyms of Cyperaceae, Sapindaceae, and some selected genera in several families including the Apocynaceae (Plumeria), Aquifoliaceae (Ilex), and Santalaceae (Dendrophthora). More than 30,000 names were treated comprising 208 families, 2,033 genera, and 12,279 taxa, which includes exotic and commonly cultivated plants. The total number of indigenous taxa was approximately 10,470 of which 71% (7,446 taxa) are endemic to the archipelago or part of it. Fifteen new names, 37 combinations, and 7 lectotypifications are validated. A searchable website of this catalogue, maintained and continuously updated at the Smithsonian Institution, is available at http://botany.si.edu/antilles/WestIndies/.";
|
95
|
refAS.setReferenceAbstract(abstracct);
|
96
|
Reference refASIn = ReferenceFactory.newJournal();
|
97
|
refASIn.setTitle("Smithsonian Contr. Bot.");
|
98
|
refAS.setInReference(refASIn);
|
99
|
getReferenceService().save(refAS);
|
100
|
|
101
|
//FC
|
102
|
Reference refFC = ReferenceFactory.newBook();
|
103
|
refFC.setUuid(CubaTransformer.uuidRefFC);
|
104
|
refFC.setTitle("Flora de Cuba");
|
105
|
Person leon = Person.NewTitledInstance("León");
|
106
|
Person alain = Person.NewTitledInstance("Alain");
|
107
|
Team fcTeam = Team.NewInstance();
|
108
|
fcTeam.addTeamMember(leon);
|
109
|
fcTeam.addTeamMember(alain);
|
110
|
refAS.setAuthorship(fcTeam);
|
111
|
getReferenceService().save(refFC);
|
112
|
|
113
|
}
|
114
|
|
115
|
/**
|
116
|
* @param state
|
117
|
* @throws UndefinedTransformerMethodException
|
118
|
*/
|
119
|
private void makePresenceAbsenceTerms(CubaImportState state) throws UndefinedTransformerMethodException {
|
120
|
TransactionStatus tx = startTransaction();
|
121
|
|
122
|
IInputTransformer transformer = state.getTransformer();
|
123
|
|
124
|
//vocabulary
|
125
|
UUID cubaStatusVocabularyUuid = UUID.fromString("e74bba61-551b-4f59-af83-a1a770e4b0ae");
|
126
|
String label = "Flora of Cuba Distribution Status";
|
127
|
String abbrev = null;
|
128
|
boolean isOrdered = true;
|
129
|
PresenceAbsenceTerm anyTerm = PresenceAbsenceTerm.PRESENT(); //just any
|
130
|
TermVocabulary<PresenceAbsenceTerm> cubaStatusVocabualary = getVocabulary(TermType.PresenceAbsenceTerm, cubaStatusVocabularyUuid, label, label, abbrev, null, isOrdered, anyTerm);
|
131
|
|
132
|
final boolean PRESENT = false;
|
133
|
|
134
|
//doubtfully endemic
|
135
|
UUID doubtfullyEndemicUuid = transformer.getPresenceTermUuid("?E");
|
136
|
this.getPresenceTerm(state, doubtfullyEndemicUuid, "endemic, doubtfully present", "endemic, doubtfully present", "?E", false);
|
137
|
|
138
|
//indigenous
|
139
|
// UUID indigenousUuid = transformer.getPresenceTermUuid("+");
|
140
|
// this.getPresenceTerm(state, indigenousUuid, "indigenous", "Indigenous", "+", false);
|
141
|
// UUID indigenousDoubtfulUuid = transformer.getPresenceTermUuid("?");
|
142
|
// this.getPresenceTerm(state, indigenousDoubtfulUuid, "indigenous, doubtfully present", "indigenous, doubtfully present", "?", false);
|
143
|
|
144
|
UUID nonNativeDoubtfulNaturalizedUuid = transformer.getPresenceTermUuid("P");
|
145
|
this.getPresenceTerm(state, nonNativeDoubtfulNaturalizedUuid, "non-native and doubtfully naturalised", "non-native and doubtfully naturalised", "P", false);
|
146
|
UUID rareCasualUuid = transformer.getPresenceTermUuid("(A)");
|
147
|
this.getPresenceTerm(state, rareCasualUuid, "rare casual", "rare casual", "(A)", false);
|
148
|
|
149
|
//occasionally cultivated
|
150
|
label = "occasionally cultivated";
|
151
|
abbrev = "(C)";
|
152
|
UUID occasionallyCultivatedUuid = transformer.getPresenceTermUuid(abbrev);
|
153
|
getPresenceTerm(state, occasionallyCultivatedUuid, label, label, abbrev, PRESENT, cubaStatusVocabualary);
|
154
|
|
155
|
//doubtfully present
|
156
|
UUID indigenousDoubtfullyPresentUuid = transformer.getPresenceTermUuid("D");
|
157
|
this.getPresenceTerm(state, indigenousDoubtfullyPresentUuid, "indigenous?", "Indigenous?", "D", false);
|
158
|
UUID doubtfullyIndigenousDoubtfullyPresentUuid = transformer.getPresenceTermUuid("??");
|
159
|
this.getPresenceTerm(state, doubtfullyIndigenousDoubtfullyPresentUuid, "?indigenous?", "doubfully indigenous, (and) doubtfully present", "??", false);
|
160
|
|
161
|
UUID doubtfullyNaturalisedUuid = transformer.getPresenceTermUuid("?N");
|
162
|
this.getPresenceTerm(state, doubtfullyNaturalisedUuid, "?non-native and doubtfully naturalised", "non-native and doubtfully naturalised, doubtfully present", "?N", false);
|
163
|
UUID doubtfullyNonNativeUuid = transformer.getPresenceTermUuid("?P");
|
164
|
this.getPresenceTerm(state, doubtfullyNonNativeUuid, "?adventive (casual) alien ", "adventive (casual) alien, doubtfully present", "?P", false);
|
165
|
|
166
|
//reported in error
|
167
|
boolean isAbsent = true;
|
168
|
UUID endemicErrorUuid = transformer.getPresenceTermUuid("-E");
|
169
|
this.getPresenceTerm(state, endemicErrorUuid, "endemic, reported in error", "endemic, reported in error", "-E", isAbsent);
|
170
|
UUID naturalizedErrorUuid = transformer.getPresenceTermUuid("-N");
|
171
|
this.getPresenceTerm(state, naturalizedErrorUuid, "naturalised, reported in error", "naturalised, reported in error", "-N", isAbsent);
|
172
|
UUID nonNativeErrorUuid = transformer.getPresenceTermUuid("-P");
|
173
|
this.getPresenceTerm(state, nonNativeErrorUuid, "non-native and doubtfully naturalised, reported in error", "non-native and doubtfully naturalised, reported in error", "-P", isAbsent);
|
174
|
UUID casualErrorUuid = transformer.getPresenceTermUuid("-A");
|
175
|
this.getPresenceTerm(state, casualErrorUuid, "adventive alien , reported in error", "adventive alien , reported in error", "-A", isAbsent);
|
176
|
|
177
|
commitTransaction(tx);
|
178
|
}
|
179
|
|
180
|
private boolean makeAreas(CubaImportState state) throws UndefinedTransformerMethodException{
|
181
|
TransactionStatus tx = startTransaction();
|
182
|
|
183
|
IInputTransformer transformer = state.getTransformer();
|
184
|
|
185
|
//vocabulary
|
186
|
UUID cubaAreasVocabularyUuid = UUID.fromString("c81e3c7b-3c01-47d1-87cf-388de4b1908c");
|
187
|
String label = "Cuba Areas";
|
188
|
String abbrev = null;
|
189
|
boolean isOrdered = true;
|
190
|
NamedArea anyArea = NamedArea.ARCTICOCEAN(); //just any
|
191
|
TermVocabulary<NamedArea> cubaAreasVocabualary = getVocabulary(TermType.NamedArea, cubaAreasVocabularyUuid, label, label, abbrev, null, isOrdered, anyArea);
|
192
|
|
193
|
TermMatchMode matchMode = null;
|
194
|
|
195
|
NamedAreaType areaType = null; //TODO
|
196
|
NamedAreaLevel level = null; //TODO
|
197
|
|
198
|
|
199
|
// String mappingFormat = "<?xml version=\"1.0\" ?><mapService xmlns=\"http://www.etaxonomy.eu/cdm\" "
|
200
|
// + "type=\"editMapService\"><area><layer>%s</layer><field>%s</field><value>%s</value></area></mapService>";
|
201
|
// String mappingAnnotation = String.format(mappingFormat, layer, field, value);
|
202
|
|
203
|
String mapping_layer_world = "flora_cuba_2016_world";
|
204
|
String mapping_field_world = "cuba_0";
|
205
|
String mapping_layer_regions = "flora_cuba_2016_regions";
|
206
|
String mapping_field_regions = "cuba_1";
|
207
|
String mapping_layer_provinces = "flora_cuba_2016_provinces";
|
208
|
String mapping_field_provinces = "cuba_2";
|
209
|
|
210
|
//Cuba
|
211
|
level = NamedAreaLevel.COUNTRY();
|
212
|
label = "Cuba";
|
213
|
abbrev = "Cu";
|
214
|
UUID cubaUuid = transformer.getNamedAreaUuid(abbrev);
|
215
|
NamedArea cuba = getNamedArea(state, cubaUuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
216
|
cuba.setIdInVocabulary(abbrev);
|
217
|
addMapping(cuba, mapping_layer_world, mapping_field_world, abbrev);
|
218
|
|
219
|
//Regions
|
220
|
level = null;
|
221
|
|
222
|
//Western Cuba
|
223
|
label = "Western Cuba";
|
224
|
abbrev = "CuW";
|
225
|
UUID cubaWestUuid = transformer.getNamedAreaUuid(abbrev);
|
226
|
NamedArea westernCuba = getNamedArea(state, cubaWestUuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
227
|
cuba.addIncludes(westernCuba);
|
228
|
westernCuba.setIdInVocabulary(abbrev);
|
229
|
addMapping(westernCuba, mapping_layer_regions, mapping_field_regions, abbrev);
|
230
|
|
231
|
//Central Cuba
|
232
|
label = "Central Cuba";
|
233
|
abbrev = "CuC";
|
234
|
UUID cubaCentralUuid = transformer.getNamedAreaUuid(abbrev);
|
235
|
NamedArea centralCuba = getNamedArea(state, cubaCentralUuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
236
|
cuba.addIncludes(centralCuba);
|
237
|
centralCuba.setIdInVocabulary(abbrev);
|
238
|
addMapping(centralCuba, mapping_layer_regions, mapping_field_regions, abbrev);
|
239
|
|
240
|
//East Cuba
|
241
|
label = "East Cuba";
|
242
|
abbrev = "CuE";
|
243
|
UUID cubaEastUuid = transformer.getNamedAreaUuid(abbrev);
|
244
|
NamedArea eastCuba = getNamedArea(state, cubaEastUuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
245
|
cuba.addIncludes(eastCuba);
|
246
|
eastCuba.setIdInVocabulary(abbrev);
|
247
|
addMapping(eastCuba, mapping_layer_regions, mapping_field_regions, abbrev);
|
248
|
|
249
|
//Provinces - West
|
250
|
level = NamedAreaLevel.PROVINCE();
|
251
|
|
252
|
//Pinar del Río PR
|
253
|
label = "Pinar del Río";
|
254
|
abbrev = "PR*";
|
255
|
UUID uuid = transformer.getNamedAreaUuid(abbrev);
|
256
|
NamedArea area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
257
|
westernCuba.addIncludes(area);
|
258
|
area.setIdInVocabulary(abbrev);
|
259
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
260
|
|
261
|
// //Habana Hab
|
262
|
// label = "Habana"; //including Ciudad de la Habana, Mayabeque, Artemisa
|
263
|
// abbrev = "HAB";
|
264
|
// uuid = transformer.getNamedAreaUuid(abbrev);
|
265
|
// NamedArea habana = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
266
|
// westernCuba.addIncludes(habana);
|
267
|
// area.setIdInVocabulary(abbrev);
|
268
|
|
269
|
//Artemisa
|
270
|
label = "Artemisa";
|
271
|
abbrev = "Art";
|
272
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
273
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
274
|
westernCuba.addIncludes(area);
|
275
|
area.setIdInVocabulary(abbrev);
|
276
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
277
|
|
278
|
//Ciudad de la Habana
|
279
|
label = "Ciudad de la Habana";
|
280
|
abbrev = "Hab*";
|
281
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
282
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
283
|
westernCuba.addIncludes(area);
|
284
|
area.setIdInVocabulary(abbrev);
|
285
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
286
|
|
287
|
//Ciudad de la Habana
|
288
|
label = "Mayabeque";
|
289
|
abbrev = "May";
|
290
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
291
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
292
|
westernCuba.addIncludes(area);
|
293
|
area.setIdInVocabulary(abbrev);
|
294
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
295
|
|
296
|
|
297
|
//Matanzas Mat
|
298
|
label = "Matanzas";
|
299
|
abbrev = "Mat";
|
300
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
301
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
302
|
westernCuba.addIncludes(area);
|
303
|
area.setIdInVocabulary(abbrev);
|
304
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
305
|
|
306
|
//Isla de la Juventud IJ
|
307
|
label = "Isla de la Juventud";
|
308
|
abbrev = "IJ";
|
309
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
310
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
311
|
westernCuba.addIncludes(area);
|
312
|
area.setIdInVocabulary(abbrev);
|
313
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
314
|
|
315
|
//Provinces - Central
|
316
|
//Villa Clara VC
|
317
|
label = "Villa Clara";
|
318
|
abbrev = "VC";
|
319
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
320
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
321
|
centralCuba.addIncludes(area);
|
322
|
area.setIdInVocabulary(abbrev);
|
323
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
324
|
|
325
|
//Cienfuegos Ci VC
|
326
|
label = "Cienfuegos";
|
327
|
abbrev = "Ci";
|
328
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
329
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
330
|
centralCuba.addIncludes(area);
|
331
|
area.setIdInVocabulary(abbrev);
|
332
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
333
|
|
334
|
//Sancti Spiritus SS
|
335
|
label = "Sancti Spíritus";
|
336
|
abbrev = "SS";
|
337
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
338
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
339
|
centralCuba.addIncludes(area);
|
340
|
area.setIdInVocabulary(abbrev);
|
341
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
342
|
|
343
|
//Ciego de Ávila CA
|
344
|
label = "Ciego de Ávila";
|
345
|
abbrev = "CA";
|
346
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
347
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
348
|
centralCuba.addIncludes(area);
|
349
|
area.setIdInVocabulary(abbrev);
|
350
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
351
|
|
352
|
//Camagüey Cam
|
353
|
label = "Camagüey";
|
354
|
abbrev = "Cam";
|
355
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
356
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
357
|
centralCuba.addIncludes(area);
|
358
|
area.setIdInVocabulary(abbrev);
|
359
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
360
|
|
361
|
//Las Tunas LT
|
362
|
label = "Las Tunas";
|
363
|
abbrev = "LT";
|
364
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
365
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
366
|
centralCuba.addIncludes(area);
|
367
|
area.setIdInVocabulary(abbrev);
|
368
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
369
|
|
370
|
//Provinces - East
|
371
|
//Granma Gr
|
372
|
label = "Granma";
|
373
|
abbrev = "Gr";
|
374
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
375
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
376
|
eastCuba.addIncludes(area);
|
377
|
area.setIdInVocabulary(abbrev);
|
378
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
379
|
|
380
|
//Holguín Ho
|
381
|
label = "Holguín";
|
382
|
abbrev = "Ho";
|
383
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
384
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
385
|
eastCuba.addIncludes(area);
|
386
|
area.setIdInVocabulary(abbrev);
|
387
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
388
|
|
389
|
//Santiago de Cuba SC
|
390
|
label = "Santiago de Cuba";
|
391
|
abbrev = "SC";
|
392
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
393
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
394
|
eastCuba.addIncludes(area);
|
395
|
area.setIdInVocabulary(abbrev);
|
396
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
397
|
|
398
|
//Guantánamo Gu
|
399
|
label = "Guantánamo";
|
400
|
abbrev = "Gu";
|
401
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
402
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
403
|
eastCuba.addIncludes(area);
|
404
|
area.setIdInVocabulary(abbrev);
|
405
|
addMapping(area, mapping_layer_provinces, mapping_field_provinces, abbrev);
|
406
|
|
407
|
//other Greater Antilles (Cuba, Española, Jamaica, Puerto Rico)
|
408
|
level = null;
|
409
|
//Española Esp (=Haiti + Dominican Republic)
|
410
|
label = "Española";
|
411
|
abbrev = "Esp";
|
412
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
413
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
414
|
area.setIdInVocabulary(abbrev);
|
415
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
416
|
|
417
|
//Jamaica Ja
|
418
|
level = NamedAreaLevel.COUNTRY();
|
419
|
label = "Jamaica";
|
420
|
abbrev = "Ja";
|
421
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
422
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
423
|
area.setIdInVocabulary(abbrev);
|
424
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
425
|
|
426
|
//Puerto Rico PR
|
427
|
level = NamedAreaLevel.COUNTRY();
|
428
|
label = "Puerto Rico";
|
429
|
abbrev = "PRc";
|
430
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
431
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
432
|
area.setIdInVocabulary(abbrev);
|
433
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
434
|
|
435
|
//Lesser Antilles Men
|
436
|
level = null;
|
437
|
label = "Lesser Antilles";
|
438
|
abbrev = "Men";
|
439
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
440
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
441
|
area.setIdInVocabulary(abbrev);
|
442
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
443
|
|
444
|
//Bahamas
|
445
|
label = "Bahamas";
|
446
|
abbrev = "Bah";
|
447
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
448
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
449
|
area.setIdInVocabulary(abbrev);
|
450
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
451
|
|
452
|
//Cayman Islands
|
453
|
label = "Cayman Islands"; //[Trinidad, Tobago, Curaçao, Margarita, ABC Isl. => S. America];
|
454
|
abbrev = "Cay";
|
455
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
456
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
457
|
area.setIdInVocabulary(abbrev);
|
458
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
459
|
|
460
|
//World
|
461
|
//N America
|
462
|
label = "N America"; //(incl. Mexico)
|
463
|
abbrev = "AmN";
|
464
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
465
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
466
|
area.setIdInVocabulary(abbrev);
|
467
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
468
|
|
469
|
//Central America
|
470
|
label = "Central America";
|
471
|
abbrev = "AmC";
|
472
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
473
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
474
|
area.setIdInVocabulary(abbrev);
|
475
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
476
|
|
477
|
//S America
|
478
|
label = "S America";
|
479
|
abbrev = "AmS";
|
480
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
481
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
482
|
area.setIdInVocabulary(abbrev);
|
483
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
484
|
|
485
|
//Old World
|
486
|
label = "Old World ";
|
487
|
abbrev = "VM";
|
488
|
uuid = transformer.getNamedAreaUuid(abbrev);
|
489
|
area = getNamedArea(state, uuid, label, label, abbrev, areaType, level, cubaAreasVocabualary, matchMode);
|
490
|
area.setIdInVocabulary(abbrev);
|
491
|
addMapping(area, mapping_layer_world, mapping_field_world, abbrev);
|
492
|
|
493
|
commitTransaction(tx);
|
494
|
return true;
|
495
|
}
|
496
|
|
497
|
|
498
|
/**
|
499
|
* @param cuba
|
500
|
* @param mapping_layer
|
501
|
* @param mapping_field
|
502
|
* @param abbrev
|
503
|
*/
|
504
|
private void addMapping(NamedArea area, String mapping_layer, String mapping_field, String abbrev) {
|
505
|
GeoServiceAreaAnnotatedMapping mapping = (GeoServiceAreaAnnotatedMapping)this.getBean("geoServiceAreaAnnotatedMapping");
|
506
|
GeoServiceArea geoServiceArea = new GeoServiceArea();
|
507
|
geoServiceArea.add(mapping_layer, mapping_field, abbrev);
|
508
|
mapping.set(area, geoServiceArea);
|
509
|
}
|
510
|
|
511
|
@Override
|
512
|
protected boolean isIgnore(CubaImportState state) {
|
513
|
return ! state.getConfig().isDoVocabularies();
|
514
|
}
|
515
|
|
516
|
|
517
|
@Override
|
518
|
protected boolean doCheck(CubaImportState state) {
|
519
|
logger.warn("DoCheck not yet implemented for CubaVocabularyImport");
|
520
|
return true;
|
521
|
}
|
522
|
|
523
|
|
524
|
|
525
|
}
|