Revision e5299170
Added by Andreas Müller over 4 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTaxonExport.java | ||
---|---|---|
247 | 247 |
rankTypeExpertsUpdateStmt = connection.prepareStatement(sql); |
248 | 248 |
} |
249 | 249 |
|
250 |
private boolean doPhase01(PesiExportState state, PesiExportMapping mapping, PesiExportMapping additionalSourceMapping) throws SQLException {
|
|
250 |
private boolean doPhase01(PesiExportState state, PesiExportMapping mapping, PesiExportMapping additionalSourceMapping){ |
|
251 | 251 |
int count = 0; |
252 | 252 |
int pastCount = 0; |
253 | 253 |
List<TaxonBase> list; |
... | ... | |
1452 | 1452 |
/** |
1453 | 1453 |
* Returns the rank cache for the taxon name based on the names nomenclatural code. |
1454 | 1454 |
* You may not use this method for kingdoms other then Animalia, Plantae and Bacteria. |
1455 |
* @param taxonName |
|
1456 |
* @return |
|
1457 | 1455 |
*/ |
1458 | 1456 |
@SuppressWarnings("unused") //used by mapper |
1459 | 1457 |
private static String getRankCache(TaxonName taxonName, PesiExportState state) { |
... | ... | |
2081 | 2079 |
* @param taxonName The {@link TaxonNameBase TaxonName}. |
2082 | 2080 |
* @return The Sources. |
2083 | 2081 |
*/ |
2084 |
private static Set<IdentifiableSource> getPesiSources(IdentifiableEntity identEntity) {
|
|
2085 |
Set<IdentifiableSource> sources = new java.util.HashSet<IdentifiableSource>();
|
|
2082 |
private static Set<IdentifiableSource> getPesiSources(IdentifiableEntity<?> identifiableEntity) {
|
|
2083 |
Set<IdentifiableSource> sources = new HashSet<>();
|
|
2086 | 2084 |
|
2087 | 2085 |
//Taxon Names |
2088 |
if (identEntity.isInstanceOf(TaxonName.class)){ |
|
2086 |
if (identifiableEntity.isInstanceOf(TaxonName.class)){
|
|
2089 | 2087 |
// Sources from TaxonName |
2090 |
TaxonName taxonName = CdmBase.deproxy(identEntity, TaxonName.class); |
|
2091 |
Set<IdentifiableSource> testSources = identEntity.getSources(); |
|
2092 |
sources = filterPesiSources(identEntity.getSources()); |
|
2088 |
TaxonName taxonName = CdmBase.deproxy(identifiableEntity, TaxonName.class);
|
|
2089 |
Set<IdentifiableSource> testSources = identifiableEntity.getSources();
|
|
2090 |
sources = filterPesiSources(identifiableEntity.getSources());
|
|
2093 | 2091 |
|
2094 | 2092 |
if (sources.size() == 0 && testSources.size()>0){ |
2095 | 2093 |
IdentifiableSource source = testSources.iterator().next(); |
2096 | 2094 |
logger.warn("There are sources, but they are no pesi sources!!!" + source.getIdInSource() + " - " + source.getIdNamespace() + " - " + source.getCitation().getTitleCache()); |
2097 | 2095 |
} |
2098 | 2096 |
if (sources.size() > 1) { |
2099 |
logger.warn("This TaxonName has more than one Source: " + identEntity.getUuid() + " (" + identEntity.getTitleCache() + ")");
|
|
2097 |
logger.warn("This TaxonName has more than one Source: " + identifiableEntity.getUuid() + " (" + identifiableEntity.getTitleCache() + ")");
|
|
2100 | 2098 |
} |
2101 | 2099 |
|
2102 | 2100 |
// name has no PESI source, take sources from TaxonBase |
... | ... | |
2108 | 2106 |
} |
2109 | 2107 |
|
2110 | 2108 |
//for TaxonBases |
2111 |
}else if (identEntity.isInstanceOf(TaxonBase.class)){ |
|
2112 |
sources = filterPesiSources(identEntity.getSources()); |
|
2109 |
}else if (identifiableEntity.isInstanceOf(TaxonBase.class)){
|
|
2110 |
sources = filterPesiSources(identifiableEntity.getSources());
|
|
2113 | 2111 |
} |
2114 | 2112 |
|
2115 | 2113 |
/*TODO: deleted only for testing the inferred synonyms |
... | ... | |
2124 | 2122 |
|
2125 | 2123 |
// return all sources with a PESI reference |
2126 | 2124 |
private static Set<IdentifiableSource> filterPesiSources(Set<? extends IdentifiableSource> sources) { |
2127 |
Set<IdentifiableSource> result = new HashSet<IdentifiableSource>();
|
|
2125 |
Set<IdentifiableSource> result = new HashSet<>(); |
|
2128 | 2126 |
for (IdentifiableSource source : sources){ |
2129 | 2127 |
Reference ref = source.getCitation(); |
2130 | 2128 |
UUID refUuid = ref.getUuid(); |
... | ... | |
2456 | 2454 |
|
2457 | 2455 |
mapping.addMapper(MethodMapper.NewInstance("DerivedFromGuid", this)); |
2458 | 2456 |
mapping.addMapper(MethodMapper.NewInstance("CacheCitation", this)); |
2459 |
mapping.addMapper(MethodMapper.NewInstance("AuthorString", this)); //For Taxon because Misallied Names are handled differently |
|
2457 |
mapping.addMapper(MethodMapper.NewInstance("AuthorString", this)); //For Taxon because Misapllied Names are handled differently
|
|
2460 | 2458 |
mapping.addMapper(MethodMapper.NewInstance("WebShowName", this)); |
2461 | 2459 |
|
2462 | 2460 |
// DisplayName |
Also available in: Unified diff
cleanup