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) |
Also available in: Unified diff
update Globis import