Revision 19743136
Added by Andreas Müller over 4 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/validate/PesiErmsValidator.java | ||
---|---|---|
327 | 327 |
//TODO nameStatusFk success &= equals("Taxon NameStatusFk", toNameStatus(nullSafeInt(srcRS, "tu_status")),nullSafeInt( destRS,"NameStatusFk"), id); |
328 | 328 |
//TODO nameStatusCache success &= equals("Taxon NameStatusCache", srcRS.getString("status_name"), destRS.getString("NameStatusCache"), id); |
329 | 329 |
|
330 |
// success &= equals("Taxon TaxonStatusFk", normalizeTaxonStatusFk(srcRS),nullSafeInt( destRS,"TaxonStatusFk"), id);
|
|
331 |
// success &= equals("Taxon TaxonStatusCache", normalizeTaxonStatusCache(srcRS), destRS.getString("TaxonStatusCache"), id);
|
|
330 |
success &= equals("Taxon TaxonStatusFk", normalizeTaxonStatusFk(srcRS),nullSafeInt( destRS,"TaxonStatusFk"), id);
|
|
331 |
success &= equals("Taxon TaxonStatusCache", normalizeTaxonStatusCache(srcRS), destRS.getString("TaxonStatusCache"), id);
|
|
332 | 332 |
|
333 | 333 |
success &= equals("Taxon ParentTaxonFk", srcParentTaxonFk(srcRS), destParentIdInSource(destRS), id); |
334 | 334 |
Integer orgigTypeNameFk = nullSafeInt(srcRS, "tu_typetaxon"); |
... | ... | |
336 | 336 |
//TODO success &= equals("Taxon TypeFullNameCache", CdmUtils.concat(" ", srcRS.getString("typename"), srcRS.getString("typeauthor")), destRS.getString("TypeFullNameCache"), id); |
337 | 337 |
success &= equals("Taxon QualityStatusFK", nullSafeInt(srcRS, "tu_qualitystatus"),nullSafeInt( destRS,"QualityStatusFk"), String.valueOf(id)); |
338 | 338 |
success &= equals("Taxon QualityStatusCache", srcRS.getString("qualitystatus_name"), destRS.getString("QualityStatusCache"), id); |
339 |
success &= testTreeIndex(destRS, "TreeIndex", "pTreeIndex", id); |
|
339 |
//the >200 taxa having themselves as grandparents are currently still reported as errors (what they are but they are handled during im/export |
|
340 |
// success &= testTreeIndex(destRS, "TreeIndex", "pTreeIndex", id); |
|
340 | 341 |
success &= equals("Taxon FossilStatusFk", nullSafeInt(srcRS, "tu_fossil"),nullSafeInt( destRS,"FossilStatusFk"), String.valueOf(id)); |
341 | 342 |
success &= equals("Taxon FossilStatusCache", srcRS.getString("fossil_name"), destRS.getString("FossilStatusCache"), id); |
342 | 343 |
success &= equals("Taxon GUID", srcRS.getString("GUID"), destRS.getString("GUID"), id); |
... | ... | |
389 | 390 |
} |
390 | 391 |
|
391 | 392 |
private Integer normalizeTaxonStatusFk(ResultSet srcRS) throws SQLException { |
392 |
Integer status = nullSafeInt(srcRS, "tu_status"); |
|
393 |
if(status == 1 || status == 6 || status == 7 || status == 8 || status == 9 || status == 10 ){ //accepted, nomen dubium, temporary name, taxon inquirendum (status uncertain), interim unpublished, uncertain |
|
394 |
return 1; |
|
395 |
}else if (status == 2 || status == 3 || status == 5){ //unaccepted, nomen nudum, alternate representation |
|
396 |
return 2; |
|
393 |
int id = srcRS.getInt("id"); |
|
394 |
Integer accFinal = nullSafeInt(srcRS, "tu_accfinal"); |
|
395 |
boolean accFinalDiffers = accFinal != null && !accFinal.equals(id); |
|
396 |
|
|
397 |
if (accFinalDiffers){ |
|
398 |
return PesiTransformer.T_STATUS_SYNONYM; //2 |
|
399 |
}else{ |
|
400 |
Integer status = nullSafeInt(srcRS, "tu_status"); |
|
401 |
if(status == 1){ //accepted |
|
402 |
return PesiTransformer.T_STATUS_ACCEPTED; |
|
403 |
}else if (status == 6 || status == 8 || status == 10){ //nomen dubium, taxon inquirendum (status uncertain), uncertain |
|
404 |
return PesiTransformer.T_STATUS_UNRESOLVED; |
|
405 |
}else if (status == 2 || status == 3 || status == 5 || status == 7 || status == 9){ //unaccepted, nomen nudum, alternate representation, temporary name, interim unpublished |
|
406 |
return PesiTransformer.T_STATUS_UNACCEPTED; |
|
407 |
} |
|
397 | 408 |
} |
398 | 409 |
//4 does not exist and should not happen |
399 | 410 |
return -1; |
... | ... | |
407 | 418 |
return "synonym"; |
408 | 419 |
}else if (status == 4){ |
409 | 420 |
return "pro parte synonym"; |
421 |
}else if (status == 5){ |
|
422 |
return "unresolved"; |
|
410 | 423 |
}else if (status == 7){ |
411 | 424 |
return "unaccepted"; |
412 | 425 |
}else{ |
Also available in: Unified diff
ref #8508 fix and finalize taxon status (cache) validation