Revision 1d5daa79
Added by Patrick Plitzner over 7 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java | ||
---|---|---|
34 | 34 |
import eu.etaxonomy.cdm.model.common.AnnotationType; |
35 | 35 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
36 | 36 |
import eu.etaxonomy.cdm.model.common.Language; |
37 |
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary; |
|
37 | 38 |
import eu.etaxonomy.cdm.model.description.CommonTaxonName; |
38 | 39 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
39 | 40 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
... | ... | |
43 | 44 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
44 | 45 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
45 | 46 |
import eu.etaxonomy.cdm.model.name.Rank; |
47 |
import eu.etaxonomy.cdm.model.name.RankClass; |
|
46 | 48 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
47 | 49 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
48 | 50 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
136 | 138 |
importAuthors(state, rs, name); |
137 | 139 |
|
138 | 140 |
//---TAXON--- |
139 |
TaxonBase<?> taxonBase = importTaxon(rs, name); |
|
141 |
TaxonBase<?> taxonBase = importTaxon(rs, name, state);
|
|
140 | 142 |
if(taxonBase==null){ |
141 | 143 |
RedListUtil.logMessage(id, "Taxon for name "+name+" could not be created.", logger); |
142 | 144 |
return; |
... | ... | |
189 | 191 |
} |
190 | 192 |
} |
191 | 193 |
|
192 |
private TaxonBase<?> importTaxon(ResultSet rs, NonViralName<?> name) throws SQLException { |
|
194 |
private TaxonBase<?> importTaxon(ResultSet rs, NonViralName<?> name, RedListGefaesspflanzenImportState state) throws SQLException {
|
|
193 | 195 |
|
194 | 196 |
long id = rs.getLong(RedListUtil.NAMNR); |
195 | 197 |
String taxNameString = rs.getString(RedListUtil.TAXNAME); |
... | ... | |
235 | 237 |
addAnnotation(RedListUtil.WISSK+": "+wisskString, taxonBase); |
236 | 238 |
|
237 | 239 |
//check taxon name consistency |
238 |
checkTaxonConsistency(id, taxNameString, hybString, taxonBase); |
|
240 |
checkTaxonConsistency(id, taxNameString, hybString, taxonBase, state);
|
|
239 | 241 |
return taxonBase; |
240 | 242 |
} |
241 | 243 |
|
... | ... | |
500 | 502 |
} |
501 | 503 |
} |
502 | 504 |
|
503 |
private void checkTaxonConsistency(long id, String taxNameString, String hybString, TaxonBase<?> taxonBase) { |
|
505 |
private void checkTaxonConsistency(long id, String taxNameString, String hybString, TaxonBase<?> taxonBase, RedListGefaesspflanzenImportState state) {
|
|
504 | 506 |
String nameCache = HibernateProxyHelper.deproxy(taxonBase.getName(), NonViralName.class).getNameCache().trim(); |
505 | 507 |
taxNameString = taxNameString.trim(); |
506 | 508 |
taxNameString = taxNameString.replaceAll(" +", " "); |
... | ... | |
528 | 530 |
} |
529 | 531 |
|
530 | 532 |
taxNameString = taxNameString.replace("[ranglos]", "[unranked]"); |
531 |
if(taxonBase.getName().getRank()!=null && taxonBase.getName().getRank().equals(Rank.PROLES())){ |
|
532 |
taxNameString = taxNameString.replace("proles", "prol."); |
|
533 |
if(taxonBase.getName().getRank()!=null){ |
|
534 |
if(taxonBase.getName().getRank().equals(Rank.PROLES())){ |
|
535 |
taxNameString = taxNameString.replace("proles", "prol."); |
|
536 |
} |
|
537 |
else if(taxonBase.getName().getRank().equals(state.getRank(RedListUtil.uuidRankCollectionSpecies))){ |
|
538 |
taxNameString = taxNameString.replace("\"Sammelart\"", "\"Coll. Species\""); |
|
539 |
} |
|
533 | 540 |
} |
534 | 541 |
if(STRICT_TITLE_CHECK){ |
535 | 542 |
if(!taxNameString.trim().equals(nameCache)){ |
... | ... | |
555 | 562 |
return Rank.UNRANKED_INFRAGENERIC(); |
556 | 563 |
} |
557 | 564 |
} |
565 |
else if(rankStr.equals("SAM")){ |
|
566 |
return getRank(state, RedListUtil.uuidRankCollectionSpecies, "Collective Species", "Collective Species", "\"Coll. Species\"", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.SpeciesGroup); |
|
567 |
} |
|
558 | 568 |
else{ |
559 | 569 |
rank = state.getTransformer().getRankByKey(rankStr); |
560 | 570 |
} |
Also available in: Unified diff
#5448 Import rank "SAM"