Revision 48014773
Added by Andreas Müller almost 9 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/faunaEuropaea/FaunaEuropaeaTaxonNameImport.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
33 | 33 |
import org.springframework.stereotype.Component; |
34 | 34 |
import org.springframework.transaction.TransactionStatus; |
35 | 35 |
|
36 |
|
|
37 |
|
|
38 |
|
|
39 | 36 |
import eu.etaxonomy.cdm.common.CdmUtils; |
40 | 37 |
import eu.etaxonomy.cdm.io.common.ICdmIO; |
41 | 38 |
import eu.etaxonomy.cdm.io.common.ImportHelper; |
42 | 39 |
import eu.etaxonomy.cdm.io.common.MapWrapper; |
43 | 40 |
import eu.etaxonomy.cdm.io.common.Source; |
44 |
import eu.etaxonomy.cdm.io.pesi.out.PesiExportState; |
|
45 | 41 |
import eu.etaxonomy.cdm.io.pesi.out.PesiTransformer; |
46 | 42 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
47 | 43 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
48 | 44 |
import eu.etaxonomy.cdm.model.common.Extension; |
49 |
import eu.etaxonomy.cdm.model.common.IdentifiableSource; |
|
50 | 45 |
import eu.etaxonomy.cdm.model.common.LSID; |
51 | 46 |
import eu.etaxonomy.cdm.model.common.Marker; |
52 | 47 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
... | ... | |
68 | 63 |
*/ |
69 | 64 |
@Component |
70 | 65 |
public class FaunaEuropaeaTaxonNameImport extends FaunaEuropaeaImportBase { |
71 |
|
|
66 |
|
|
72 | 67 |
public static final String OS_NAMESPACE_TAXON = "Taxon"; |
73 |
|
|
68 |
|
|
74 | 69 |
private static final Logger logger = Logger.getLogger(FaunaEuropaeaTaxonNameImport.class); |
75 | 70 |
|
76 | 71 |
/* Max number of taxa to retrieve (for test purposes) */ |
77 |
private int maxTaxa = 0; |
|
72 |
private final int maxTaxa = 0;
|
|
78 | 73 |
|
79 | 74 |
/* (non-Javadoc) |
80 | 75 |
* @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IImportConfigurator) |
... | ... | |
85 | 80 |
FaunaEuropaeaImportConfigurator fauEuConfig = state.getConfig(); |
86 | 81 |
logger.warn("Checking for Taxa not yet fully implemented"); |
87 | 82 |
// result &= checkTaxonStatus(fauEuConfig); |
88 |
|
|
83 |
|
|
89 | 84 |
return result; |
90 | 85 |
} |
91 |
|
|
86 |
|
|
92 | 87 |
/* (non-Javadoc) |
93 | 88 |
* @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator) |
94 | 89 |
*/ |
95 |
protected boolean isIgnore(FaunaEuropaeaImportState state) { |
|
90 |
@Override |
|
91 |
protected boolean isIgnore(FaunaEuropaeaImportState state) { |
|
96 | 92 |
return ! state.getConfig().isDoTaxa(); |
97 | 93 |
} |
98 | 94 |
|
99 |
/**
|
|
95 |
/** |
|
100 | 96 |
* Import taxa from FauEU DB |
101 | 97 |
*/ |
102 |
protected void doInvoke(FaunaEuropaeaImportState state) { |
|
98 |
@Override |
|
99 |
protected void doInvoke(FaunaEuropaeaImportState state) { |
|
103 | 100 |
if(logger.isInfoEnabled()) { logger.info("Start making taxa..."); } |
104 |
|
|
101 |
|
|
105 | 102 |
processTaxa(state); |
106 | 103 |
logger.info("End making taxa..."); |
107 | 104 |
return; |
... | ... | |
131 | 128 |
|
132 | 129 |
Map<String, MapWrapper<? extends CdmBase>> stores = state.getStores(); |
133 | 130 |
MapWrapper<TeamOrPersonBase> authorStore = (MapWrapper<TeamOrPersonBase>)stores.get(ICdmIO.TEAM_STORE); |
134 |
|
|
131 |
|
|
135 | 132 |
Map<Integer, TaxonBase<?>> taxonMap = null; |
136 | 133 |
Map<Integer, FaunaEuropaeaTaxon> fauEuTaxonMap = null; |
137 | 134 |
/* Store for heterotypic synonyms to be save separately */ |
... | ... | |
142 | 139 |
|
143 | 140 |
Source source = fauEuConfig.getSource(); |
144 | 141 |
int i = 0; |
145 |
|
|
146 |
String selectCount =
|
|
142 |
|
|
143 |
String selectCount = |
|
147 | 144 |
" SELECT count(*) "; |
148 | 145 |
|
149 |
String selectColumns =
|
|
146 |
String selectColumns = |
|
150 | 147 |
" SELECT Parent.TAX_NAME AS P2Name, Parent.TAX_RNK_ID AS P2RankId, " + |
151 | 148 |
" GrandParent.TAX_ID AS GP3Id, GrandParent.TAX_NAME AS GP3Name, GrandParent.TAX_RNK_ID AS GP3RankId, " + |
152 | 149 |
" GreatGrandParent.TAX_ID AS GGP4Id, GreatGrandParent.TAX_NAME AS GGP4Name, GreatGrandParent.TAX_RNK_ID AS GGP4RankId, " + |
... | ... | |
156 | 153 |
" expertUsers.usr_id AS expertUserId, expertUsers.usr_title AS ExpertUsrTitle, expertUsers.usr_firstname AS ExpertUsrFirstname, expertUsers.usr_lastname AS ExpertUsrLastname," + |
157 | 154 |
" speciesExpertUsers.usr_id AS speciesExpertUserId, speciesExpertUsers.usr_title AS SpeciesUsrTitle, speciesExpertUsers.usr_firstname AS SpeciesUsrFirstname, speciesExpertUsers.usr_lastname AS SpeciesUsrLastname," + |
158 | 155 |
" Taxon.*, rank.*, author.* "; |
159 |
|
|
160 |
String fromClause =
|
|
156 |
|
|
157 |
String fromClause = |
|
161 | 158 |
" FROM Taxon LEFT OUTER JOIN " + |
162 | 159 |
" Taxon AS Parent ON Taxon.TAX_TAX_IDPARENT = Parent.TAX_ID LEFT OUTER JOIN " + |
163 | 160 |
" Taxon AS GrandParent ON Parent.TAX_TAX_IDPARENT = GrandParent.TAX_ID LEFT OUTER JOIN " + |
... | ... | |
170 | 167 |
" users AS speciesExpertUsers ON Taxon.TAX_USR_IDSP = speciesExpertUsers.usr_id LEFT OUTER JOIN " + |
171 | 168 |
" rank ON Taxon.TAX_RNK_ID = rank.rnk_id "; |
172 | 169 |
|
173 |
String countQuery =
|
|
170 |
String countQuery = |
|
174 | 171 |
selectCount + fromClause; |
175 | 172 |
|
176 |
String selectQuery =
|
|
173 |
String selectQuery = |
|
177 | 174 |
selectColumns + fromClause; |
178 |
|
|
175 |
|
|
179 | 176 |
|
180 | 177 |
try { |
181 | 178 |
|
182 | 179 |
ResultSet rs = source.getResultSet(countQuery); |
183 | 180 |
rs.next(); |
184 | 181 |
int count = rs.getInt(1); |
185 |
|
|
182 |
|
|
186 | 183 |
rs = source.getResultSet(selectQuery); |
187 | 184 |
|
188 | 185 |
if (logger.isInfoEnabled()) { |
... | ... | |
190 | 187 |
logger.info("Count Query: " + countQuery); |
191 | 188 |
logger.info("Select Query: " + selectQuery); |
192 | 189 |
} |
193 |
|
|
190 |
|
|
194 | 191 |
while (rs.next()) { |
195 | 192 |
|
196 | 193 |
if ((i++ % limit) == 0) { |
197 |
|
|
194 |
|
|
198 | 195 |
txStatus = startTransaction(); |
199 | 196 |
taxonMap = new HashMap<Integer, TaxonBase<?>>(limit); |
200 | 197 |
fauEuTaxonMap = new HashMap<Integer, FaunaEuropaeaTaxon>(limit); |
201 | 198 |
synonymSet = new HashSet<Synonym>(); |
202 |
|
|
199 |
|
|
203 | 200 |
if(logger.isInfoEnabled()) { |
204 |
logger.info("i = " + i + " - Transaction started");
|
|
201 |
logger.info("i = " + i + " - Transaction started"); |
|
205 | 202 |
} |
206 | 203 |
} |
207 | 204 |
|
... | ... | |
227 | 224 |
int originalGenusId = rs.getInt("TAX_TAX_IDGENUS"); |
228 | 225 |
int autId = rs.getInt("TAX_AUT_ID"); |
229 | 226 |
int status = rs.getInt("TAX_VALID"); |
230 |
|
|
227 |
|
|
231 | 228 |
|
232 | 229 |
// user related |
233 | 230 |
String expertUsrTitle = rs.getString("ExpertUsrTitle"); |
... | ... | |
250 | 247 |
if ((expertUsrTitle != null || expertUsrFirstname != null) && expertUsrLastname != null) { |
251 | 248 |
expertName += " " + expertUsrLastname; |
252 | 249 |
} |
253 |
|
|
250 |
|
|
254 | 251 |
String speciesExpertName = speciesUsrTitle == null ? "" : speciesUsrTitle + "."; |
255 | 252 |
if (speciesUsrTitle != null) { |
256 | 253 |
speciesExpertName = speciesUsrTitle; |
... | ... | |
262 | 259 |
if ((speciesUsrTitle != null || speciesUsrFirstname != null) && speciesUsrLastname != null) { |
263 | 260 |
speciesExpertName += " " + speciesUsrLastname; |
264 | 261 |
} |
265 |
|
|
262 |
|
|
266 | 263 |
// date related |
267 | 264 |
Timestamp createdTimeStamp = rs.getTimestamp("TAX_CREATEDAT"); |
268 | 265 |
Timestamp modifiedTimeStamp = rs.getTimestamp("TAX_MODIFIEDAT"); |
... | ... | |
272 | 269 |
DateTime modified = isCreated ? null : new DateTime(modifiedTimeStamp); |
273 | 270 |
DateTime lastActionDate = isCreated ? created : modified; |
274 | 271 |
String lastActionDateStr = isCreated ? createdTimeStamp.toString() : modifiedTimeStamp.toString(); |
275 |
|
|
276 |
|
|
272 |
|
|
273 |
|
|
277 | 274 |
// note related |
278 | 275 |
String taxComment = rs.getString("TAX_TAXCOMMENT"); |
279 | 276 |
String fauComment = rs.getString("TAX_FAUCOMMENT"); |
... | ... | |
284 | 281 |
if (year != null && year.intValue() == 0) { |
285 | 282 |
year = null; |
286 | 283 |
} |
287 |
|
|
284 |
|
|
288 | 285 |
//int familyId = rs.getInt("TAX_TAX_IDFAMILY"); |
289 | 286 |
|
290 | 287 |
Rank rank = null; |
... | ... | |
302 | 299 |
fauEuTaxon.setId(taxonId); |
303 | 300 |
fauEuTaxon.setRankId(rankId); |
304 | 301 |
fauEuTaxon.setLocalName(localName); |
305 |
|
|
302 |
|
|
306 | 303 |
fauEuTaxon.setParentId(parentId); |
307 | 304 |
fauEuTaxon.setParentRankId(parentRankId); |
308 | 305 |
fauEuTaxon.setParentName(parentName); |
309 |
|
|
306 |
|
|
310 | 307 |
fauEuTaxon.setGrandParentId(grandParentId); |
311 | 308 |
fauEuTaxon.setGrandParentRankId(grandParentRankId); |
312 | 309 |
fauEuTaxon.setGrandParentName(grandParentName); |
313 |
|
|
310 |
|
|
314 | 311 |
fauEuTaxon.setGreatGrandParentId(greatGrandParentId); |
315 | 312 |
fauEuTaxon.setGreatGrandParentRankId(greatGrandParentRankId); |
316 | 313 |
fauEuTaxon.setGreatGrandParentName(greatGrandParentName); |
317 |
|
|
314 |
|
|
318 | 315 |
fauEuTaxon.setGreatGreatGrandParentId(greatGreatGrandParentId); |
319 | 316 |
fauEuTaxon.setGreatGreatGrandParentRankId(greatGreatGrandParentRankId); |
320 | 317 |
fauEuTaxon.setGreatGreatGrandParentName(greatGreatGrandParentName); |
321 |
|
|
318 |
|
|
322 | 319 |
fauEuTaxon.setGreatGreatGreatGrandParentRankId(greatGreatGreatGrandParentRankId); |
323 | 320 |
fauEuTaxon.setGreatGreatGreatGrandParentName(greatGreatGreatGrandParentName); |
324 |
|
|
321 |
|
|
325 | 322 |
fauEuTaxon.setOriginalGenusId(originalGenusId); |
326 | 323 |
fauEuTaxon.setYear(year); |
327 | 324 |
fauEuTaxon.setOriginalGenusName(originalGenusName); |
... | ... | |
354 | 351 |
|
355 | 352 |
ZoologicalName zooName = ZoologicalName.NewInstance(rank); |
356 | 353 |
TeamOrPersonBase<?> author = authorStore.get(autId); |
357 |
|
|
358 |
zooName.setCombinationAuthorTeam(author);
|
|
354 |
|
|
355 |
zooName.setCombinationAuthorship(author);
|
|
359 | 356 |
zooName.setPublicationYear(year); |
360 |
|
|
361 |
|
|
357 |
|
|
358 |
|
|
362 | 359 |
// Add Date extensions to this zooName |
363 | 360 |
Extension.NewInstance(zooName, lastAction, getExtensionType(state, PesiTransformer.lastActionUuid, "LastAction", "LastAction", "LA")); |
364 | 361 |
// Extension.NewInstance(zooName, lastActionDateStr, getExtensionType(state, PesiTransformer.lastActionDateUuid, "LastActionDate", "LastActionDate", "LAD")); |
365 | 362 |
zooName.setCreated(created); |
366 | 363 |
zooName.setUpdated(modified); |
367 |
|
|
364 |
|
|
368 | 365 |
/* Add Note extensions to this zooName |
369 | 366 |
Extension.NewInstance(zooName, taxComment, getExtensionType(PesiTransformer.taxCommentUuid, "TaxComment", "TaxComment", "TC")); |
370 | 367 |
Extension.NewInstance(zooName, fauComment, getExtensionType(PesiTransformer.fauCommentUuid, "FauComment", "FauComment", "FC")); |
... | ... | |
377 | 374 |
try { |
378 | 375 |
// check for occurrence of the auct string in auctName |
379 | 376 |
String auctRegEx = "\\bauct\\b\\.?"; // The word "auct" with or without "." |
380 |
|
|
377 |
|
|
381 | 378 |
String auctWithNecRegEx = "\\bauct\\b\\.?.*\\bnec\\b\\.?.*"; |
382 | 379 |
String necAuctRegEx = ".*\\bnec\\b\\.?.*\\bauct\\b\\.?"; |
383 |
|
|
380 |
|
|
384 | 381 |
boolean auctNecFound = expressionMatches(auctWithNecRegEx, autName); |
385 | 382 |
boolean necAuctFound = expressionMatches(necAuctRegEx, autName); |
386 | 383 |
boolean auctWordFound = expressionMatches(auctRegEx, autName); |
387 |
|
|
388 |
|
|
389 |
|
|
384 |
|
|
385 |
|
|
386 |
|
|
390 | 387 |
if (status == T_STATUS_ACCEPTED ) { |
391 |
|
|
388 |
|
|
392 | 389 |
taxon = Taxon.NewInstance(zooName, sourceReference); |
393 | 390 |
if (logger.isDebugEnabled()) { |
394 | 391 |
logger.debug("Taxon created (" + taxonId + ")"); |
395 | 392 |
} |
396 |
|
|
397 |
|
|
393 |
|
|
394 |
|
|
398 | 395 |
taxonBase = taxon; |
399 | 396 |
} else if ((status == T_STATUS_NOT_ACCEPTED) && ! auctWordFound) { // synonym |
400 | 397 |
synonym = Synonym.NewInstance(zooName, sourceReference); |
... | ... | |
411 | 408 |
logger.info("temporary named name created ("+ taxonId + ") " + zooName.getTitleCache()+ zooName.getStatus().toString()); |
412 | 409 |
}else if (status == T_STATUS_NOT_ACCEPTED && auctWordFound){ |
413 | 410 |
// misapplied name |
414 |
zooName.setCombinationAuthorTeam(null);
|
|
411 |
zooName.setCombinationAuthorship(null);
|
|
415 | 412 |
zooName.setPublicationYear(null); |
416 |
|
|
413 |
|
|
417 | 414 |
taxon = Taxon.NewInstance(zooName, auctReference); |
418 | 415 |
taxonBase = taxon; |
419 | 416 |
//logger.info("Misapplied name created ("+ taxonId + ") " + autName); |
... | ... | |
421 | 418 |
logger.debug("Misapplied name created (" + taxonId + ")"); |
422 | 419 |
} |
423 | 420 |
}else{ |
424 |
|
|
421 |
|
|
425 | 422 |
logger.warn("Unknown taxon status " + status + ". Taxon (" + taxonId + ") ignored."); |
426 | 423 |
continue; |
427 | 424 |
} |
... | ... | |
430 | 427 |
taxonBase.setLsid(new LSID( "urn:lsid:faunaeur.org:taxname:"+taxonId)); |
431 | 428 |
taxonBase.setCreated(created); |
432 | 429 |
taxonBase.setUpdated(modified); |
433 |
|
|
430 |
|
|
434 | 431 |
// Add Note extensions to this taxon |
435 |
|
|
432 |
|
|
436 | 433 |
if (!StringUtils.isBlank(taxComment)){ |
437 | 434 |
Extension.NewInstance(taxonBase, taxComment, getExtensionType(state, PesiTransformer.taxCommentUuid, "TaxComment", "TaxComment", "TC")); |
438 | 435 |
} |
... | ... | |
445 | 442 |
// Add UserId extensions to this zooName |
446 | 443 |
//Extension.NewInstance(zooName, expertUserId, getExtensionType(state, PesiTransformer.expertUserIdUuid, "expertUserId", "expertUserId", "EUID")); |
447 | 444 |
//Extension.NewInstance(zooName, speciesExpertUserId, getExtensionType(state, PesiTransformer.speciesExpertUserIdUuid, "speciesExpertUserId", "speciesExpertUserId", "SEUID")); |
448 |
|
|
445 |
|
|
449 | 446 |
// Add Expert extensions to this zooName |
450 | 447 |
Extension.NewInstance(taxonBase, expertName, getExtensionType(state, PesiTransformer.expertNameUuid, "ExpertName", "ExpertName", "EN")); |
451 | 448 |
Extension.NewInstance(taxonBase, speciesExpertName, getExtensionType(state, PesiTransformer.speciesExpertNameUuid, "SpeciesExpertName", "SpeciesExpertName", "SEN")); |
452 | 449 |
|
453 |
|
|
450 |
|
|
454 | 451 |
ImportHelper.setOriginalSource(taxonBase, fauEuConfig.getSourceReference(), taxonId, OS_NAMESPACE_TAXON); |
455 | 452 |
ImportHelper.setOriginalSource(zooName, fauEuConfig.getSourceReference(), taxonId, "TaxonName"); |
456 | 453 |
|
457 | 454 |
if (!taxonMap.containsKey(taxonId)) { |
458 |
|
|
455 |
|
|
459 | 456 |
taxonMap.put(taxonId, taxonBase); |
460 | 457 |
fauEuTaxonMap.put(taxonId, fauEuTaxon); |
461 |
|
|
458 |
|
|
462 | 459 |
} else { |
463 |
logger.warn("Not imported taxon base with duplicated TAX_ID (" + taxonId +
|
|
460 |
logger.warn("Not imported taxon base with duplicated TAX_ID (" + taxonId + |
|
464 | 461 |
") " + localName); |
465 | 462 |
} |
466 | 463 |
} catch (Exception e) { |
467 |
logger.warn("An exception occurred when creating taxon base with id " + taxonId +
|
|
464 |
logger.warn("An exception occurred when creating taxon base with id " + taxonId + |
|
468 | 465 |
". Taxon base could not be saved."); |
469 | 466 |
e.printStackTrace(); |
470 | 467 |
} |
471 | 468 |
|
472 |
if (((i % limit) == 0 && i != 1 )) {
|
|
469 |
if (((i % limit) == 0 && i != 1 )) { |
|
473 | 470 |
|
474 | 471 |
commitTaxa(state, txStatus, taxonMap, fauEuTaxonMap, |
475 | 472 |
synonymSet); |
476 |
|
|
473 |
|
|
477 | 474 |
taxonMap = null; |
478 | 475 |
synonymSet = null; |
479 | 476 |
fauEuTaxonMap = null; |
480 |
|
|
481 |
|
|
477 |
|
|
478 |
|
|
482 | 479 |
if(logger.isInfoEnabled()) { |
483 |
logger.info("i = " + i + " - Transaction committed");
|
|
480 |
logger.info("i = " + i + " - Transaction committed"); |
|
484 | 481 |
} |
485 | 482 |
} |
486 | 483 |
|
... | ... | |
510 | 507 |
processTaxaSecondPass(state, taxonMap, fauEuTaxonMap, synonymSet); |
511 | 508 |
if(logger.isDebugEnabled()) { logger.debug("Saving taxa ... " + taxonMap.size()); } |
512 | 509 |
getTaxonService().save((Collection)taxonMap.values()); |
513 |
|
|
510 |
|
|
514 | 511 |
commitTransaction(txStatus); |
515 | 512 |
} |
516 | 513 |
|
517 |
|
|
518 |
|
|
514 |
|
|
515 |
|
|
519 | 516 |
/** |
520 | 517 |
* Processes taxa from complete taxon store |
521 | 518 |
*/ |
... | ... | |
524 | 521 |
if(logger.isDebugEnabled()) { logger.debug("Processing taxa second pass..."); } |
525 | 522 |
|
526 | 523 |
FaunaEuropaeaImportConfigurator fauEuConfig = state.getConfig(); |
527 |
|
|
524 |
|
|
528 | 525 |
for (int id : taxonMap.keySet()) |
529 | 526 |
{ |
530 | 527 |
if (logger.isDebugEnabled()) { logger.debug("Taxon # " + id); } |
531 |
|
|
528 |
|
|
532 | 529 |
TaxonBase<?> taxonBase = taxonMap.get(id); |
533 | 530 |
TaxonNameBase<?,?> taxonName = taxonBase.getName(); |
534 | 531 |
FaunaEuropaeaTaxon fauEuTaxon = fauEuTaxonMap.get(id); |
... | ... | |
537 | 534 |
if (!fauEuTaxon.isValid() ){ |
538 | 535 |
useOriginalGenus = true; |
539 | 536 |
} |
540 |
|
|
541 |
String nameString =
|
|
537 |
|
|
538 |
String nameString = |
|
542 | 539 |
buildTaxonName(fauEuTaxon, taxonBase, taxonName, useOriginalGenus, fauEuConfig); |
543 |
|
|
540 |
|
|
544 | 541 |
if (taxonBase instanceof Synonym){ |
545 | 542 |
logger.debug("Name of Synonym: " + nameString); |
546 | 543 |
} |
547 |
|
|
548 |
if (fauEuConfig.isDoBasionyms()
|
|
544 |
|
|
545 |
if (fauEuConfig.isDoBasionyms() |
|
549 | 546 |
&& fauEuTaxon.getRankId() > R_SUBGENUS |
550 | 547 |
&& (fauEuTaxon.getOriginalGenusId() != 0)) { |
551 |
|
|
548 |
|
|
552 | 549 |
Integer originalGenusId = fauEuTaxon.getOriginalGenusId(); |
553 | 550 |
Integer actualGenusId = getActualGenusId(fauEuTaxon); |
554 |
|
|
551 |
|
|
555 | 552 |
if (logger.isDebugEnabled()) { |
556 | 553 |
logger.debug("actual genus id = " + actualGenusId + ", original genus id = " + originalGenusId); |
557 | 554 |
} |
558 |
|
|
555 |
|
|
559 | 556 |
if (actualGenusId.intValue() != originalGenusId.intValue() && taxonBase.isInstanceOf(Taxon.class)) { |
560 | 557 |
createBasionym(fauEuTaxon, taxonBase, taxonName, fauEuConfig, synonymSet, state); |
561 | 558 |
} else if (fauEuTaxon.isParenthesis()) { |
562 |
//the authorteam should be set in parenthesis because there should be a basionym, but we do not know it?
|
|
559 |
//the Authorship should be set in parenthesis because there should be a basionym, but we do not know it?
|
|
563 | 560 |
ZoologicalName zooName = taxonName.deproxy(taxonName, ZoologicalName.class); |
564 |
zooName.setBasionymAuthorTeam(zooName.getCombinationAuthorTeam());
|
|
565 |
zooName.setCombinationAuthorTeam(null);
|
|
561 |
zooName.setBasionymAuthorship(zooName.getCombinationAuthorship());
|
|
562 |
zooName.setCombinationAuthorship(null);
|
|
566 | 563 |
zooName.setOriginalPublicationYear(zooName.getPublicationYear()); |
567 | 564 |
zooName.setPublicationYear(null); |
568 | 565 |
} |
569 |
|
|
566 |
|
|
570 | 567 |
} |
571 | 568 |
} |
572 |
return;
|
|
569 |
return; |
|
573 | 570 |
} |
574 | 571 |
|
575 |
|
|
576 |
private void createBasionym(FaunaEuropaeaTaxon fauEuTaxon, TaxonBase<?> taxonBase,
|
|
572 |
|
|
573 |
private void createBasionym(FaunaEuropaeaTaxon fauEuTaxon, TaxonBase<?> taxonBase, |
|
577 | 574 |
TaxonNameBase<?,?>taxonName, FaunaEuropaeaImportConfigurator fauEuConfig, |
578 | 575 |
Set<Synonym> synonymSet, FaunaEuropaeaImportState state) { |
579 | 576 |
|
580 | 577 |
try { |
581 | 578 |
ZoologicalName zooName = taxonName.deproxy(taxonName, ZoologicalName.class); |
582 |
|
|
579 |
|
|
583 | 580 |
// create basionym |
584 | 581 |
ZoologicalName basionym = ZoologicalName.NewInstance(taxonName.getRank()); |
585 |
basionym.setCombinationAuthorTeam(zooName.getCombinationAuthorTeam());
|
|
582 |
basionym.setCombinationAuthorship(zooName.getCombinationAuthorship());
|
|
586 | 583 |
basionym.setPublicationYear(zooName.getPublicationYear()); |
587 | 584 |
|
588 |
|
|
585 |
|
|
589 | 586 |
zooName.addBasionym(basionym, fauEuConfig.getSourceReference(), null, null); |
590 | 587 |
//TODO:this is a workaround for fauna europaea, this should be fixed in cdm model. this should be not a basionym but an orthographic variant (original spelling) |
591 | 588 |
if (fauEuTaxon.isParenthesis()){ |
592 | 589 |
zooName.setOriginalPublicationYear(zooName.getPublicationYear()); |
593 |
zooName.setBasionymAuthorTeam(zooName.getCombinationAuthorTeam());
|
|
594 |
zooName.setCombinationAuthorTeam(null);
|
|
590 |
zooName.setBasionymAuthorship(zooName.getCombinationAuthorship());
|
|
591 |
zooName.setCombinationAuthorship(null);
|
|
595 | 592 |
} else{ |
596 |
zooName.setBasionymAuthorTeam(null);
|
|
593 |
zooName.setBasionymAuthorship(null);
|
|
597 | 594 |
zooName.setAuthorshipCache(zooName.getAuthorshipCache(), true); |
598 |
zooName.setCombinationAuthorTeam(null);
|
|
595 |
zooName.setCombinationAuthorship(null);
|
|
599 | 596 |
} |
600 | 597 |
zooName.setPublicationYear(null); |
601 | 598 |
zooName.setTitleCache(null); // This should (re)generate the titleCache automatically |
... | ... | |
607 | 604 |
Synonym synonym = Synonym.NewInstance(basionym, fauEuConfig.getSourceReference()); |
608 | 605 |
MarkerType markerType =getMarkerType(state, PesiTransformer.uuidMarkerGuidIsMissing, "Uuid is missing", "Uuid is missing", null); |
609 | 606 |
synonym.addMarker(Marker.NewInstance(markerType, true)); |
610 |
|
|
607 |
|
|
611 | 608 |
if (fauEuTaxon.isValid()) { // Taxon |
612 | 609 |
|
613 | 610 |
// homotypic synonym |
614 | 611 |
Taxon taxon = taxonBase.deproxy(taxonBase, Taxon.class); |
615 | 612 |
taxon.addHomotypicSynonym(synonym, fauEuConfig.getSourceReference(), null); |
616 |
|
|
613 |
|
|
617 | 614 |
if (logger.isDebugEnabled()) { |
618 | 615 |
logger.debug("Homotypic synonym created (" + fauEuTaxon.getId() + ")"); |
619 | 616 |
} |
620 | 617 |
|
621 | 618 |
} else { // Synonym |
622 |
|
|
619 |
|
|
623 | 620 |
// heterotypic synonym |
624 | 621 |
// synonym relationship to the accepted taxon is created later |
625 | 622 |
synonymSet.add(synonym); |
626 |
|
|
623 |
|
|
627 | 624 |
if (logger.isDebugEnabled()) { |
628 | 625 |
logger.debug("Heterotypic synonym stored (" + fauEuTaxon.getId() + ")"); |
629 | 626 |
} |
630 | 627 |
} |
631 |
|
|
632 |
|
|
628 |
|
|
629 |
|
|
633 | 630 |
buildTaxonName(fauEuTaxon, synonym, basionym, true, fauEuConfig); |
634 |
|
|
631 |
|
|
635 | 632 |
//originalSources zufügen |
636 |
|
|
633 |
|
|
637 | 634 |
ImportHelper.setOriginalSource(synonym, fauEuConfig.getSourceReference(), fauEuTaxon.getId(), PesiTransformer.STR_NAMESPACE_NOMINAL_TAXON); |
638 | 635 |
ImportHelper.setOriginalSource(synonym.getName(), fauEuConfig.getSourceReference(), fauEuTaxon.getId(), PesiTransformer.STR_NAMESPACE_NOMINAL_TAXON); |
639 | 636 |
|
... | ... | |
641 | 638 |
// String originalGenusIdString = String.valueOf(fauEuTaxon.getId()); |
642 | 639 |
// IdentifiableSource basionymSource = IdentifiableSource.NewInstance(originalGenusIdString, "originalGenusId"); |
643 | 640 |
// basionym.addSource(basionymSource); |
644 |
//
|
|
641 |
// |
|
645 | 642 |
// // add original database reference |
646 | 643 |
// ImportHelper.setOriginalSource(basionym, fauEuConfig.getSourceReference(), fauEuTaxon.getId(), "TaxonName"); |
647 |
|
|
648 |
|
|
644 |
|
|
645 |
|
|
649 | 646 |
} catch (Exception e) { |
650 | 647 |
logger.warn("Exception occurred when creating basionym for " + fauEuTaxon.getId()); |
651 | 648 |
e.printStackTrace(); |
652 | 649 |
} |
653 |
|
|
654 |
|
|
650 |
|
|
651 |
|
|
655 | 652 |
return; |
656 | 653 |
} |
657 |
|
|
658 |
|
|
654 |
|
|
655 |
|
|
659 | 656 |
/* Build name title cache */ |
660 | 657 |
private String buildNameTitleCache(String nameString, boolean useOriginalGenus, FaunaEuropaeaTaxon fauEuTaxon) { |
661 |
|
|
658 |
|
|
662 | 659 |
StringBuilder titleCacheStringBuilder = new StringBuilder(nameString); |
663 | 660 |
Integer year = fauEuTaxon.getYear(); |
664 | 661 |
if (year != null) { // TODO: Ignore authors like xp, xf, etc? |
... | ... | |
679 | 676 |
|
680 | 677 |
/* Build taxon title cache */ |
681 | 678 |
private String buildTaxonTitleCache(String nameCache, Reference<?> reference) { |
682 |
|
|
679 |
|
|
683 | 680 |
StringBuilder titleCacheStringBuilder = new StringBuilder(nameCache); |
684 | 681 |
titleCacheStringBuilder.append(" sec. "); |
685 | 682 |
titleCacheStringBuilder.append(reference.getTitleCache()); |
686 | 683 |
return titleCacheStringBuilder.toString(); |
687 | 684 |
} |
688 | 685 |
|
689 |
|
|
686 |
|
|
690 | 687 |
/* Build name full title cache */ |
691 | 688 |
private String buildNameFullTitleCache(String titleCache, FaunaEuropaeaImportConfigurator fauEuConfig) { |
692 |
|
|
689 |
|
|
693 | 690 |
StringBuilder fullTitleCacheStringBuilder = new StringBuilder(titleCache); |
694 | 691 |
fullTitleCacheStringBuilder.append(" "); |
695 | 692 |
fullTitleCacheStringBuilder.append(fauEuConfig.getSourceReferenceTitle()); |
696 | 693 |
return fullTitleCacheStringBuilder.toString(); |
697 | 694 |
} |
698 |
|
|
699 |
|
|
700 |
private String genusPart(StringBuilder originalGenusName, boolean useOriginalGenus,
|
|
695 |
|
|
696 |
|
|
697 |
private String genusPart(StringBuilder originalGenusName, boolean useOriginalGenus, |
|
701 | 698 |
StringBuilder genusOrUninomial) { |
702 | 699 |
|
703 | 700 |
StringBuilder stringBuilder = new StringBuilder(); |
704 |
|
|
701 |
|
|
705 | 702 |
if(useOriginalGenus) { |
706 | 703 |
stringBuilder.append(originalGenusName); |
707 | 704 |
genusOrUninomial.delete(0, genusOrUninomial.length()); |
... | ... | |
714 | 711 |
return stringBuilder.toString(); |
715 | 712 |
} |
716 | 713 |
|
717 |
|
|
718 |
private String genusSubGenusPart(StringBuilder originalGenusName, boolean useOriginalGenus,
|
|
714 |
|
|
715 |
private String genusSubGenusPart(StringBuilder originalGenusName, boolean useOriginalGenus, |
|
719 | 716 |
StringBuilder genusOrUninomial, |
720 | 717 |
StringBuilder infraGenericEpithet, |
721 | 718 |
FaunaEuropaeaTaxon fauEuTaxon) { |
722 | 719 |
|
723 | 720 |
StringBuilder stringBuilder = new StringBuilder(); |
724 |
|
|
721 |
|
|
725 | 722 |
stringBuilder.append(genusPart(originalGenusName, useOriginalGenus, genusOrUninomial)); |
726 | 723 |
|
727 | 724 |
// The infraGenericEpithet is set to empty only if the original genus should be used and |
... | ... | |
730 | 727 |
// InfraGenericEpithets of accepted taxa are not touched at all. |
731 | 728 |
Integer originalGenusId = fauEuTaxon.getOriginalGenusId(); |
732 | 729 |
Integer actualGenusId = getActualGenusId(fauEuTaxon); |
733 |
if (useOriginalGenus &&
|
|
734 |
originalGenusId.intValue() != actualGenusId.intValue() &&
|
|
730 |
if (useOriginalGenus && |
|
731 |
originalGenusId.intValue() != actualGenusId.intValue() && |
|
735 | 732 |
originalGenusId.intValue() > 0 && |
736 | 733 |
actualGenusId.intValue() > 0) { |
737 | 734 |
infraGenericEpithet.delete(0, infraGenericEpithet.length()); |
... | ... | |
743 | 740 |
stringBuilder.append(infraGenericEpithet); |
744 | 741 |
stringBuilder.append(")"); |
745 | 742 |
stringBuilder.append(" "); |
746 |
|
|
743 |
|
|
747 | 744 |
return stringBuilder.toString(); |
748 | 745 |
} |
749 | 746 |
|
... | ... | |
756 | 753 |
ranks.put(fauEuTaxon.getGreatGrandParentRankId(), fauEuTaxon.getGreatGrandParentId()); |
757 | 754 |
ranks.put(fauEuTaxon.getGreatGreatGrandParentRankId(), fauEuTaxon.getGreatGreatGrandParentId()); |
758 | 755 |
ranks.put(fauEuTaxon.getGreatGreatGreatGrandParentRankId(), fauEuTaxon.getGreatGreatGreatGrandParentId()); |
759 |
|
|
756 |
|
|
760 | 757 |
actualGenusId = ranks.get(R_GENUS); |
761 | 758 |
|
762 | 759 |
return actualGenusId; |
763 | 760 |
} |
764 |
|
|
765 |
|
|
761 |
|
|
762 |
|
|
766 | 763 |
/** Build species and subspecies names */ |
767 |
private String buildLowerTaxonName(StringBuilder originalGenus, boolean useOriginalGenus,
|
|
768 |
StringBuilder genusOrUninomial, StringBuilder infraGenericEpithet,
|
|
764 |
private String buildLowerTaxonName(StringBuilder originalGenus, boolean useOriginalGenus, |
|
765 |
StringBuilder genusOrUninomial, StringBuilder infraGenericEpithet, |
|
769 | 766 |
StringBuilder specificEpithet, StringBuilder infraSpecificEpithet, |
770 | 767 |
FaunaEuropaeaTaxon fauEuTaxon) { |
771 |
|
|
768 |
|
|
772 | 769 |
// species or subspecies name |
773 | 770 |
String localName = fauEuTaxon.getLocalName(); |
774 | 771 |
int taxonId = fauEuTaxon.getId(); |
... | ... | |
783 | 780 |
} |
784 | 781 |
return nameCacheStringBuilder.toString(); |
785 | 782 |
} |
786 |
|
|
783 |
|
|
787 | 784 |
String parentName = fauEuTaxon.getParentName(); |
788 | 785 |
String grandParentName = fauEuTaxon.getGrandParentName(); |
789 | 786 |
String greatGrandParentName = fauEuTaxon.getGreatGrandParentName(); |
... | ... | |
794 | 791 |
// int grandParentId = fauEuTaxon.getGrandParentId(); |
795 | 792 |
// int greatGrandParentId = grandParent.getParentId(); |
796 | 793 |
|
797 |
|
|
794 |
|
|
798 | 795 |
if (fauEuTaxon.isValid()) { // Taxon |
799 |
|
|
796 |
|
|
800 | 797 |
if (rank == R_SPECIES) { |
801 | 798 |
|
802 | 799 |
if(parentRankId == R_SUBGENUS) { |
803 | 800 |
//differ between isParanthesis= true and false |
804 |
String genusSubGenusPart = genusSubGenusPart(originalGenus, useOriginalGenus,
|
|
805 |
genusOrUninomial.append(grandParentName),
|
|
801 |
String genusSubGenusPart = genusSubGenusPart(originalGenus, useOriginalGenus, |
|
802 |
genusOrUninomial.append(grandParentName), |
|
806 | 803 |
infraGenericEpithet.append(parentName), |
807 | 804 |
fauEuTaxon); |
808 | 805 |
nameCacheStringBuilder.append(genusSubGenusPart); |
809 |
|
|
806 |
|
|
810 | 807 |
|
811 | 808 |
} else if(parentRankId == R_GENUS) { |
812 | 809 |
|
813 |
String genusPart = genusPart(originalGenus, useOriginalGenus,
|
|
810 |
String genusPart = genusPart(originalGenus, useOriginalGenus, |
|
814 | 811 |
genusOrUninomial.append(parentName)); |
815 | 812 |
nameCacheStringBuilder.append(genusPart); |
816 | 813 |
} |
... | ... | |
821 | 818 |
|
822 | 819 |
if(grandParentRankId == R_SUBGENUS) { |
823 | 820 |
|
824 |
String genusSubGenusPart = genusSubGenusPart(originalGenus, useOriginalGenus,
|
|
825 |
genusOrUninomial.append(greatGrandParentName),
|
|
821 |
String genusSubGenusPart = genusSubGenusPart(originalGenus, useOriginalGenus, |
|
822 |
genusOrUninomial.append(greatGrandParentName), |
|
826 | 823 |
infraGenericEpithet.append(grandParentName), |
827 | 824 |
fauEuTaxon); |
828 | 825 |
nameCacheStringBuilder.append(genusSubGenusPart); |
829 | 826 |
|
830 | 827 |
} else if (grandParentRankId == R_GENUS) { |
831 | 828 |
|
832 |
String genusPart = genusPart(originalGenus, useOriginalGenus,
|
|
829 |
String genusPart = genusPart(originalGenus, useOriginalGenus, |
|
833 | 830 |
genusOrUninomial.append(grandParentName)); |
834 | 831 |
nameCacheStringBuilder.append(genusPart); |
835 | 832 |
|
... | ... | |
841 | 838 |
infraSpecificEpithet.append(localName); |
842 | 839 |
} |
843 | 840 |
} else { // Synonym or misapplied name |
844 |
|
|
841 |
|
|
845 | 842 |
if (rank == R_SPECIES) { |
846 | 843 |
|
847 | 844 |
if(grandParentRankId == R_SUBGENUS) { |
848 |
|
|
849 |
String genusSubGenusPart = genusSubGenusPart(originalGenus, useOriginalGenus,
|
|
850 |
genusOrUninomial.append(greatGrandParentName),
|
|
845 |
|
|
846 |
String genusSubGenusPart = genusSubGenusPart(originalGenus, useOriginalGenus, |
|
847 |
genusOrUninomial.append(greatGrandParentName), |
|
851 | 848 |
infraGenericEpithet.append(grandParentName), |
852 | 849 |
fauEuTaxon); |
853 | 850 |
nameCacheStringBuilder.append(genusSubGenusPart); |
854 | 851 |
|
855 | 852 |
} else if (grandParentRankId == R_GENUS) { |
856 |
|
|
857 |
String genusPart = genusPart(originalGenus, useOriginalGenus,
|
|
853 |
|
|
854 |
String genusPart = genusPart(originalGenus, useOriginalGenus, |
|
858 | 855 |
genusOrUninomial.append(grandParentName)); |
859 | 856 |
nameCacheStringBuilder.append(genusPart); |
860 | 857 |
|
... | ... | |
863 | 860 |
specificEpithet.append(localName); |
864 | 861 |
|
865 | 862 |
} else if (rank == R_SUBSPECIES) { |
866 |
|
|
863 |
|
|
867 | 864 |
String greatGreatGrandParentName = fauEuTaxon.getGreatGreatGrandParentName(); |
868 |
|
|
865 |
|
|
869 | 866 |
if(greatGrandParentRankId == R_SUBGENUS) { |
870 |
|
|
871 |
String genusSubGenusPart = genusSubGenusPart(originalGenus, useOriginalGenus,
|
|
872 |
genusOrUninomial.append(greatGreatGrandParentName),
|
|
867 |
|
|
868 |
String genusSubGenusPart = genusSubGenusPart(originalGenus, useOriginalGenus, |
|
869 |
genusOrUninomial.append(greatGreatGrandParentName), |
|
873 | 870 |
infraGenericEpithet.append(greatGrandParentName), |
874 | 871 |
fauEuTaxon); |
875 | 872 |
nameCacheStringBuilder.append(genusSubGenusPart); |
876 |
|
|
873 |
|
|
877 | 874 |
} else if (greatGrandParentRankId == R_GENUS) { |
878 |
|
|
879 |
String genusPart = genusPart(originalGenus, useOriginalGenus,
|
|
875 |
|
|
876 |
String genusPart = genusPart(originalGenus, useOriginalGenus, |
|
880 | 877 |
genusOrUninomial.append(greatGreatGrandParentName)); |
881 | 878 |
nameCacheStringBuilder.append(genusPart); |
882 | 879 |
} |
883 |
|
|
880 |
|
|
884 | 881 |
nameCacheStringBuilder.append(grandParentName); |
885 | 882 |
nameCacheStringBuilder.append(" "); |
886 | 883 |
specificEpithet.append(grandParentName); |
887 | 884 |
nameCacheStringBuilder.append(localName); |
888 | 885 |
infraSpecificEpithet.append(localName); |
889 | 886 |
} |
890 |
|
|
891 |
|
|
892 |
|
|
887 |
|
|
888 |
|
|
889 |
|
|
893 | 890 |
} |
894 |
|
|
891 |
|
|
895 | 892 |
return nameCacheStringBuilder.toString(); |
896 | 893 |
} |
897 |
|
|
898 |
|
|
894 |
|
|
895 |
|
|
899 | 896 |
/** Build taxon's name parts and caches */ |
900 | 897 |
private String buildTaxonName(FaunaEuropaeaTaxon fauEuTaxon, TaxonBase<?> taxonBase, TaxonNameBase<?,?>taxonName, |
901 | 898 |
boolean useOriginalGenus, FaunaEuropaeaImportConfigurator fauEuConfig) { |
... | ... | |
906 | 903 |
String completeString = ""; |
907 | 904 |
|
908 | 905 |
StringBuilder acceptedGenus = new StringBuilder(""); |
909 |
|
|
906 |
|
|
910 | 907 |
StringBuilder genusOrUninomial = new StringBuilder(); |
911 |
StringBuilder infraGenericEpithet = new StringBuilder();
|
|
908 |
StringBuilder infraGenericEpithet = new StringBuilder(); |
|
912 | 909 |
StringBuilder specificEpithet = new StringBuilder(); |
913 | 910 |
StringBuilder infraSpecificEpithet = new StringBuilder(); |
914 | 911 |
|
915 | 912 |
localString = fauEuTaxon.getLocalName(); |
916 | 913 |
int rank = fauEuTaxon.getRankId(); |
917 |
|
|
914 |
|
|
918 | 915 |
// determine genus: this also works for cases of synonyms since the accepted taxon is its parent |
919 | 916 |
String acceptedGenusString = null; |
920 | 917 |
String tempAcceptedGenusString = determineAcceptedGenus(fauEuTaxon); |
... | ... | |
928 | 925 |
acceptedGenus = new StringBuilder(acceptedGenusString); |
929 | 926 |
} |
930 | 927 |
|
931 |
if(logger.isDebugEnabled()) {
|
|
932 |
logger.debug("Local taxon name (rank = " + rank + "): " + localString);
|
|
928 |
if(logger.isDebugEnabled()) { |
|
929 |
logger.debug("Local taxon name (rank = " + rank + "): " + localString); |
|
933 | 930 |
} |
934 | 931 |
|
935 | 932 |
if (rank < R_SPECIES) { |
... | ... | |
939 | 936 |
if (rank == R_SUBGENUS) { |
940 | 937 |
// subgenus part |
941 | 938 |
infraGenericEpithet.append(localString); |
942 |
|
|
939 |
|
|
943 | 940 |
// genus part |
944 | 941 |
genusOrUninomial.append(acceptedGenus); |
945 |
|
|
942 |
|
|
946 | 943 |
completeString = acceptedGenus + " ("+ localString + ")"; |
947 | 944 |
} else { |
948 | 945 |
// genus or above |
949 | 946 |
genusOrUninomial.append(localString); |
950 | 947 |
} |
951 |
|
|
948 |
|
|
952 | 949 |
} else { |
953 | 950 |
// species or below |
954 | 951 |
|
955 | 952 |
taxonBase = taxonBase.deproxy(taxonBase, TaxonBase.class); |
956 | 953 |
|
957 |
completeString =
|
|
958 |
buildLowerTaxonName(acceptedGenus, useOriginalGenus,
|
|
954 |
completeString = |
|
955 |
buildLowerTaxonName(acceptedGenus, useOriginalGenus, |
|
959 | 956 |
genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet, |
960 | 957 |
fauEuTaxon); |
961 |
|
|
958 |
|
|
962 | 959 |
completeString = (String) CdmUtils.removeDuplicateWhitespace(completeString.trim()); |
963 | 960 |
|
964 | 961 |
} |
965 | 962 |
return setCompleteTaxonName(completeString, useOriginalGenus, |
966 |
genusOrUninomial.toString(), infraGenericEpithet.toString(),
|
|
963 |
genusOrUninomial.toString(), infraGenericEpithet.toString(), |
|
967 | 964 |
specificEpithet.toString(), infraSpecificEpithet.toString(), |
968 | 965 |
fauEuTaxon, taxonBase, fauEuConfig); |
969 |
|
|
966 |
|
|
970 | 967 |
} |
971 |
|
|
972 |
|
|
968 |
|
|
969 |
|
|
973 | 970 |
/** |
974 | 971 |
* Determines the original genus name by searching the taxon with rank Genus. |
975 | 972 |
* @param fauEuTaxon |
... | ... | |
984 | 981 |
ranks.put(fauEuTaxon.getGreatGrandParentRankId(), fauEuTaxon.getGreatGrandParentName()); |
985 | 982 |
ranks.put(fauEuTaxon.getGreatGreatGrandParentRankId(), fauEuTaxon.getGreatGreatGrandParentName()); |
986 | 983 |
ranks.put(fauEuTaxon.getGreatGreatGreatGrandParentRankId(), fauEuTaxon.getGreatGreatGreatGrandParentName()); |
987 |
|
|
984 |
|
|
988 | 985 |
originalGenus = ranks.get(R_GENUS); |
989 | 986 |
|
990 | 987 |
return originalGenus; |
... | ... | |
992 | 989 |
|
993 | 990 |
/** Sets name parts and caches */ |
994 | 991 |
private String setCompleteTaxonName(String concatString, boolean useOriginalGenus, |
995 |
String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet,
|
|
992 |
String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet, |
|
996 | 993 |
FaunaEuropaeaTaxon fauEuTaxon, TaxonBase<?> taxonBase, FaunaEuropaeaImportConfigurator fauEuConfig) { |
997 | 994 |
|
998 | 995 |
boolean success = true; |
999 |
|
|
996 |
|
|
1000 | 997 |
TaxonNameBase<?,?> taxonName = taxonBase.getName(); |
1001 | 998 |
ZoologicalName zooName = (ZoologicalName)taxonName; |
1002 |
|
|
999 |
|
|
1003 | 1000 |
if (!genusOrUninomial.equals("")) { |
1004 | 1001 |
zooName.setGenusOrUninomial(emptyToNull(genusOrUninomial)); |
1005 |
if (logger.isDebugEnabled()) {
|
|
1006 |
logger.debug("genusOrUninomial: " + genusOrUninomial);
|
|
1002 |
if (logger.isDebugEnabled()) { |
|
1003 |
logger.debug("genusOrUninomial: " + genusOrUninomial); |
|
1007 | 1004 |
} |
1008 | 1005 |
} |
1009 |
|
|
1006 |
|
|
1010 | 1007 |
//if ((!infraGenericEpithet.equals("") && fauEuTaxon.isParenthesis()) || (!infraGenericEpithet.equals("") && fauEuTaxon.)) { |
1011 | 1008 |
if (fauEuTaxon.getParentRankId() == R_SUBGENUS || fauEuTaxon.getRankId() == R_SUBGENUS || |
1012 | 1009 |
fauEuTaxon.getGrandParentRankId() == R_SUBGENUS || fauEuTaxon.getGreatGrandParentRankId() == R_SUBGENUS) { |
1013 | 1010 |
zooName.setInfraGenericEpithet(emptyToNull(infraGenericEpithet)); |
1014 |
if (logger.isDebugEnabled()) {
|
|
1015 |
logger.debug("infraGenericEpithet: " + infraGenericEpithet);
|
|
1011 |
if (logger.isDebugEnabled()) { |
|
1012 |
logger.debug("infraGenericEpithet: " + infraGenericEpithet); |
|
1016 | 1013 |
} |
1017 | 1014 |
} |
1018 | 1015 |
if ((fauEuTaxon.getRankId() == R_SPECIES || fauEuTaxon.getRankId() == R_SUBSPECIES)) { |
1019 | 1016 |
zooName.setSpecificEpithet(emptyToNull(specificEpithet)); |
1020 |
if (logger.isDebugEnabled()) {
|
|
1021 |
logger.debug("specificEpithet: " + specificEpithet);
|
|
1017 |
if (logger.isDebugEnabled()) { |
|
1018 |
logger.debug("specificEpithet: " + specificEpithet); |
|
1022 | 1019 |
} |
1023 | 1020 |
} |
1024 | 1021 |
if (fauEuTaxon.getRankId() == R_SUBSPECIES) { |
1025 | 1022 |
zooName.setInfraSpecificEpithet(emptyToNull(infraSpecificEpithet)); |
1026 |
if (logger.isDebugEnabled()) {
|
|
1027 |
logger.debug("infraSpecificEpithet: " + infraSpecificEpithet);
|
|
1023 |
if (logger.isDebugEnabled()) { |
|
1024 |
logger.debug("infraSpecificEpithet: " + infraSpecificEpithet); |
|
1028 | 1025 |
} |
1029 | 1026 |
} |
1030 | 1027 |
//TODO: use generate NameCache |
... | ... | |
1036 | 1033 |
//titleCache = buildNameFullTitleCache(concatString, fauEuConfig); |
1037 | 1034 |
// zooName.generateFullTitle(); |
1038 | 1035 |
//zooName.setFullTitleCache(titleCache); // TODO: Add reference, NC status |
1039 |
|
|
1040 |
// ImportHelper.setOriginalSource(taxonName, fauEuConfig.getSourceReference(),
|
|
1036 |
|
|
1037 |
// ImportHelper.setOriginalSource(taxonName, fauEuConfig.getSourceReference(), |
|
1041 | 1038 |
// fauEuTaxon.getId(), "TaxonName"); |
1042 | 1039 |
// taxonBase.setSec(fauEuConfig.getSourceReference()); |
1043 | 1040 |
// taxonBase.generateTitle(); |
1044 | 1041 |
//titleCache = buildTaxonTitleCache(concatString, fauEuConfig.getSourceReference()); |
1045 | 1042 |
//taxonBase.setTitleCache(titleCache); |
1046 |
|
|
1047 |
if (logger.isDebugEnabled()) {
|
|
1048 |
logger.debug("Name stored: " + result);
|
|
1043 |
|
|
1044 |
if (logger.isDebugEnabled()) { |
|
1045 |
logger.debug("Name stored: " + result); |
|
1049 | 1046 |
} |
1050 | 1047 |
return result; |
1051 | 1048 |
} |
... | ... | |
1062 | 1059 |
return text; |
1063 | 1060 |
} |
1064 | 1061 |
} |
1065 |
|
|
1066 |
|
|
1062 |
|
|
1063 |
|
|
1067 | 1064 |
|
1068 | 1065 |
} |
Also available in: Unified diff
Rename NonViralName authorteams to authorship #4968