Revision 5643a5ae
Added by Andreas Müller over 11 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisCurrentSpeciesImport.java | ||
---|---|---|
216 | 216 |
|
217 | 217 |
handleCommonNames(state, rs, species); |
218 | 218 |
|
219 |
this.doIdCreatedUpdatedNotes(state, species, rs, taxonId, REFERENCE_NAMESPACE);
|
|
219 |
this.doIdCreatedUpdatedNotes(state, species, rs, taxonId, TAXON_NAMESPACE);
|
|
220 | 220 |
|
221 | 221 |
objectsToSave.add(species); |
222 | 222 |
|
... | ... | |
253 | 253 |
countryStr = normalizeCountry(countryStr); |
254 | 254 |
} |
255 | 255 |
|
256 |
WaterbodyOrCountry country = WaterbodyOrCountry.getWaterbodyOrCountryByLabel(countryStr); |
|
257 |
if (country == null){ |
|
258 |
try { |
|
259 |
country = (WaterbodyOrCountry)state.getTransformer().getNamedAreaByKey(countryStr); |
|
260 |
} catch (UndefinedTransformerMethodException e) { |
|
261 |
e.printStackTrace(); |
|
262 |
} |
|
263 |
} |
|
256 |
WaterbodyOrCountry country = getCountry(state, countryStr); |
|
264 | 257 |
|
265 | 258 |
if (country != null){ |
266 | 259 |
TaxonDescription desc = getTaxonDescription(species, state.getTransactionalSourceReference(), false, true); |
... | ... | |
274 | 267 |
|
275 | 268 |
|
276 | 269 |
|
277 |
|
|
278 | 270 |
/** |
279 | 271 |
* @param countryStr |
280 | 272 |
* @return |
... | ... | |
362 | 354 |
taxon = Taxon.NewInstance(name, state.getTransactionalSourceReference()); |
363 | 355 |
|
364 | 356 |
taxonMap.put(key, taxon); |
365 |
handleAuthor(author, name); |
|
357 |
handleAuthorAndYear(author, name);
|
|
366 | 358 |
getTaxonService().save(taxon); |
367 | 359 |
} |
368 | 360 |
|
... | ... | |
385 | 377 |
|
386 | 378 |
} |
387 | 379 |
|
388 |
private INonViralNameParser parser = NonViralNameParserImpl.NewInstance(); |
|
389 |
|
|
390 |
|
|
391 | 380 |
/* (non-Javadoc) |
392 | 381 |
* @see eu.etaxonomy.cdm.io.common.mapping.IMappingImport#createObject(java.sql.ResultSet, eu.etaxonomy.cdm.io.common.ImportStateBase) |
393 | 382 |
*/ |
... | ... | |
405 | 394 |
zooName.setInfraGenericEpithet(subGenusEpi); |
406 | 395 |
} |
407 | 396 |
zooName.setGenusOrUninomial(genusEpi); |
408 |
handleAuthor(author, zooName); |
|
397 |
handleAuthorAndYear(author, zooName);
|
|
409 | 398 |
|
410 | 399 |
Taxon taxon = Taxon.NewInstance(zooName, state.getTransactionalSourceReference()); |
411 | 400 |
|
... | ... | |
415 | 404 |
|
416 | 405 |
|
417 | 406 |
|
418 |
/** |
|
419 |
* @param author |
|
420 |
* @param zooName |
|
421 |
*/ |
|
422 |
private void handleAuthor(String author, ZoologicalName zooName) { |
|
423 |
if (isBlank(author)){ |
|
424 |
return; |
|
425 |
} |
|
426 |
try { |
|
427 |
if(author.matches(".*\\,\\s\\[\\d{4}\\].*")){ |
|
428 |
author = author.replace("[", "").replace("]", ""); |
|
429 |
} |
|
430 |
if (author.contains("?")){ |
|
431 |
author = author.replace("H?bner", "H\u00fcbner"); |
|
432 |
author = author.replace("Oberth?r", "Oberth\u00fcr"); |
|
433 |
} |
|
434 |
|
|
435 |
parser.parseAuthors(zooName, author); |
|
436 |
} catch (StringNotParsableException e) { |
|
437 |
logger.warn("Author could not be parsed: " + author); |
|
438 |
zooName.setAuthorshipCache(author, true); |
|
439 |
} |
|
440 |
} |
|
441 | 407 |
|
442 | 408 |
/* (non-Javadoc) |
443 | 409 |
* @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getRelatedObjectsForPartition(java.sql.ResultSet) |
... | ... | |
465 | 431 |
} catch (SQLException e) { |
466 | 432 |
throw new RuntimeException(e); |
467 | 433 |
} |
468 |
return result; } |
|
434 |
return result; |
|
435 |
} |
|
469 | 436 |
|
470 | 437 |
/* (non-Javadoc) |
471 | 438 |
* @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IImportConfigurator) |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisImageImport.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
34 | 34 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
35 | 35 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
36 |
import eu.etaxonomy.cdm.strategy.exceptions.StringNotParsableException; |
|
37 | 36 |
import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser; |
38 | 37 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
39 | 38 |
|
... | ... | |
218 | 217 |
if (taxon == null){ |
219 | 218 |
ZoologicalName name = ZoologicalName.NewInstance(rank); |
220 | 219 |
taxon = Taxon.NewInstance(name, state.getTransactionalSourceReference()); |
221 |
handleAuthor(author, name); |
|
220 |
handleAuthorAndYear(author, name);
|
|
222 | 221 |
getTaxonService().save(taxon); |
223 | 222 |
} |
224 | 223 |
|
... | ... | |
261 | 260 |
zooName.setInfraSpecificEpithet(subGenusEpi); |
262 | 261 |
} |
263 | 262 |
zooName.setGenusOrUninomial(genusEpi); |
264 |
handleAuthor(author, zooName); |
|
263 |
handleAuthorAndYear(author, zooName);
|
|
265 | 264 |
|
266 | 265 |
Taxon taxon = Taxon.NewInstance(zooName, state.getTransactionalSourceReference()); |
267 | 266 |
|
... | ... | |
269 | 268 |
} |
270 | 269 |
|
271 | 270 |
|
272 |
|
|
273 |
|
|
274 |
/** |
|
275 |
* @param author |
|
276 |
* @param zooName |
|
277 |
*/ |
|
278 |
private void handleAuthor(String author, ZoologicalName zooName) { |
|
279 |
try { |
|
280 |
parser.parseAuthors(zooName, author); |
|
281 |
} catch (StringNotParsableException e) { |
|
282 |
logger.warn("Author could not be parsed: " + author); |
|
283 |
zooName.setAuthorshipCache(author, true); |
|
284 |
} |
|
285 |
} |
|
286 |
|
|
287 | 271 |
/* (non-Javadoc) |
288 | 272 |
* @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getRelatedObjectsForPartition(java.sql.ResultSet) |
289 | 273 |
*/ |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisImportBase.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner; |
34 | 34 |
import eu.etaxonomy.cdm.io.common.Source; |
35 | 35 |
import eu.etaxonomy.cdm.io.common.mapping.DbImportMapping; |
36 |
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException; |
|
36 | 37 |
import eu.etaxonomy.cdm.model.common.AnnotatableEntity; |
37 | 38 |
import eu.etaxonomy.cdm.model.common.Annotation; |
38 | 39 |
import eu.etaxonomy.cdm.model.common.AnnotationType; |
... | ... | |
42 | 43 |
import eu.etaxonomy.cdm.model.common.Language; |
43 | 44 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
44 | 45 |
import eu.etaxonomy.cdm.model.common.User; |
46 |
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry; |
|
47 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
|
48 |
import eu.etaxonomy.cdm.strategy.exceptions.StringNotParsableException; |
|
49 |
import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser; |
|
50 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
|
45 | 51 |
|
46 | 52 |
/** |
47 | 53 |
* @author a.mueller |
... | ... | |
64 | 70 |
//TODO needed? |
65 | 71 |
private Class cdmTargetClass; |
66 | 72 |
|
67 |
|
|
73 |
private INonViralNameParser parser = NonViralNameParserImpl.NewInstance(); |
|
74 |
|
|
68 | 75 |
|
69 | 76 |
/** |
70 | 77 |
* @param dbTableName |
... | ... | |
99 | 106 |
return; |
100 | 107 |
} |
101 | 108 |
|
109 |
/** |
|
110 |
* @param authorAndYear |
|
111 |
* @param zooName |
|
112 |
*/ |
|
113 |
protected void handleAuthorAndYear(String authorAndYear, ZoologicalName zooName) { |
|
114 |
if (isBlank(authorAndYear)){ |
|
115 |
return; |
|
116 |
} |
|
117 |
try { |
|
118 |
String doubtfulAuthorAndYear = null; |
|
119 |
if(authorAndYear.matches(".+\\,\\s\\[\\d{4}\\].*")){ |
|
120 |
doubtfulAuthorAndYear = authorAndYear; |
|
121 |
authorAndYear = authorAndYear.replace("[", "").replace("]", ""); |
|
122 |
} |
|
123 |
if (authorAndYear.contains("?")){ |
|
124 |
authorAndYear = authorAndYear.replace("H?bner", "H\u00fcbner"); |
|
125 |
authorAndYear = authorAndYear.replace("Oberth?r", "Oberth\u00fcr"); |
|
126 |
} |
|
127 |
|
|
128 |
parser.parseAuthors(zooName, authorAndYear); |
|
129 |
if (doubtfulAuthorAndYear != null){ |
|
130 |
zooName.setAuthorshipCache(doubtfulAuthorAndYear, true); |
|
131 |
} |
|
132 |
|
|
133 |
} catch (StringNotParsableException e) { |
|
134 |
logger.warn("Author could not be parsed: " + authorAndYear); |
|
135 |
zooName.setAuthorshipCache(authorAndYear, true); |
|
136 |
} |
|
137 |
} |
|
138 |
|
|
139 |
|
|
140 |
/** |
|
141 |
* @param state |
|
142 |
* @param countryStr |
|
143 |
* @return |
|
144 |
*/ |
|
145 |
protected WaterbodyOrCountry getCountry(GlobisImportState state, String countryStr) { |
|
146 |
WaterbodyOrCountry country = WaterbodyOrCountry.getWaterbodyOrCountryByLabel(countryStr); |
|
147 |
if (country == null){ |
|
148 |
try { |
|
149 |
country = (WaterbodyOrCountry)state.getTransformer().getNamedAreaByKey(countryStr); |
|
150 |
} catch (UndefinedTransformerMethodException e) { |
|
151 |
e.printStackTrace(); |
|
152 |
} |
|
153 |
} |
|
154 |
return country; |
|
155 |
} |
|
156 |
|
|
157 |
|
|
102 | 158 |
|
103 | 159 |
public boolean doPartition(ResultSetPartitioner partitioner, GlobisImportState state) { |
104 | 160 |
boolean success = true ; |
... | ... | |
290 | 346 |
return dateTime; |
291 | 347 |
} |
292 | 348 |
|
293 |
protected boolean resultSetHasColumn(ResultSet rs, String columnName){ |
|
294 |
try { |
|
295 |
ResultSetMetaData metaData = rs.getMetaData(); |
|
296 |
for (int i = 0; i < metaData.getColumnCount(); i++){ |
|
297 |
if (metaData.getColumnName(i + 1).equalsIgnoreCase(columnName)){ |
|
298 |
return true; |
|
299 |
} |
|
300 |
} |
|
301 |
return false; |
|
302 |
} catch (SQLException e) { |
|
303 |
logger.warn("Exception in resultSetHasColumn"); |
|
304 |
return false; |
|
305 |
} |
|
306 |
} |
|
307 | 349 |
|
308 |
protected boolean checkSqlServerColumnExists(Source source, String tableName, String columnName){ |
|
309 |
String strQuery = "SELECT Count(t.id) as n " + |
|
310 |
" FROM sysobjects AS t " + |
|
311 |
" INNER JOIN syscolumns AS c ON t.id = c.id " + |
|
312 |
" WHERE (t.xtype = 'U') AND " + |
|
313 |
" (t.name = '" + tableName + "') AND " + |
|
314 |
" (c.name = '" + columnName + "')"; |
|
315 |
ResultSet rs = source.getResultSet(strQuery) ; |
|
316 |
int n; |
|
317 |
try { |
|
318 |
rs.next(); |
|
319 |
n = rs.getInt("n"); |
|
320 |
return n>0; |
|
321 |
} catch (SQLException e) { |
|
322 |
e.printStackTrace(); |
|
323 |
return false; |
|
324 |
} |
|
325 |
|
|
326 |
} |
|
327 | 350 |
|
328 |
/** |
|
329 |
* Returns a map that holds all values of a ResultSet. This is needed if a value needs to |
|
330 |
* be accessed twice |
|
331 |
* @param rs |
|
332 |
* @return |
|
333 |
* @throws SQLException |
|
334 |
*/ |
|
335 |
protected Map<String, Object> getValueMap(ResultSet rs) throws SQLException{ |
|
336 |
try{ |
|
337 |
Map<String, Object> valueMap = new HashMap<String, Object>(); |
|
338 |
int colCount = rs.getMetaData().getColumnCount(); |
|
339 |
for (int c = 0; c < colCount ; c++){ |
|
340 |
Object value = rs.getObject(c+1); |
|
341 |
String label = rs.getMetaData().getColumnLabel(c+1).toLowerCase(); |
|
342 |
if (value != null && ! CdmUtils.Nz(value.toString()).trim().equals("")){ |
|
343 |
valueMap.put(label, value); |
|
344 |
} |
|
345 |
} |
|
346 |
return valueMap; |
|
347 |
}catch(SQLException e){ |
|
348 |
throw e; |
|
349 |
} |
|
350 |
} |
|
351 |
|
|
352 |
protected ExtensionType getExtensionType(UUID uuid, String label, String text, String labelAbbrev){ |
|
353 |
ExtensionType extensionType = (ExtensionType)getTermService().find(uuid); |
|
354 |
if (extensionType == null){ |
|
355 |
extensionType = ExtensionType.NewInstance(text, label, labelAbbrev); |
|
356 |
extensionType.setUuid(uuid); |
|
357 |
getTermService().save(extensionType); |
|
358 |
} |
|
359 |
return extensionType; |
|
360 |
} |
|
361 |
|
|
362 |
protected MarkerType getMarkerType(UUID uuid, String label, String text, String labelAbbrev){ |
|
363 |
MarkerType markerType = (MarkerType)getTermService().find(uuid); |
|
364 |
if (markerType == null){ |
|
365 |
markerType = MarkerType.NewInstance(label, text, labelAbbrev); |
|
366 |
markerType.setUuid(uuid); |
|
367 |
getTermService().save(markerType); |
|
368 |
} |
|
369 |
return markerType; |
|
370 |
} |
|
371 |
|
|
372 |
|
|
373 | 351 |
/** |
374 | 352 |
* Reads a foreign key field from the result set and adds its value to the idSet. |
375 | 353 |
* @param rs |
... | ... | |
385 | 363 |
} |
386 | 364 |
} |
387 | 365 |
|
366 |
|
|
367 |
|
|
368 |
|
|
388 | 369 |
/** |
389 | 370 |
* Returns true if i is a multiple of recordsPerTransaction |
390 | 371 |
* @param i |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisReferenceImport.java | ||
---|---|---|
74 | 74 |
protected String getIdQuery() { |
75 | 75 |
String strRecordQuery = |
76 | 76 |
" SELECT refID " + |
77 |
" FROM " + dbTableName; |
|
77 |
" FROM " + dbTableName |
|
78 |
+ " WHERE RefSource like 'Original'"; |
|
78 | 79 |
return strRecordQuery; |
79 | 80 |
} |
80 | 81 |
|
... | ... | |
215 | 216 |
String refType = rs.getString("RefType"); |
216 | 217 |
if (refType == null){ |
217 | 218 |
ref = ReferenceFactory.newGeneric(); |
218 |
}else if (refType == "book"){
|
|
219 |
}else if (refType.equals("book")){
|
|
219 | 220 |
ref = ReferenceFactory.newBook(); |
220 |
}else if (refType == "paper in journal"){
|
|
221 |
}else if (refType.equals("paper in journal")){
|
|
221 | 222 |
ref = ReferenceFactory.newArticle(); |
222 | 223 |
}else if (refType.startsWith("unpublished") ){ |
223 | 224 |
ref = ReferenceFactory.newGeneric(); |
224 | 225 |
}else if (refType.endsWith("paper in journal")){ |
225 | 226 |
ref = ReferenceFactory.newArticle(); |
226 |
}else if (refType == "paper in book"){
|
|
227 |
}else if (refType.equals("paper in book")){
|
|
227 | 228 |
ref = ReferenceFactory.newBookSection(); |
228 |
}else if (refType == "paper in journalwebsite"){
|
|
229 |
}else if (refType.equals("paper in journalwebsite")){
|
|
229 | 230 |
ref = ReferenceFactory.newArticle(); |
230 | 231 |
}else{ |
231 | 232 |
logger.warn("Unknown reference type: " + refType); |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisSpecTaxImport.java | ||
---|---|---|
15 | 15 |
import java.util.HashSet; |
16 | 16 |
import java.util.Map; |
17 | 17 |
import java.util.Set; |
18 |
import java.util.regex.Matcher; |
|
19 |
import java.util.regex.Pattern; |
|
18 | 20 |
|
19 | 21 |
import org.apache.commons.lang.StringUtils; |
20 | 22 |
import org.apache.log4j.Logger; |
21 | 23 |
import org.springframework.stereotype.Component; |
22 | 24 |
|
25 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
|
26 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade.DerivedUnitType; |
|
27 |
import eu.etaxonomy.cdm.common.CdmUtils; |
|
23 | 28 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator; |
24 | 29 |
import eu.etaxonomy.cdm.io.common.IOValidator; |
25 | 30 |
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner; |
... | ... | |
27 | 32 |
import eu.etaxonomy.cdm.io.globis.validation.GlobisReferenceImportValidator; |
28 | 33 |
import eu.etaxonomy.cdm.io.globis.validation.GlobisSpecTaxaImportValidator; |
29 | 34 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
35 |
import eu.etaxonomy.cdm.model.common.Extension; |
|
36 |
import eu.etaxonomy.cdm.model.common.Marker; |
|
37 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
|
38 |
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry; |
|
39 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
40 |
import eu.etaxonomy.cdm.model.name.Rank; |
|
41 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
|
42 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
|
43 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationTest; |
|
44 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
|
45 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
|
46 |
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent; |
|
47 |
import eu.etaxonomy.cdm.model.occurrence.DerivationEventType; |
|
48 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase; |
|
49 |
import eu.etaxonomy.cdm.model.occurrence.FieldObservation; |
|
50 |
import eu.etaxonomy.cdm.model.occurrence.Specimen; |
|
30 | 51 |
import eu.etaxonomy.cdm.model.reference.Reference; |
31 | 52 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
32 | 53 |
import eu.etaxonomy.cdm.model.reference.ReferenceType; |
54 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
55 |
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType; |
|
56 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
57 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
58 |
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException; |
|
33 | 59 |
|
34 | 60 |
|
35 | 61 |
/** |
... | ... | |
76 | 102 |
" SELECT t.*, t.DateCreated as Created_When, t.CreatedBy as Created_Who," + |
77 | 103 |
" t.ModifiedBy as Updated_who, t.DateModified as Updated_When, t.SpecRemarks as Notes " + |
78 | 104 |
" FROM " + getTableName() + " t " + |
79 |
" WHERE ( t.refId IN (" + ID_LIST_TOKEN + ") )";
|
|
105 |
" WHERE ( t.specTaxId IN (" + ID_LIST_TOKEN + ") )";
|
|
80 | 106 |
return strRecordQuery; |
81 | 107 |
} |
82 | 108 |
|
... | ... | |
89 | 115 |
public boolean doPartition(ResultSetPartitioner partitioner, GlobisImportState state) { |
90 | 116 |
boolean success = true; |
91 | 117 |
|
92 |
Set<Reference> objectsToSave = new HashSet<Reference>();
|
|
118 |
Set<TaxonBase> objectsToSave = new HashSet<TaxonBase>();
|
|
93 | 119 |
|
94 |
// Map<String, TaxonBase> taxonMap = (Map<String, TaxonBase>) partitioner.getObjectMap(BerlinModelTaxonImport.NAMESPACE);
|
|
95 |
// Map<String, DerivedUnit> ecoFactDerivedUnitMap = (Map<String, DerivedUnit>) partitioner.getObjectMap(ECO_FACT_DERIVED_UNIT_NAMESPACE);
|
|
120 |
Map<String, Taxon> taxonMap = (Map<String, Taxon>) partitioner.getObjectMap(TAXON_NAMESPACE);
|
|
121 |
Map<String, Reference> referenceMap = (Map<String, Reference>) partitioner.getObjectMap(REFERENCE_NAMESPACE);
|
|
96 | 122 |
|
97 | 123 |
ResultSet rs = partitioner.getResultSet(); |
98 | 124 |
|
... | ... | |
105 | 131 |
|
106 | 132 |
if ((i++ % modCount) == 0 && i!= 1 ){ logger.info(pluralString + " handled: " + (i-1));} |
107 | 133 |
|
108 |
Integer refId = rs.getInt("RefId");
|
|
109 |
String title = rs.getString("RefTitle");
|
|
110 |
String refJournal = rs.getString("RefJournal");
|
|
111 |
|
|
134 |
Integer specTaxId = rs.getInt("SpecTaxId");
|
|
135 |
Integer acceptedTaxonId = nullSafeInt(rs, "SpecCurrspecID");
|
|
136 |
String specSystaxRank = rs.getString("SpecSystaxRank");
|
|
137 |
|
|
112 | 138 |
try { |
113 | 139 |
|
114 | 140 |
//source ref |
115 | 141 |
Reference<?> sourceRef = state.getTransactionalSourceReference(); |
116 | 142 |
|
117 |
Reference<?> ref = createObject(rs, state);
|
|
118 |
ref.setTitle(title);
|
|
143 |
Taxon acceptedTaxon = taxonMap.get(String.valueOf(acceptedTaxonId));
|
|
144 |
TaxonBase<?> thisTaxon = null;
|
|
119 | 145 |
|
120 |
if (StringUtils.isNotBlank(refJournal)){ |
|
121 |
if (ref.getType().equals(ReferenceType.Article) ){ |
|
122 |
Reference<?> journal = getJournal(state, rs, refJournal); |
|
123 |
ref.setInJournal(journal); |
|
146 |
if (isBlank(specSystaxRank) ){ |
|
147 |
//TODO |
|
148 |
}else if (specSystaxRank.equals("synonym")){ |
|
149 |
Synonym synonym = getSynonym(state, rs); |
|
150 |
if (acceptedTaxon == null){ |
|
151 |
//TODO |
|
152 |
logger.warn("Accepted taxon (" + acceptedTaxonId + ") not found for synonym "+ specTaxId); |
|
124 | 153 |
}else{ |
125 |
logger.warn("Reference type not supported for journal: " + ref.getType().toString()); |
|
154 |
acceptedTaxon.addSynonym(synonym, SynonymRelationshipType.SYNONYM_OF()); |
|
155 |
thisTaxon = synonym; |
|
126 | 156 |
} |
157 |
}else if (specSystaxRank.equals("species")){ |
|
158 |
validateAcceptedTaxon(acceptedTaxon, rs, specTaxId, acceptedTaxonId); |
|
159 |
thisTaxon = acceptedTaxon; |
|
160 |
}else{ |
|
161 |
logger.warn(String.format("Unhandled specSystaxRank %s in specTaxId %d", specSystaxRank, specTaxId)); |
|
127 | 162 |
} |
128 | 163 |
|
129 |
this.doIdCreatedUpdatedNotes(state, ref, rs, refId, REFERENCE_NAMESPACE); |
|
130 |
|
|
131 |
|
|
164 |
if (thisTaxon != null){ |
|
165 |
ZoologicalName name = CdmBase.deproxy(thisTaxon.getName(), ZoologicalName.class); |
|
166 |
|
|
167 |
handleNomRef(state, referenceMap, rs, name); |
|
132 | 168 |
|
133 |
//DONE |
|
134 |
// RefType, RefTitle, RefJournal |
|
169 |
handleTypeInformation(state,rs, name); |
|
135 | 170 |
|
136 |
//TODO |
|
137 |
//Refid,CreatedBy,DateCreated,DateModified,ModifiedBy |
|
138 |
//RefAuthor,RefBookTitle,RefDatePublished |
|
139 |
//RefEdition, RefEditor, RefGeneralKeywords |
|
140 |
//RefGeoKeywords, RefIll only,RefISSN, RefJournal |
|
141 |
//RefLibrary, RefMarker,RefPages,RefPages only, |
|
142 |
//RefPlace, RefPublisher, RefRemarks, |
|
143 |
//RefSerial, RefSource, RefSpecificKeywords, RefTaxKeywords, |
|
144 |
//RefURL, RefVolPageFig, RefVolume, RefYear |
|
145 |
//SpecificKeywordDummy |
|
146 | 171 |
|
147 |
//no data |
|
148 |
//CountryDummy |
|
172 |
// this.doIdCreatedUpdatedNotes(state, ref, rs, refId, REFERENCE_NAMESPACE); |
|
149 | 173 |
|
150 |
objectsToSave.add(ref); |
|
174 |
objectsToSave.add(acceptedTaxon); |
|
175 |
} |
|
151 | 176 |
|
152 | 177 |
|
153 | 178 |
} catch (Exception e) { |
154 |
logger.warn("Exception in literature: RefId " + refId + ". " + e.getMessage());
|
|
155 |
// e.printStackTrace();
|
|
179 |
logger.warn("Exception in specTax: SpecTaxId " + specTaxId + ". " + e.getMessage());
|
|
180 |
e.printStackTrace(); |
|
156 | 181 |
} |
157 | 182 |
|
158 | 183 |
} |
... | ... | |
160 | 185 |
// logger.warn("Specimen: " + countSpecimen + ", Descriptions: " + countDescriptions ); |
161 | 186 |
|
162 | 187 |
logger.warn(pluralString + " to save: " + objectsToSave.size()); |
163 |
getReferenceService().save(objectsToSave);
|
|
188 |
getTaxonService().save(objectsToSave);
|
|
164 | 189 |
|
165 | 190 |
return success; |
166 |
} catch (SQLException e) {
|
|
167 |
logger.error("SQLException:" + e);
|
|
191 |
} catch (Exception e) { |
|
192 |
logger.error("Exception: " + e);
|
|
168 | 193 |
return false; |
169 | 194 |
} |
170 | 195 |
} |
171 | 196 |
|
172 | 197 |
|
198 |
private Pattern patternAll = Pattern.compile("(.+,\\s.+)(\\(.+\\))"); |
|
199 |
|
|
200 |
|
|
201 |
private void handleTypeInformation(GlobisImportState state, ResultSet rs, ZoologicalName name) throws SQLException { |
|
202 |
|
|
203 |
String specTypeDepositoriesStr = rs.getString("SpecTypeDepository"); |
|
204 |
String countryString = rs.getString("SpecTypeCountry"); |
|
205 |
|
|
206 |
if (! hasTypeInformation(specTypeDepositoriesStr, countryString)){ |
|
207 |
return; |
|
208 |
} |
|
209 |
|
|
210 |
FieldObservation fieldObservation = makeTypeFieldObservation(state, countryString); |
|
211 |
|
|
212 |
String[] specTypeDepositories = specTypeDepositoriesStr.split(";"); |
|
213 |
//TODO different issues |
|
214 |
if (specTypeDepositories.length == 0){ |
|
215 |
//TODO |
|
216 |
} |
|
217 |
for (String specTypeDepositoryStr : specTypeDepositories){ |
|
218 |
specTypeDepositoryStr = specTypeDepositoryStr.trim(); |
|
219 |
|
|
220 |
//Specimen |
|
221 |
Specimen specimen = makeSingleTypeSpecimen(fieldObservation); |
|
222 |
|
|
223 |
if (specTypeDepositoryStr.equals("??")){ |
|
224 |
//unknown |
|
225 |
//TODO |
|
226 |
specimen.setTitleCache("??", true); |
|
227 |
}else{ |
|
228 |
specTypeDepositoryStr = makeAdditionalSpecimenInformation( |
|
229 |
specTypeDepositoryStr, specimen); |
|
230 |
|
|
231 |
makeCollection(specTypeDepositoryStr, specimen); |
|
232 |
} |
|
233 |
|
|
234 |
//type Designation |
|
235 |
makeTypeDesignation(name, rs, specimen); |
|
236 |
} |
|
237 |
|
|
238 |
} |
|
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
private boolean hasTypeInformation(String specTypeDepositoriesStr, String countryString) { |
|
244 |
boolean result = false; |
|
245 |
result |= isNotBlank(specTypeDepositoriesStr) || isNotBlank(countryString); |
|
246 |
return result; |
|
247 |
} |
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
/** |
|
252 |
* @param specTypeDepositoryStr |
|
253 |
* @param specimen |
|
254 |
*/ |
|
255 |
protected void makeCollection(String specTypeDepositoryStr, Specimen specimen) { |
|
256 |
//TODO deduplicate |
|
257 |
Map<String, Collection> collectionMap = new HashMap<String, Collection>(); |
|
258 |
|
|
259 |
|
|
260 |
//Collection |
|
261 |
String[] split = specTypeDepositoryStr.split(","); |
|
262 |
if (split.length != 2){ |
|
263 |
if (split.length == 1 && split[0].startsWith("coll.")){ |
|
264 |
Collection collection = Collection.NewInstance(); |
|
265 |
collection.setName(split[0]); |
|
266 |
}else{ |
|
267 |
logger.warn("Split size is not 2: " + specTypeDepositoryStr); |
|
268 |
} |
|
269 |
|
|
270 |
}else{ |
|
271 |
String collectionStr = split[0]; |
|
272 |
String location = split[1]; |
|
273 |
|
|
274 |
|
|
275 |
Collection collection = collectionMap.get(collectionStr); |
|
276 |
if (collection == null){ |
|
277 |
collection = Collection.NewInstance(); |
|
278 |
collection.setCode(collectionStr); |
|
279 |
collection.setTownOrLocation(split[1]); |
|
280 |
}else if (CdmUtils.nullSafeEqual(location, collection.getTownOrLocation())){ |
|
281 |
String message = "Location (%s) is not equal to location (%s) of existing collection"; |
|
282 |
logger.warn(String.format(message, location, collection.getTownOrLocation(), collection.getCode())); |
|
283 |
} |
|
284 |
|
|
285 |
specimen.setCollection(collection); |
|
286 |
|
|
287 |
} |
|
288 |
} |
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
293 |
/** |
|
294 |
* @param specTypeDepositoriesStr |
|
295 |
* @param specTypeDepositoryStr |
|
296 |
* @param specimen |
|
297 |
* @return |
|
298 |
*/ |
|
299 |
protected String makeAdditionalSpecimenInformation( String specTypeDepositoryStr, |
|
300 |
Specimen specimen) { |
|
301 |
//doubful |
|
302 |
if (specTypeDepositoryStr.endsWith("?")){ |
|
303 |
Marker.NewInstance(specimen, true, MarkerType.IS_DOUBTFUL()); |
|
304 |
specTypeDepositoryStr = specTypeDepositoryStr.substring(0, specTypeDepositoryStr.length() -1).trim(); |
|
305 |
} |
|
306 |
|
|
307 |
//brackets |
|
308 |
Matcher matcher = patternAll.matcher(specTypeDepositoryStr); |
|
309 |
if (matcher.find()){ |
|
310 |
//has brackets |
|
311 |
String brackets = matcher.group(2); |
|
312 |
brackets = brackets.substring(1, brackets.length()-1); |
|
313 |
|
|
314 |
brackets = brackets.replace("[mm]", "\u2642\u2642"); |
|
315 |
brackets = brackets.replace("[m]", "\u2642"); |
|
316 |
brackets = brackets.replace("[ff]", "\u2640\u2640"); |
|
317 |
brackets = brackets.replace("[f]", "\u2640"); |
|
318 |
|
|
319 |
if (brackets.contains("[") || brackets.contains("]")){ |
|
320 |
logger.warn ("There are still '[', ']' in the bracket part: " + brackets); |
|
321 |
} |
|
322 |
|
|
323 |
//TODO replace mm/ff by Unicode male |
|
324 |
specimen.setTitleCache(brackets, true); |
|
325 |
specTypeDepositoryStr = matcher.group(1).trim(); |
|
326 |
} |
|
327 |
return specTypeDepositoryStr; |
|
328 |
} |
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
|
|
333 |
/** |
|
334 |
* @param fieldObservation |
|
335 |
* @return |
|
336 |
*/ |
|
337 |
protected Specimen makeSingleTypeSpecimen(FieldObservation fieldObservation) { |
|
338 |
DerivationEvent derivEvent = DerivationEvent.NewInstance(); |
|
339 |
// derivEvent.setType(DerivationEventType.ACCESSIONING()); |
|
340 |
fieldObservation.addDerivationEvent(derivEvent); |
|
341 |
Specimen specimen = Specimen.NewInstance(); |
|
342 |
specimen.setDerivedFrom(derivEvent); |
|
343 |
return specimen; |
|
344 |
} |
|
345 |
|
|
346 |
|
|
347 |
|
|
348 |
|
|
349 |
/** |
|
350 |
* @param state |
|
351 |
* @return |
|
352 |
* @throws SQLException |
|
353 |
*/ |
|
354 |
protected FieldObservation makeTypeFieldObservation(GlobisImportState state, |
|
355 |
String countryString) throws SQLException { |
|
356 |
|
|
357 |
DerivedUnitType unitType = DerivedUnitType.Specimen; |
|
358 |
DerivedUnitFacade facade = DerivedUnitFacade.NewInstance(unitType); |
|
359 |
|
|
360 |
WaterbodyOrCountry typeCountry = getCountry(state, countryString); |
|
361 |
facade.setCountry(typeCountry); |
|
362 |
FieldObservation fieldObservation = facade.innerFieldObservation(); |
|
363 |
return fieldObservation; |
|
364 |
} |
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
|
|
369 |
/** |
|
370 |
* @param name |
|
371 |
* @param rs |
|
372 |
* @param status |
|
373 |
* @param specimen |
|
374 |
* @throws SQLException |
|
375 |
*/ |
|
376 |
protected void makeTypeDesignation(ZoologicalName name, ResultSet rs, Specimen specimen) throws SQLException { |
|
377 |
//type |
|
378 |
String specType = rs.getString("SpecType"); |
|
379 |
SpecimenTypeDesignationStatus status = getTypeDesigType(specType); |
|
380 |
|
|
381 |
SpecimenTypeDesignation typeDesignation = SpecimenTypeDesignation.NewInstance(); |
|
382 |
typeDesignation.setTypeStatus(status); |
|
383 |
typeDesignation.setTypeSpecimen(specimen); |
|
384 |
|
|
385 |
name.addTypeDesignation(typeDesignation, true); |
|
386 |
} |
|
387 |
|
|
388 |
|
|
389 |
|
|
390 |
|
|
391 |
private SpecimenTypeDesignationStatus getTypeDesigType(String specType) { |
|
392 |
if (isBlank(specType) ){ |
|
393 |
return null; |
|
394 |
}else if (specType.matches("Holotype(Holotypus)?")){ |
|
395 |
return SpecimenTypeDesignationStatus.HOLOTYPE(); |
|
396 |
}else if (specType.matches("Neotype")){ |
|
397 |
return SpecimenTypeDesignationStatus.NEOTYPE(); |
|
398 |
}else if (specType.matches("Syntype(\\(s\\))?")){ |
|
399 |
return SpecimenTypeDesignationStatus.SYNTYPE(); |
|
400 |
}else if (specType.matches("Lectotype")){ |
|
401 |
return SpecimenTypeDesignationStatus.LECTOTYPE(); |
|
402 |
}else{ |
|
403 |
logger.warn("SpecimenTypeDesignationStatus does not match: " + specType); |
|
404 |
return null; |
|
405 |
} |
|
406 |
} |
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
/** |
|
412 |
* @param state |
|
413 |
* @param referenceMap |
|
414 |
* @param rs |
|
415 |
* @param name |
|
416 |
* @return |
|
417 |
* @throws SQLException |
|
418 |
*/ |
|
419 |
private Reference<?> handleNomRef(GlobisImportState state, Map<String, Reference> referenceMap, ResultSet rs, |
|
420 |
ZoologicalName name) throws SQLException { |
|
421 |
//ref |
|
422 |
Integer refId = nullSafeInt(rs, "fiSpecRefID"); |
|
423 |
Reference<?> nomRef = null; |
|
424 |
if (refId != null){ |
|
425 |
nomRef = referenceMap.get(String.valueOf(refId)); |
|
426 |
if (nomRef == null && state.getConfig().getDoReferences().equals(state.getConfig().getDoReferences().ALL)){ |
|
427 |
logger.warn("Reference " + refId + " could not be found."); |
|
428 |
}else if (nomRef != null){ |
|
429 |
name.setNomenclaturalReference(nomRef); |
|
430 |
} |
|
431 |
} |
|
432 |
|
|
433 |
//refDetail |
|
434 |
String refDetail = rs.getString("SpecPage"); |
|
435 |
if (isNotBlank(refDetail)){ |
|
436 |
name.setNomenclaturalMicroReference(refDetail); |
|
437 |
} |
|
438 |
return nomRef; |
|
439 |
} |
|
440 |
|
|
441 |
|
|
173 | 442 |
|
174 | 443 |
|
444 |
private void validateAcceptedTaxon(Taxon acceptedTaxon, ResultSet rs, Integer specTaxId, Integer acceptedTaxonId) throws SQLException { |
|
445 |
if (acceptedTaxon == null){ |
|
446 |
logger.warn("Accepted taxon is null for taxon taxon to validate: "); |
|
447 |
return; |
|
448 |
} |
|
449 |
|
|
450 |
//TODO |
|
451 |
ZoologicalName name = CdmBase.deproxy(acceptedTaxon.getName(), ZoologicalName.class); |
|
452 |
|
|
453 |
String specName = rs.getString("SpecName"); |
|
454 |
if (! name.getSpecificEpithet().equals(specName)){ |
|
455 |
logger.warn(String.format("Species epithet is not equal for accepted taxon: %s - %s", name.getSpecificEpithet(), specName)); |
|
456 |
} |
|
457 |
//TODO |
|
458 |
} |
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
|
|
463 |
private Synonym getSynonym(GlobisImportState state, ResultSet rs) throws SQLException { |
|
464 |
//rank |
|
465 |
String rankStr = rs.getString("SpecRank"); |
|
466 |
Rank rank = null; |
|
467 |
if (isNotBlank(rankStr)){ |
|
468 |
try { |
|
469 |
rank = Rank.getRankByNameOrAbbreviation(rankStr, NomenclaturalCode.ICZN, true); |
|
470 |
} catch (UnknownCdmTypeException e) { |
|
471 |
e.printStackTrace(); |
|
472 |
} |
|
473 |
} |
|
474 |
|
|
475 |
//name |
|
476 |
ZoologicalName name = ZoologicalName.NewInstance(rank); |
|
477 |
makeNamePartsAndCache(state, rs, rankStr, name); |
|
478 |
|
|
479 |
|
|
480 |
// name.setGenusOrUninomial(genusOrUninomial); |
|
481 |
String authorStr = rs.getString("SpecAuthor"); |
|
482 |
String yearStr = rs.getString("SpecYear"); |
|
483 |
String authorAndYearStr = CdmUtils.concat(", ", authorStr, yearStr); |
|
484 |
handleAuthorAndYear(authorAndYearStr, name); |
|
485 |
|
|
486 |
Synonym synonym = Synonym.NewInstance(name, state.getTransactionalSourceReference()); |
|
487 |
|
|
488 |
return synonym; |
|
489 |
} |
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
|
|
494 |
private void makeNamePartsAndCache(GlobisImportState state, ResultSet rs, String rank, ZoologicalName name) throws SQLException { |
|
495 |
String citedFamily = rs.getString("SpecCitedFamily"); |
|
496 |
String citedGenus = rs.getString("SpecCitedGenus"); |
|
497 |
String citedSpecies = rs.getString("SpecCitedSpecies"); |
|
498 |
String citedSubspecies = rs.getString("SpecCitedSubspecies"); |
|
499 |
String lastEpithet = rs.getString("SpecName"); |
|
500 |
|
|
501 |
|
|
502 |
String cache = CdmUtils.concat(" ", new String[]{citedFamily, citedGenus, citedSpecies, citedSubspecies, rank, lastEpithet}); |
|
503 |
name.setGenusOrUninomial(citedGenus); |
|
504 |
//TODO sperate authors |
|
505 |
if (isBlank(citedSpecies)){ |
|
506 |
name.setSpecificEpithet(lastEpithet); |
|
507 |
}else{ |
|
508 |
name.setSpecificEpithet(citedSpecies); |
|
509 |
if (isBlank(citedSubspecies)){ |
|
510 |
name.setInfraSpecificEpithet(lastEpithet); |
|
511 |
} |
|
512 |
} |
|
513 |
|
|
514 |
//TODO check if cache needs protection |
|
515 |
name.setNameCache(cache, true); |
|
516 |
} |
|
517 |
|
|
518 |
|
|
519 |
|
|
520 |
|
|
521 |
private boolean isInfraSpecies(GlobisImportState state, ResultSet rs, Rank rank) { |
|
522 |
// TODO Auto-generated method stub |
|
523 |
return false; |
|
524 |
} |
|
525 |
|
|
526 |
|
|
527 |
|
|
528 |
|
|
175 | 529 |
private Reference<?> getJournal(GlobisImportState state, ResultSet rs, String refJournal) throws SQLException { |
176 | 530 |
|
177 | 531 |
|
... | ... | |
224 | 578 |
* @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getRelatedObjectsForPartition(java.sql.ResultSet) |
225 | 579 |
*/ |
226 | 580 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs) { |
581 |
String nameSpace; |
|
582 |
Class cdmClass; |
|
583 |
Set<String> idSet; |
|
227 | 584 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>(); |
228 |
return result; //not needed |
|
585 |
try{ |
|
586 |
Set<String> taxonIdSet = new HashSet<String>(); |
|
587 |
Set<String> referenceIdSet = new HashSet<String>(); |
|
588 |
|
|
589 |
while (rs.next()){ |
|
590 |
handleForeignKey(rs, taxonIdSet, "SpecCurrspecID"); |
|
591 |
handleForeignKey(rs, referenceIdSet, "fiSpecRefID"); |
|
592 |
} |
|
593 |
|
|
594 |
//taxon map |
|
595 |
nameSpace = TAXON_NAMESPACE; |
|
596 |
cdmClass = Taxon.class; |
|
597 |
idSet = taxonIdSet; |
|
598 |
Map<String, Taxon> objectMap = (Map<String, Taxon>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace); |
|
599 |
result.put(nameSpace, objectMap); |
|
600 |
|
|
601 |
//reference map |
|
602 |
nameSpace = REFERENCE_NAMESPACE; |
|
603 |
cdmClass = Reference.class; |
|
604 |
idSet = referenceIdSet; |
|
605 |
Map<String, Reference> referenceMap = (Map<String, Reference>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace); |
|
606 |
result.put(nameSpace, referenceMap); |
|
607 |
|
|
608 |
|
|
609 |
} catch (SQLException e) { |
|
610 |
throw new RuntimeException(e); |
|
611 |
} |
|
612 |
return result; |
|
229 | 613 |
} |
230 | 614 |
|
231 | 615 |
/* (non-Javadoc) |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisTransformer.java | ||
---|---|---|
124 | 124 |
}else if (area.equals("Burundi")){return WaterbodyOrCountry.BURUNDIREPUBLICOF(); |
125 | 125 |
}else if (area.equals("Cameroon")){return WaterbodyOrCountry.CAMEROONUNITEDREPUBLICOF(); |
126 | 126 |
|
127 |
// }else if (area.equals("Congo")){return WaterbodyOrCountry.Congo(); |
|
127 |
}else if (area.equals("Congo")){return WaterbodyOrCountry.CONGOPEOPLESREPUBLICOF(); |
|
128 |
}else if (area.equals("Zaire")){return WaterbodyOrCountry.CONGODEMOCRATICREPUBLICOF(); |
|
128 | 129 |
}else if (area.equals("Equatorial Guinea")){return WaterbodyOrCountry.EQUATORIALGUINEAREPUBLICOF(); |
129 | 130 |
}else if (area.equals("Gabon")){return WaterbodyOrCountry.GABONGABONESEREPUBLIC(); |
130 | 131 |
}else if (area.equals("Liberia")){return WaterbodyOrCountry.LIBERIAREPUBLICOF(); |
... | ... | |
148 | 149 |
}else if (area.equals("Nepal")){return WaterbodyOrCountry.NEPALKINGDOMOF(); |
149 | 150 |
}else if (area.equals("Pakistan")){return WaterbodyOrCountry.PAKISTANISLAMICREPUBLICOF(); |
150 | 151 |
}else if (area.equals("Singapore")){return WaterbodyOrCountry.SINGAPOREREPUBLICOF(); |
151 |
|
|
152 |
|
|
153 |
}else if (area.equals("Honduras")){return WaterbodyOrCountry.HONDURASREPUBLICOF(); |
|
154 |
}else if (area.equals("Nicaragua")){return WaterbodyOrCountry.NICARAGUAREPUBLICOF(); |
|
155 |
}else if (area.equals("Trinidad and Tobago")){return WaterbodyOrCountry.TRINIDADANDTOBAGOREPUBLICOF(); |
|
156 |
}else if (area.equals("United States")){return WaterbodyOrCountry.UNITEDSTATESOFAMERICA(); |
|
157 |
}else if (area.equals("Uruguay")){return WaterbodyOrCountry.URUGUAYEASTERNREPUBLICOF(); |
|
158 |
}else if (area.equals("Haiti")){return WaterbodyOrCountry.HAITIREPUBLICOF(); |
|
159 |
}else if (area.equals("North Korea")){return WaterbodyOrCountry.KOREADEMOCRATICPEOPLESREPUBLICOF(); |
|
160 |
}else if (area.equals("South Korea")){return WaterbodyOrCountry.KOREAREPUBLICOF(); |
|
161 |
}else if (area.equals("Taiwan")){return WaterbodyOrCountry.TAIWANPROVINCEOFCHINA(); |
|
162 |
|
|
163 |
}else if (area.equals("Somalia")){return WaterbodyOrCountry.SOMALIASOMALIREPUBLIC(); |
|
164 |
}else if (area.equals("Albania")){return WaterbodyOrCountry.ALBANIAPEOPLESSOCIALISTREPUBLICOF(); |
|
165 |
}else if (area.equals("Algeria")){return WaterbodyOrCountry.ALGERIAPEOPLESDEMOCRATICREPUBLICOF(); |
|
166 |
|
|
167 |
}else if (area.equals("Andorra")){return WaterbodyOrCountry.ANDORRAPRINCIPALITYOF(); |
|
168 |
}else if (area.equals("Austria")){return WaterbodyOrCountry.AUSTRIAREPUBLICOF(); |
|
169 |
}else if (area.equals("Azerbaijan")){return WaterbodyOrCountry.AZERBAIJANREPUBLICOF(); |
|
170 |
}else if (area.equals("Bulgaria")){return WaterbodyOrCountry.BULGARIAPEOPLESREPUBLICOF(); |
|
171 |
// }else if (area.equals("Croatia")){return WaterbodyOrCountry.Croatia(); |
|
172 |
}else if (area.equals("Greece")){return WaterbodyOrCountry.GREECEHELLENICREPUBLIC(); |
|
173 |
}else if (area.equals("Hungary")){return WaterbodyOrCountry.HUNGARYHUNGARIANPEOPLESREPUBLIC(); |
|
174 |
|
|
175 |
}else if (area.equals("Iran")){return WaterbodyOrCountry.IRANISLAMICREPUBLICOF(); |
|
176 |
}else if (area.equals("Iraq")){return WaterbodyOrCountry.IRAQREPUBLICOF(); |
|
177 |
}else if (area.equals("Israel")){return WaterbodyOrCountry.ISRAELSTATEOF(); |
|
178 |
}else if (area.equals("Italy")){return WaterbodyOrCountry.ITALYITALIANREPUBLIC(); |
|
179 |
}else if (area.equals("Kazakhstan")){return WaterbodyOrCountry.KAZAKHSTANREPUBLICOF(); |
|
180 |
}else if (area.equals("Kyrgyzstan")){return WaterbodyOrCountry.KYRGYZREPUBLIC(); |
|
181 |
}else if (area.equals("Lebanon")){return WaterbodyOrCountry.LEBANONLEBANESEREPUBLIC(); |
|
182 |
|
|
183 |
}else if (area.equals("Luxembourg")){return WaterbodyOrCountry.LUXEMBOURGGRANDDUCHYOF(); |
|
184 |
}else if (area.equals("Macedonia")){return WaterbodyOrCountry.MACEDONIATHEFORMERYUGOSLAVREPUBLICOF(); |
|
185 |
}else if (area.equals("Moldova")){return WaterbodyOrCountry.MOLDOVAREPUBLICOF(); |
|
186 |
}else if (area.equals("Morocco")){return WaterbodyOrCountry.MOROCCOKINGDOMOF(); |
|
187 |
}else if (area.equals("Romania")){return WaterbodyOrCountry.ROMANIASOCIALISTREPUBLICOF(); |
|
188 |
}else if (area.equals("Serbia")){return WaterbodyOrCountry.SERBIAANDMONTENEGRO(); |
|
189 |
}else if (area.equals("Slovakia")){return WaterbodyOrCountry.SLOVAKIA(); |
|
190 |
}else if (area.equals("Spain")){return WaterbodyOrCountry.SPAINSPANISHSTATE(); |
|
191 |
|
|
192 |
}else if (area.equals("Switzerland")){return WaterbodyOrCountry.SWITZERLANDSWISSCONFEDERATION(); |
|
193 |
}else if (area.equals("Syria")){return WaterbodyOrCountry.SYRIANARABREPUBLIC(); |
|
194 |
}else if (area.equals("Turkey")){return WaterbodyOrCountry.TURKEYREPUBLICOF(); |
|
195 |
}else if (area.equals("Cambodia")){return WaterbodyOrCountry.CAMBODIAKINGDOMOF(); |
|
196 |
}else if (area.equals("Bangladesh")){return WaterbodyOrCountry.BANGLADESHPEOPLESREPUBLICOF(); |
|
197 |
|
|
198 |
}else if (area.equals("Sri Lanka")){return WaterbodyOrCountry.SRILANKADEMOCRATICSOCIALISTREPUBLICOF(); |
|
199 |
}else if (area.equals("Bahamas")){return WaterbodyOrCountry.BAHAMASCOMMONWEALTHOFTHE(); |
|
200 |
// }else if (area.equals("Western Samoa")){return WaterbodyOrCountry.WESTERNSAMOA(); |
|
201 |
}else if (area.equals("Finland")){return WaterbodyOrCountry.FINLANDREPUBLICOF(); |
|
202 |
}else if (area.equals("Norway")){return WaterbodyOrCountry.NORWAYKINGDOMOF(); |
|
203 |
}else if (area.equals("El Salvador")){return WaterbodyOrCountry.ELSALVADORREPUBLICOF(); |
|
204 |
}else if (area.equals("Cyprus")){return WaterbodyOrCountry.CYPRUSREPUBLICOF(); |
|
205 |
|
|
152 | 206 |
|
153 | 207 |
}else{ |
154 | 208 |
if (unhandledCountries.contains(area)){ |
Also available in: Unified diff
update Globis import