2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.io
.redlist
.gefaesspflanzen
;
12 import java
.sql
.ResultSet
;
13 import java
.sql
.SQLException
;
14 import java
.util
.HashMap
;
15 import java
.util
.HashSet
;
19 import org
.apache
.log4j
.Logger
;
20 import org
.springframework
.stereotype
.Component
;
22 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
23 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
24 import eu
.etaxonomy
.cdm
.io
.common
.DbImportBase
;
25 import eu
.etaxonomy
.cdm
.io
.common
.IPartitionedIO
;
26 import eu
.etaxonomy
.cdm
.io
.common
.ImportHelper
;
27 import eu
.etaxonomy
.cdm
.io
.common
.ResultSetPartitioner
;
28 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.UndefinedTransformerMethodException
;
29 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
30 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
31 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
32 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
33 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
34 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
35 import eu
.etaxonomy
.cdm
.model
.name
.BotanicalName
;
36 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
37 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
38 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
39 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
40 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
41 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
42 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
43 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
44 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
45 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
46 import eu
.etaxonomy
.cdm
.strategy
.parser
.NonViralNameParserImpl
;
56 @SuppressWarnings("serial")
57 public class RedListGefaesspflanzenImportNames
extends DbImportBase
<RedListGefaesspflanzenImportState
, RedListGefaesspflanzenImportConfigurator
> {
59 private static final Logger logger
= Logger
.getLogger(RedListGefaesspflanzenImportNames
.class);
61 private static final String tableName
= "Rote Liste Gefäßpflanzen";
63 private static final String pluralString
= "names";
65 public RedListGefaesspflanzenImportNames() {
66 super(tableName
, pluralString
);
70 protected String
getIdQuery(RedListGefaesspflanzenImportState state
) {
71 return "SELECT NAMNR "
72 + "FROM V_TAXATLAS_D20_EXPORT t "
77 protected String
getRecordQuery(RedListGefaesspflanzenImportConfigurator config
) {
78 String result
= " SELECT * "
79 + " FROM V_TAXATLAS_D20_EXPORT t "
80 + " WHERE t.NAMNR IN (@IDSET)";
81 result
= result
.replace("@IDSET", IPartitionedIO
.ID_LIST_TOKEN
);
86 protected void doInvoke(RedListGefaesspflanzenImportState state
) {
87 super.doInvoke(state
);
92 public boolean doPartition(ResultSetPartitioner partitioner
, RedListGefaesspflanzenImportState state
) {
93 ResultSet rs
= partitioner
.getResultSet();
94 Set
<TaxonNameBase
<?
,?
>> namesToSave
= new HashSet
<TaxonNameBase
<?
,?
>>();
95 Set
<TaxonBase
<?
>> taxaToSave
= new HashSet
<TaxonBase
<?
>>();
98 makeSingleNameAndTaxon(state
, rs
, namesToSave
, taxaToSave
);
101 } catch (SQLException e
) {
105 getNameService().saveOrUpdate((TaxonNameBase
) namesToSave
);
106 getTaxonService().saveOrUpdate((TaxonBase
) taxaToSave
);
110 private void makeSingleNameAndTaxon(RedListGefaesspflanzenImportState state
, ResultSet rs
, Set
<TaxonNameBase
<?
,?
>> namesToSave
, Set
<TaxonBase
<?
>> taxaToSave
)
111 throws SQLException
{
112 long id
= rs
.getLong(RedListUtil
.NAMNR
);
113 String clTaxonString
= rs
.getString(RedListUtil
.CL_TAXON
);
114 String relationE
= rs
.getString(RedListUtil
.E
);
115 String relationW
= rs
.getString(RedListUtil
.W
);
116 String relationK
= rs
.getString(RedListUtil
.K
);
117 String relationAW
= rs
.getString(RedListUtil
.AW
);
118 String relationAO
= rs
.getString(RedListUtil
.AO
);
119 String relationR
= rs
.getString(RedListUtil
.R
);
120 String relationO
= rs
.getString(RedListUtil
.O
);
121 String relationS
= rs
.getString(RedListUtil
.S
);
124 NonViralName
<?
> name
= importName(state
, rs
, namesToSave
);
128 importAuthors(state
, rs
, name
);
131 TaxonBase
<?
> taxonBase
= importTaxon(rs
, name
);
133 RedListUtil
.logMessage(id
, "Taxon for name "+name
+" could not be created.", logger
);
136 taxonBase
.setSec(state
.getConfig().getSourceReference());
138 //---CONCEPT RELATIONSHIPS---
139 /*check if taxon/synonym also exists in other classification
140 * 1. create new taxon with the same name (in that classification)
141 * 2. create concept relationship between both
144 if(CdmUtils
.isNotBlank(clTaxonString
) && !clTaxonString
.trim().equals("-")){
145 cloneTaxon(taxonBase
, name
, TaxonRelationshipType
.CONGRUENT_TO(), taxaToSave
, id
, RedListUtil
.TAXON_CHECKLISTE_NAMESPACE
, false, true, state
);
147 //E, W, K, AW, AO, R, O, S
148 addConceptRelation(relationE
, RedListUtil
.CLASSIFICATION_NAMESPACE_E
, taxonBase
, name
, taxaToSave
, id
, state
);
149 addConceptRelation(relationW
, RedListUtil
.CLASSIFICATION_NAMESPACE_W
, taxonBase
, name
, taxaToSave
, id
, state
);
150 addConceptRelation(relationK
, RedListUtil
.CLASSIFICATION_NAMESPACE_K
, taxonBase
, name
, taxaToSave
, id
, state
);
151 addConceptRelation(relationAW
, RedListUtil
.CLASSIFICATION_NAMESPACE_AW
, taxonBase
, name
, taxaToSave
, id
, state
);
152 addConceptRelation(relationAO
, RedListUtil
.CLASSIFICATION_NAMESPACE_AO
, taxonBase
, name
, taxaToSave
, id
, state
);
153 addConceptRelation(relationR
, RedListUtil
.CLASSIFICATION_NAMESPACE_R
, taxonBase
, name
, taxaToSave
, id
, state
);
154 addConceptRelation(relationO
, RedListUtil
.CLASSIFICATION_NAMESPACE_O
, taxonBase
, name
, taxaToSave
, id
, state
);
155 addConceptRelation(relationS
, RedListUtil
.CLASSIFICATION_NAMESPACE_S
, taxonBase
, name
, taxaToSave
, id
, state
);
157 //NOTE: the source has to be added after cloning or otherwise the clone would also get the source
158 ImportHelper
.setOriginalSource(taxonBase
, state
.getTransactionalSourceReference(), id
, RedListUtil
.TAXON_GESAMTLISTE_NAMESPACE
);
159 taxaToSave
.add(taxonBase
);
162 private void addConceptRelation(String relationString
, String classificationNamespace
, TaxonBase
<?
> taxonBase
, TaxonNameBase
<?
,?
> name
, Set
<TaxonBase
<?
>> taxaToSave
, long id
, RedListGefaesspflanzenImportState state
){
163 if(CdmUtils
.isNotBlank(relationString
) && !relationString
.equals(".")){
164 String substring
= relationString
.substring(relationString
.length()-1, relationString
.length());
165 TaxonRelationshipType taxonRelationshipTypeByKey
= new RedListGefaesspflanzenTransformer().getTaxonRelationshipTypeByKey(substring
);
166 if(taxonRelationshipTypeByKey
==null){
167 RedListUtil
.logMessage(id
, "Could not interpret relationship "+relationString
+" for taxon "+taxonBase
.generateTitle(), logger
);
169 //there is no type "included in" so we have to reverse the direction
170 if(substring
.equals("<")){
171 cloneTaxon(taxonBase
, name
, taxonRelationshipTypeByKey
, taxaToSave
, id
, classificationNamespace
, true, false, state
);
174 cloneTaxon(taxonBase
, name
, taxonRelationshipTypeByKey
, taxaToSave
, id
, classificationNamespace
, false, false, state
);
180 * <b>NOTE:</b> the {@link TaxonRelationshipType} passed as parameter is
181 * directed <b>from the clone</b> to the taxon.<br>
182 * This can be changed with parameter <i>reverseRelation</i>
184 private void cloneTaxon(TaxonBase
<?
> taxonBase
, TaxonNameBase
<?
, ?
> name
, TaxonRelationshipType relationFromCloneToTaxon
, Set
<TaxonBase
<?
>> taxaToSave
, long id
, String sourceNameSpace
, boolean reverseRelation
, boolean doubtful
, RedListGefaesspflanzenImportState state
){
185 TaxonBase
<?
> clone
= (TaxonBase
<?
>) taxonBase
.clone();
187 if(taxonBase
.isInstanceOf(Taxon
.class)){
188 TaxonRelationship taxonRelation
;
190 taxonRelation
= ((Taxon
) taxonBase
).addTaxonRelation((Taxon
) clone
, relationFromCloneToTaxon
, null, null);
193 taxonRelation
= ((Taxon
) clone
).addTaxonRelation((Taxon
) taxonBase
, relationFromCloneToTaxon
, null, null);
195 taxonRelation
.setDoubtful(doubtful
);
197 ImportHelper
.setOriginalSource(clone
, state
.getTransactionalSourceReference(), id
, sourceNameSpace
);
198 taxaToSave
.add(clone
);
201 private TaxonBase
<?
> importTaxon(ResultSet rs
, NonViralName
<?
> name
) throws SQLException
{
203 long id
= rs
.getLong(RedListUtil
.NAMNR
);
204 String taxNameString
= rs
.getString(RedListUtil
.TAXNAME
);
205 String gueltString
= rs
.getString(RedListUtil
.GUELT
);
206 String trivialString
= rs
.getString(RedListUtil
.TRIVIAL
);
207 String authorBasiString
= rs
.getString(RedListUtil
.AUTOR_BASI
);
208 String hybString
= rs
.getString(RedListUtil
.HYB
);
210 TaxonBase
<?
> taxonBase
= null;
211 if(authorBasiString
.trim().contains(RedListUtil
.AUCT
)){
212 taxonBase
= Taxon
.NewInstance(name
, null);
213 taxonBase
.setAppendedPhrase(RedListUtil
.AUCT
);
215 else if(gueltString
.equals(RedListUtil
.GUELT_ACCEPTED_TAXON
)){
216 taxonBase
= Taxon
.NewInstance(name
, null);
218 else if(gueltString
.equals(RedListUtil
.GUELT_SYNONYM
) || gueltString
.equals(RedListUtil
.GUELT_BASIONYM
)){
219 taxonBase
= Synonym
.NewInstance(name
, null);
226 if(taxonBase
.isInstanceOf(Taxon
.class) && trivialString
!=null){
227 Taxon taxon
= HibernateProxyHelper
.deproxy(taxonBase
, Taxon
.class);
228 TaxonDescription description
= TaxonDescription
.NewInstance(taxon
);
229 description
.addElement(CommonTaxonName
.NewInstance(trivialString
, Language
.getDefaultLanguage()));
232 //check taxon name consistency
233 checkTaxonNameConsistency(id
, taxNameString
, hybString
, taxonBase
);
237 private void importAuthors(RedListGefaesspflanzenImportState state
, ResultSet rs
, NonViralName
<?
> name
) throws SQLException
{
239 long id
= rs
.getLong(RedListUtil
.NAMNR
);
240 String nomZusatzString
= rs
.getString(RedListUtil
.NOM_ZUSATZ
);
241 String taxZusatzString
= rs
.getString(RedListUtil
.TAX_ZUSATZ
);
242 String zusatzString
= rs
.getString(RedListUtil
.ZUSATZ
);
243 String authorKombString
= rs
.getString(RedListUtil
.AUTOR_KOMB
);
244 String authorBasiString
= rs
.getString(RedListUtil
.AUTOR_BASI
);
247 if(authorKombString
.contains(RedListUtil
.EX
)){
248 //TODO: what happens with multiple ex authors??
249 String
[] kombSplit
= authorKombString
.split(RedListUtil
.EX
);
250 if(kombSplit
.length
!=2){
251 RedListUtil
.logMessage(id
, "Multiple ex combination authors found", logger
);
253 for (int i
= 0; i
< kombSplit
.length
; i
++) {
255 //first author is ex author
256 TeamOrPersonBase
<?
> authorKomb
= (TeamOrPersonBase
<?
>) state
.getRelatedObject(RedListUtil
.AUTHOR_NAMESPACE
, kombSplit
[i
]);
257 name
.setExCombinationAuthorship(authorKomb
);
260 TeamOrPersonBase
<?
> authorKomb
= (TeamOrPersonBase
<?
>) state
.getRelatedObject(RedListUtil
.AUTHOR_NAMESPACE
, kombSplit
[i
]);
261 name
.setCombinationAuthorship(authorKomb
);
265 else if(authorKombString
.trim().contains(RedListUtil
.AUCT
)){
266 RedListUtil
.logMessage(id
, "AUCT information in "+RedListUtil
.AUTOR_KOMB
+" column", logger
);
268 else if(CdmUtils
.isNotBlank(authorKombString
)){
269 TeamOrPersonBase
<?
> authorKomb
= (TeamOrPersonBase
<?
>) state
.getRelatedObject(RedListUtil
.AUTHOR_NAMESPACE
, authorKombString
);
270 name
.setCombinationAuthorship(authorKomb
);
273 if(authorBasiString
.contains(RedListUtil
.EX
)){
274 String
[] basiSplit
= authorBasiString
.split(RedListUtil
.EX
);
275 for (int i
= 0; i
< basiSplit
.length
; i
++) {
276 if(basiSplit
.length
!=2){
277 RedListUtil
.logMessage(id
, "Multiple ex basionymn authors found", logger
);
280 TeamOrPersonBase
<?
> authorBasi
= (TeamOrPersonBase
<?
>) state
.getRelatedObject(RedListUtil
.AUTHOR_NAMESPACE
, basiSplit
[i
]);
281 if(CdmUtils
.isBlank(authorKombString
)){
282 name
.setExCombinationAuthorship(authorBasi
);
285 name
.setExBasionymAuthorship(authorBasi
);
289 TeamOrPersonBase
<?
> authorBasi
= (TeamOrPersonBase
<?
>) state
.getRelatedObject(RedListUtil
.AUTHOR_NAMESPACE
, basiSplit
[i
]);
290 if(CdmUtils
.isBlank(authorKombString
)){
291 name
.setCombinationAuthorship(authorBasi
);
294 name
.setBasionymAuthorship(authorBasi
);
299 else if(CdmUtils
.isNotBlank(authorBasiString
)){
300 //this seems to be a convention in the source database: When there is only a single author then only the "AUTOR_BASI" column is used
301 TeamOrPersonBase
<?
> authorBasi
= (TeamOrPersonBase
<?
>) state
.getRelatedObject(RedListUtil
.AUTHOR_NAMESPACE
, authorBasiString
);
302 if(CdmUtils
.isBlank(authorKombString
)){
303 name
.setCombinationAuthorship(authorBasi
);
306 name
.setBasionymAuthorship(authorBasi
);
310 //check authorship consistency
311 String authorString
= rs
.getString(RedListUtil
.AUTOR
);
312 String authorshipCache
= name
.getAuthorshipCache();
313 checkAuthorShipConsistency(id
, nomZusatzString
, taxZusatzString
, zusatzString
, authorString
, authorshipCache
);
316 private NonViralName
<?
> importName(RedListGefaesspflanzenImportState state
, ResultSet rs
, Set
<TaxonNameBase
<?
,?
>> namesToSave
) throws SQLException
{
318 long id
= rs
.getLong(RedListUtil
.NAMNR
);
319 String taxNameString
= rs
.getString(RedListUtil
.TAXNAME
);
320 String rangString
= rs
.getString(RedListUtil
.RANG
);
321 String ep1String
= rs
.getString(RedListUtil
.EPI1
);
322 String ep2String
= rs
.getString(RedListUtil
.EPI2
);
323 String ep3String
= rs
.getString(RedListUtil
.EPI3
);
324 String nomZusatzString
= rs
.getString(RedListUtil
.NOM_ZUSATZ
);
325 String hybString
= rs
.getString(RedListUtil
.HYB
);
327 if(CdmUtils
.isBlank(taxNameString
) && CdmUtils
.isBlank(ep1String
)){
328 RedListUtil
.logMessage(id
, "No name found!", logger
);
331 Rank rank
= makeRank(id
, state
, rangString
, ep3String
!=null);
332 NonViralName
<?
> name
= BotanicalName
.NewInstance(rank
);
334 //ep1 should always be present
335 if(CdmUtils
.isBlank(ep1String
)){
336 RedListUtil
.logMessage(id
, RedListUtil
.EPI1
+" is empty!", logger
);
338 name
.setGenusOrUninomial(ep1String
);
339 if(CdmUtils
.isNotBlank(ep2String
)){
340 name
.setSpecificEpithet(ep2String
);
342 if(CdmUtils
.isNotBlank(ep3String
)){
343 name
.setInfraSpecificEpithet(ep3String
);
345 //nomenclatural status
346 if(CdmUtils
.isNotBlank(nomZusatzString
)){
347 NomenclaturalStatusType status
= makeNomenclaturalStatus(id
, state
, nomZusatzString
);
349 name
.addStatus(NomenclaturalStatus
.NewInstance(status
));
353 if(CdmUtils
.isNotBlank(hybString
)){
354 if(hybString
.equals(RedListUtil
.HYB_X
)){
355 name
.setBinomHybrid(true);
357 else if(hybString
.equals(RedListUtil
.HYB_G
)){
358 name
.setMonomHybrid(true);
360 else if(hybString
.equals(RedListUtil
.HYB_XF
)){
361 name
.setHybridFormula(true);
362 if(ep1String
.contains(RedListUtil
.HYB_SIGN
)){
363 RedListUtil
.logMessage(id
, "EPI1 has hybrid signs but with flag: "+RedListUtil
.HYB_XF
, logger
);
365 else if(ep2String
.contains(RedListUtil
.HYB_SIGN
)){
366 String
[] split
= ep2String
.split(RedListUtil
.HYB_SIGN
);
368 RedListUtil
.logMessage(id
, "Multiple hybrid signs found in "+ep2String
, logger
);
370 String hybridFormula1
= ep1String
+" "+split
[0].trim();
371 String hybridFormula2
= ep1String
+" "+split
[1].trim();
372 if(CdmUtils
.isNotBlank(ep3String
)){
373 hybridFormula1
+= " "+ep3String
;
374 hybridFormula2
+= " "+ep3String
;
376 String fullFormula
= hybridFormula1
+" "+RedListUtil
.HYB_SIGN
+" "+hybridFormula2
;
377 name
= NonViralNameParserImpl
.NewInstance().parseFullName(fullFormula
);
379 else if(ep3String
.contains(RedListUtil
.HYB_SIGN
)){
380 String
[] split
= ep3String
.split(RedListUtil
.HYB_SIGN
);
382 RedListUtil
.logMessage(id
, "Multiple hybrid signs found in "+ep3String
, logger
);
384 String hybridFormula1
= ep1String
+" "+ep2String
+" "+split
[0];
385 String hybridFormula2
= ep1String
+" "+ep2String
+" "+split
[1];
386 String fullFormula
= hybridFormula1
+" "+RedListUtil
.HYB_SIGN
+" "+hybridFormula2
;
387 name
= NonViralNameParserImpl
.NewInstance().parseFullName(fullFormula
);
390 else if(hybString
.equals(RedListUtil
.HYB_N
)){
391 name
= NonViralNameParserImpl
.NewInstance().parseFullName(ep1String
+" "+ep2String
+" nothosubsp. "+ep3String
);
393 else if(hybString
.equals(RedListUtil
.HYB_GF
)){
394 if(ep1String
.contains(RedListUtil
.HYB_SIGN
)){
395 name
= NonViralNameParserImpl
.NewInstance().parseFullName(ep1String
);
398 RedListUtil
.logMessage(id
, "HYB is "+hybString
+" but "+RedListUtil
.HYB
+" does not contain "+RedListUtil
.HYB_SIGN
, logger
);
402 logger
.error("HYB value "+hybString
+" not yet handled");
406 ImportHelper
.setOriginalSource(name
, state
.getTransactionalSourceReference(), id
, RedListUtil
.NAME_NAMESPACE
);
408 namesToSave
.add(name
);
412 private void checkAuthorShipConsistency(long id
, String nomZusatzString
, String taxZusatzString
,
413 String zusatzString
, String authorString
, String authorshipCache
) {
414 if(CdmUtils
.isNotBlank(zusatzString
)){
415 authorString
= authorString
.replace(", "+zusatzString
, "");
417 if(CdmUtils
.isNotBlank(nomZusatzString
)){
418 authorString
= authorString
.replace(", "+nomZusatzString
, "");
420 if(CdmUtils
.isNotBlank(taxZusatzString
)){
421 authorString
= authorString
.replace(", "+taxZusatzString
, "");
423 if(authorString
.equals(RedListUtil
.AUCT
)){
426 if(!authorString
.equals(authorshipCache
)){
427 RedListUtil
.logMessage(id
, "Authorship inconsistent! name.authorhshipCache <-> Column "+RedListUtil
.AUTOR
+": "+authorshipCache
+" <-> "+authorString
, logger
);
431 private void checkTaxonNameConsistency(long id
, String taxNameString
, String hybString
, TaxonBase
<?
> taxonBase
) {
432 if(hybString
.equals(RedListUtil
.HYB_XF
)){
433 if(HibernateProxyHelper
.deproxy(taxonBase
.getName(),NonViralName
.class).getHybridChildRelations().isEmpty()){
434 RedListUtil
.logMessage(id
, "Hybrid name but no hybrid child relations", logger
);
441 String nameCache
= HibernateProxyHelper
.deproxy(taxonBase
.getName(), NonViralName
.class).getNameCache().trim();
443 if(taxNameString
.endsWith("agg.")){
444 taxNameString
= taxNameString
.replace("agg.", "aggr.");
446 if(hybString
.equals(RedListUtil
.HYB_X
)){
447 taxNameString
= taxNameString
.replace(RedListUtil
.HYB_SIGN
+" ", RedListUtil
.HYB_SIGN
);//hybrid sign has no space after it in titleCache for binomial hybrids
449 if(taxNameString
.endsWith("- Gruppe")){
450 taxNameString
.replaceAll("- Gruppe", "species group");
452 if(taxNameString
.endsWith("- group")){
453 taxNameString
.replaceAll("- group", "species group");
455 taxNameString
= taxNameString
.replace("[ranglos]", "[unranked]");
456 if(!taxNameString
.trim().equals(nameCache
)){
457 RedListUtil
.logMessage(id
, "Taxon name inconsistent! taxon.titleCache <-> Column "+RedListUtil
.TAXNAME
+": "+nameCache
+" <-> "+taxNameString
, logger
);
461 private Rank
makeRank(long id
, RedListGefaesspflanzenImportState state
, String rankStr
, boolean hasSpecificEpithet
) {
464 if(rankStr
.equals("ORA")){
465 //special handling for ORA because of two possibilities
466 if(hasSpecificEpithet
){
467 return Rank
.UNRANKED_INFRASPECIFIC();
470 return Rank
.UNRANKED_INFRAGENERIC();
474 rank
= state
.getTransformer().getRankByKey(rankStr
);
476 } catch (UndefinedTransformerMethodException e
) {
480 RedListUtil
.logMessage(id
, rankStr
+" could not be associated to a known rank.", logger
);
485 private NomenclaturalStatusType
makeNomenclaturalStatus(long id
, RedListGefaesspflanzenImportState state
, String nomZusatzString
) {
486 NomenclaturalStatusType status
= null;
488 status
= state
.getTransformer().getNomenclaturalStatusByKey(nomZusatzString
);
489 } catch (UndefinedTransformerMethodException e
) {
493 RedListUtil
.logMessage(id
, nomZusatzString
+" could not be associated to a known nomenclatural status.", logger
);
501 public Map
<Object
, Map
<String
, ?
extends CdmBase
>> getRelatedObjectsForPartition(ResultSet rs
,
502 RedListGefaesspflanzenImportState state
) {
503 Map
<Object
, Map
<String
, ?
extends CdmBase
>> result
= new HashMap
<>();
504 Map
<String
, AgentBase
<?
>> authorMap
= new HashMap
<String
, AgentBase
<?
>>();
508 String authorKombString
= rs
.getString(RedListUtil
.AUTOR_KOMB
);
510 if(authorKombString
.contains(RedListUtil
.EX
)){
511 String
[] kombSplit
= authorKombString
.split(RedListUtil
.EX
);
512 for (int i
= 0; i
< kombSplit
.length
; i
++) {
513 if(!authorMap
.containsKey(kombSplit
[i
])){
514 authorMap
.put(kombSplit
[i
], getAgentService().load(state
.getAuthorMap().get(kombSplit
[i
])));
518 else if(CdmUtils
.isNotBlank(authorKombString
) && !authorMap
.containsKey(authorKombString
)){
519 authorMap
.put(authorKombString
, getAgentService().load(state
.getAuthorMap().get(authorKombString
)));
522 String authorBasiString
= rs
.getString(RedListUtil
.AUTOR_BASI
);
524 if(authorBasiString
.contains(RedListUtil
.EX
)){
525 String
[] basiSplit
= authorBasiString
.split(RedListUtil
.EX
);
526 for (int i
= 0; i
< basiSplit
.length
; i
++) {
527 if(!authorMap
.containsKey(basiSplit
[i
])){
528 authorMap
.put(basiSplit
[i
], getAgentService().load(state
.getAuthorMap().get(basiSplit
[i
])));
532 else if(CdmUtils
.isNotBlank(authorBasiString
) && !authorMap
.containsKey(authorBasiString
)){
533 authorMap
.put(authorBasiString
, getAgentService().load(state
.getAuthorMap().get(authorBasiString
)));
536 } catch (SQLException e
) {
539 result
.put(RedListUtil
.AUTHOR_NAMESPACE
, authorMap
);
545 protected boolean doCheck(RedListGefaesspflanzenImportState state
) {
550 protected boolean isIgnore(RedListGefaesspflanzenImportState state
) {