Revision 1030c26a
Added by Andreas Müller over 4 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTaxonExport.java | ||
---|---|---|
13 | 13 |
import java.sql.ResultSet; |
14 | 14 |
import java.sql.SQLException; |
15 | 15 |
import java.sql.Types; |
16 |
import java.util.ArrayList; |
|
17 | 16 |
import java.util.BitSet; |
18 | 17 |
import java.util.HashMap; |
19 | 18 |
import java.util.HashSet; |
... | ... | |
109 | 108 |
private PreparedStatement parentTaxonFkStmt; |
110 | 109 |
private PreparedStatement rankTypeExpertsUpdateStmt; |
111 | 110 |
private PreparedStatement rankUpdateStmt; |
112 |
private NomenclaturalCode nomenclaturalCode; |
|
113 | 111 |
private Integer kingdomFk; |
114 |
private final HashMap<Rank, Rank> rank2endRankMap = new HashMap<>(); |
|
115 |
private final List<Rank> rankList = new ArrayList<>(); |
|
116 |
private static final UUID uuidTreeIndex = UUID.fromString("28f4e205-1d02-4d3a-8288-775ea8413009"); |
|
117 | 112 |
private AnnotationType treeIndexAnnotationType; |
118 | 113 |
private static ExtensionType lastActionExtensionType; |
119 | 114 |
private static ExtensionType lastActionDateExtensionType; |
... | ... | |
124 | 119 |
public static TaxonNameDefaultCacheStrategy nonViralNameStrategy = TaxonNameDefaultCacheStrategy.NewInstance(); |
125 | 120 |
private static int currentTaxonId; |
126 | 121 |
|
127 |
|
|
128 |
/** |
|
129 |
* @return the treeIndexAnnotationType |
|
130 |
*/ |
|
131 | 122 |
protected AnnotationType getTreeIndexAnnotationType() { |
132 | 123 |
return treeIndexAnnotationType; |
133 | 124 |
} |
134 | 125 |
|
135 |
/** |
|
136 |
* @param treeIndexAnnotationType the treeIndexAnnotationType to set |
|
137 |
*/ |
|
138 | 126 |
protected void setTreeIndexAnnotationType(AnnotationType treeIndexAnnotationType) { |
139 | 127 |
this.treeIndexAnnotationType = treeIndexAnnotationType; |
140 | 128 |
} |
... | ... | |
356 | 344 |
private void validatePhaseOne(TaxonBase<?> taxon, TaxonName taxonName) { |
357 | 345 |
|
358 | 346 |
// Check whether some rules are violated |
359 |
nomenclaturalCode = taxonName.getNameType(); |
|
347 |
NomenclaturalCode nomenclaturalCode = taxonName.getNameType();
|
|
360 | 348 |
String genusOrUninomial = taxonName.getGenusOrUninomial(); |
361 | 349 |
String specificEpithet = taxonName.getSpecificEpithet(); |
362 | 350 |
String infraSpecificEpithet = taxonName.getInfraSpecificEpithet(); |
... | ... | |
667 | 655 |
|
668 | 656 |
//TODO why are expertFks needed? (Andreas M.) |
669 | 657 |
// if (expertFk != null || speciesExpertFk != null) { |
670 |
invokeRankDataAndTypeNameFkAndKingdomFk(taxonName, nomenclaturalCode, state.getDbId(taxon), |
|
658 |
NomenclaturalCode nomCode = taxonName.getNameType(); |
|
659 |
//is there a reason why we do pass nomCode separately? Before nomCode was class variable, but not clear why and when it was set |
|
660 |
invokeRankDataAndTypeNameFkAndKingdomFk(taxonName, nomCode, state.getDbId(taxon), |
|
671 | 661 |
typeNameFk, kingdomFk, state); |
672 | 662 |
// } |
673 | 663 |
} |
... | ... | |
727 | 717 |
} |
728 | 718 |
return kingdomID; |
729 | 719 |
} else { |
720 |
NomenclaturalCode nomenclaturalCode = taxon.getName().getNameType(); |
|
730 | 721 |
logger.warn("The taxon has no nodes: " + taxon.getTitleCache() + ". The kingdom is taken from the nomenclatural code: " + PesiTransformer.nomenclaturalCode2Kingdom(nomenclaturalCode)); |
731 | 722 |
return PesiTransformer.nomenclaturalCode2Kingdom(nomenclaturalCode); |
732 | 723 |
} |
733 | 724 |
} else{ |
725 |
NomenclaturalCode nomenclaturalCode = taxonBase.getName().getNameType(); |
|
734 | 726 |
logger.warn("Taxon is synonym with no accepted taxon attached: " + taxonBase.getTitleCache() + ". The kingdom is taken from the nomenclatural code: " + PesiTransformer.nomenclaturalCode2Kingdom(nomenclaturalCode) ); |
735 | 727 |
return PesiTransformer.nomenclaturalCode2Kingdom(nomenclaturalCode); |
736 | 728 |
} |
... | ... | |
783 | 775 |
|
784 | 776 |
// Save Rank Data and KingdomFk for inferred synonyms |
785 | 777 |
for (Integer taxonFk : inferredSynonymsDataToBeSaved.keySet()) { |
786 |
invokeRankDataAndKingdomFk(inferredSynonymsDataToBeSaved.get(taxonFk), nomenclaturalCode, taxonFk, kingdomFk, state); |
|
778 |
TaxonName taxonName = inferredSynonymsDataToBeSaved.get(taxonFk); |
|
779 |
NomenclaturalCode nomCode = taxonName.getNameType(); //nomCode was class variable before, not sure if this was important |
|
780 |
invokeRankDataAndKingdomFk(inferredSynonymsDataToBeSaved.get(taxonFk), nomCode, taxonFk, kingdomFk, state); |
|
787 | 781 |
} |
788 | 782 |
|
789 | 783 |
// Start transaction |
... | ... | |
810 | 804 |
|
811 | 805 |
// Save Rank Data and KingdomFk for inferred synonyms |
812 | 806 |
for (Integer taxonFk : inferredSynonymsDataToBeSaved.keySet()) { |
813 |
invokeRankDataAndKingdomFk(inferredSynonymsDataToBeSaved.get(taxonFk), nomenclaturalCode, taxonFk, kingdomFk, state); |
|
807 |
TaxonName taxonName = inferredSynonymsDataToBeSaved.get(taxonFk); |
|
808 |
NomenclaturalCode nomCode = taxonName.getNameType(); //nomCode was class variable before, not sure if this was important |
|
809 |
invokeRankDataAndKingdomFk(inferredSynonymsDataToBeSaved.get(taxonFk), nomCode, taxonFk, kingdomFk, state); |
|
814 | 810 |
} |
815 | 811 |
|
816 | 812 |
// Start transaction |
... | ... | |
864 | 860 |
TaxonName taxonName = acceptedTaxon.getName(); |
865 | 861 |
|
866 | 862 |
if (taxonName.isZoological()) { |
867 |
nomenclaturalCode = taxonName.getNameType(); |
|
863 |
NomenclaturalCode nomenclaturalCode = taxonName.getNameType();
|
|
868 | 864 |
kingdomFk = PesiTransformer.nomenclaturalCode2Kingdom(nomenclaturalCode); |
869 | 865 |
|
870 | 866 |
Set<TaxonNode> taxonNodes = acceptedTaxon.getTaxonNodes(); |
Also available in: Unified diff
ref #8509 cleanup and handle nomCode not as class variable