Revision 9dc896c9
Added by Andreas Müller almost 7 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/taxonx/TaxonXNomenclatureImport.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus; |
34 | 34 |
import eu.etaxonomy.cdm.model.name.Rank; |
35 | 35 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
36 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
36 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
37 | 37 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
38 | 38 |
import eu.etaxonomy.cdm.model.reference.Reference; |
39 | 39 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
... | ... | |
116 | 116 |
unlazySynonym(config, taxon); |
117 | 117 |
Set<Synonym> synList = taxon.getSynonyms(); |
118 | 118 |
for (Synonym syn : synList){ |
119 |
TaxonNameBase<?,?> nameBase = syn.getName();
|
|
119 |
TaxonName nameBase = syn.getName(); |
|
120 | 120 |
if (nameBase != null){ |
121 | 121 |
if (nameBase.isNonViral()){ |
122 | 122 |
if (nameBase.getNameCache().equals(synName)){ |
... | ... | |
160 | 160 |
* @param taxonBase |
161 | 161 |
* @return |
162 | 162 |
*/ |
163 |
private boolean doNomenclaturalType(TaxonXImportConfigurator config, Element elNomenclature, Namespace nsTaxonx, TaxonNameBase taxonName){
|
|
163 |
private boolean doNomenclaturalType(TaxonXImportConfigurator config, Element elNomenclature, Namespace nsTaxonx, TaxonName taxonName){ |
|
164 | 164 |
boolean success = true; |
165 | 165 |
if (taxonName == null){ |
166 | 166 |
logger.warn("taxonName is null"); |
... | ... | |
191 | 191 |
} |
192 | 192 |
|
193 | 193 |
|
194 |
private boolean doSpecimenType(TaxonXImportConfigurator config, Element elType, Element elTypeLoc, TaxonNameBase taxonName){
|
|
194 |
private boolean doSpecimenType(TaxonXImportConfigurator config, Element elType, Element elTypeLoc, TaxonName taxonName){ |
|
195 | 195 |
Reference citation = null; |
196 | 196 |
String citationMicroReference = null; |
197 | 197 |
String originalNameString = null; |
... | ... | |
258 | 258 |
return true; |
259 | 259 |
} |
260 | 260 |
|
261 |
private boolean doNameType(Element elType, TaxonNameBase taxonName, TaxonXImportConfigurator config){
|
|
261 |
private boolean doNameType(Element elType, TaxonName taxonName, TaxonXImportConfigurator config){ |
|
262 | 262 |
boolean success = true; |
263 | 263 |
//type |
264 | 264 |
String text = elType.getTextNormalize(); |
... | ... | |
285 | 285 |
// logger.warn("<nomenclature><type> is of unsupported format: " + elType.getTextNormalize() + getBracketSourceName(config)); |
286 | 286 |
// success = false; |
287 | 287 |
// }else{ |
288 |
// TaxonNameBase childType = getChildrenNameType(taxonName, taxonNameStr, authorStr);
|
|
288 |
// TaxonName childType = getChildrenNameType(taxonName, taxonNameStr, authorStr); |
|
289 | 289 |
// if (childType != null){ |
290 | 290 |
// return doNameTypeDesignation(taxonName, childType, status); |
291 | 291 |
// }else{ |
... | ... | |
293 | 293 |
String uninomial = epis[0].trim(); |
294 | 294 |
String specEpi = epis[1].trim(); |
295 | 295 |
|
296 |
Pager<TaxonNameBase> nameTypes = getNameService().searchNames(uninomial, null, specEpi, null, Rank.SPECIES(), null, null, null, null);
|
|
296 |
Pager<TaxonName> nameTypes = getNameService().searchNames(uninomial, null, specEpi, null, Rank.SPECIES(), null, null, null, null); |
|
297 | 297 |
|
298 | 298 |
List<INonViralName> result = new ArrayList<>(); |
299 |
for (TaxonNameBase nt : nameTypes.getRecords()){
|
|
299 |
for (TaxonName nt : nameTypes.getRecords()){ |
|
300 | 300 |
if (compareAuthorship(nt, authorStr)){ |
301 | 301 |
result.add(nt); |
302 | 302 |
success &= doNameTypeDesignation(taxonName, nt, status/*, isLectoType*/); |
... | ... | |
318 | 318 |
} |
319 | 319 |
|
320 | 320 |
|
321 |
// private TaxonNameBase getChildrenNameType(TaxonNameBase name, String typeStr, String authorStr){
|
|
322 |
// TaxonNameBase result = null;
|
|
321 |
// private TaxonName getChildrenNameType(TaxonName name, String typeStr, String authorStr){
|
|
322 |
// TaxonName result = null; |
|
323 | 323 |
// Set<TaxonBase> list = name.getTaxonBases(); |
324 | 324 |
// for (TaxonBase taxonBase : list){ |
325 | 325 |
// Taxon taxon; |
... | ... | |
389 | 389 |
} |
390 | 390 |
|
391 | 391 |
|
392 |
private boolean doNameTypeDesignation(TaxonNameBase name, TaxonNameBase type, NameTypeDesignationStatus status/*, boolean isLectoType*/){
|
|
392 |
private boolean doNameTypeDesignation(TaxonName name, TaxonName type, NameTypeDesignationStatus status/*, boolean isLectoType*/){
|
|
393 | 393 |
Reference citation = null; |
394 | 394 |
String citationMicroReference = null; |
395 | 395 |
String originalNameString = null; |
... | ... | |
410 | 410 |
*/ |
411 | 411 |
private HashMap<DerivedUnit, SpecimenTypeDesignationStatus> doElTypeLoc(Element elTypeLoc, |
412 | 412 |
SimpleSpecimen simpleSpecimen, |
413 |
TaxonNameBase<?,?> taxonName,
|
|
413 |
TaxonName taxonName, |
|
414 | 414 |
TaxonXImportConfigurator config){ |
415 | 415 |
|
416 | 416 |
HashMap<DerivedUnit, SpecimenTypeDesignationStatus> result = new HashMap<DerivedUnit, SpecimenTypeDesignationStatus>(); |
... | ... | |
512 | 512 |
String[] collectionStrings = typeLocStatus.substring(pos).split(","); |
513 | 513 |
for(String collectionString : collectionStrings){ |
514 | 514 |
if (taxonBase != null){ |
515 |
TaxonNameBase<?, ?> taxonName = taxonBase.getName();
|
|
515 |
TaxonName<?,?> taxonName = taxonBase.getName();
|
|
516 | 516 |
if (taxonName != null){ |
517 | 517 |
Reference citation = null; |
518 | 518 |
String citationMicroReference = null; |
... | ... | |
590 | 590 |
/** |
591 | 591 |
* TODO Preliminary to avoid laizy loading errors |
592 | 592 |
*/ |
593 |
private void unlazyTypeDesignation(TaxonXImportConfigurator config, TaxonNameBase taxonNameBase){
|
|
593 |
private void unlazyTypeDesignation(TaxonXImportConfigurator config, TaxonName taxonName){
|
|
594 | 594 |
TransactionStatus txStatus = startTransaction(); |
595 | 595 |
//INameService taxonNameService = config.getCdmAppController().getNameService(); |
596 | 596 |
INameService taxonNameService = getNameService(); |
597 | 597 |
|
598 |
taxonNameService.save(taxonNameBase);
|
|
599 |
Set<TaxonNameBase> typifiedNames = taxonNameBase.getHomotypicalGroup().getTypifiedNames();
|
|
600 |
for(TaxonNameBase typifiedName: typifiedNames){
|
|
598 |
taxonNameService.save(taxonName); |
|
599 |
Set<TaxonName> typifiedNames = taxonName.getHomotypicalGroup().getTypifiedNames();
|
|
600 |
for(TaxonName typifiedName: typifiedNames){ |
|
601 | 601 |
typifiedName.getTypeDesignations().size(); |
602 | 602 |
} |
603 |
//taxonNameService.saveTaxonName(taxonNameBase);
|
|
603 |
//taxonNameService.saveTaxonName(taxonName); |
|
604 | 604 |
commitTransaction(txStatus); |
605 | 605 |
} |
606 | 606 |
|
Also available in: Unified diff
fix #6368 rename table and class TaxonNameBase