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
.caryo
;
12 import java
.sql
.ResultSet
;
13 import java
.sql
.SQLException
;
14 import java
.util
.HashMap
;
15 import java
.util
.HashSet
;
19 import org
.apache
.commons
.lang
.StringUtils
;
20 import org
.apache
.log4j
.Logger
;
21 import org
.springframework
.stereotype
.Component
;
23 import eu
.etaxonomy
.cdm
.io
.common
.DbImportBase
;
24 import eu
.etaxonomy
.cdm
.io
.common
.ResultSetPartitioner
;
25 import eu
.etaxonomy
.cdm
.io
.common
.Source
;
26 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
27 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
28 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
29 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
30 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
31 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
32 import eu
.etaxonomy
.cdm
.model
.common
.OriginalSourceType
;
33 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
34 import eu
.etaxonomy
.cdm
.model
.name
.BotanicalName
;
35 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
36 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
37 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
38 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
39 import eu
.etaxonomy
.cdm
.model
.reference
.IArticle
;
40 import eu
.etaxonomy
.cdm
.model
.reference
.IBook
;
41 import eu
.etaxonomy
.cdm
.model
.reference
.IBookSection
;
42 import eu
.etaxonomy
.cdm
.model
.reference
.IJournal
;
43 import eu
.etaxonomy
.cdm
.model
.reference
.INomenclaturalReference
;
44 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
45 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
46 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
47 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
48 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationshipType
;
49 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
50 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
51 import eu
.etaxonomy
.cdm
.strategy
.exceptions
.UnknownCdmTypeException
;
59 public class CaryoTaxonImport
extends DbImportBase
<CaryoImportState
, CaryoImportConfigurator
> {
60 private static final Logger logger
= Logger
.getLogger(CaryoTaxonImport
.class);
62 private final int modCount
= 10000;
63 private static final String pluralString
= "taxa";
64 private static final String dbTableName
= "CARYOPHYLLALES";
68 private final Map
<String
, Taxon
> familyMap
= new HashMap
<String
, Taxon
>();
69 private final Map
<String
, Person
> personMap
= new HashMap
<String
, Person
>();
70 private final Map
<String
, Team
> teamMap
= new HashMap
<String
, Team
>();
71 private final Map
<String
, TeamOrPersonBase
> inAuthorMap
= new HashMap
<String
, TeamOrPersonBase
>();
72 private final Map
<String
, IJournal
> journalMap
= new HashMap
<String
, IJournal
>();
73 private final Map
<String
, IBook
> bookMap
= new HashMap
<String
, IBook
>();
76 private Classification classification
;
80 public CaryoTaxonImport(){
81 super(dbTableName
, pluralString
);
88 * @see eu.etaxonomy.cdm.io.common.DbImportBase#getIdQuery(eu.etaxonomy.cdm.io.common.DbImportStateBase)
91 protected String
getIdQuery(CaryoImportState state
) {
92 String strRecordQuery
=
94 " FROM " + dbTableName
+
96 return strRecordQuery
;
101 * @see eu.etaxonomy.cdm.io.common.DbImportBase#getRecordQuery(eu.etaxonomy.cdm.io.common.DbImportConfiguratorBase)
104 protected String
getRecordQuery(CaryoImportConfigurator config
) {
105 String strRecordQuery
=
107 " FROM " + getTableName() + " t " +
108 " WHERE ( t.ID IN (" + ID_LIST_TOKEN
+ ") )";
109 return strRecordQuery
;
115 * @see eu.etaxonomy.cdm.io.globis.GlobisImportBase#doPartition(eu.etaxonomy.cdm.io.common.ResultSetPartitioner, eu.etaxonomy.cdm.io.globis.GlobisImportState)
118 public boolean doPartition(ResultSetPartitioner partitioner
, CaryoImportState state
) {
119 boolean success
= true;
121 Set
<TaxonBase
> objectsToSave
= new HashSet
<TaxonBase
>();
123 // Map<String, Taxon> taxonMap = (Map<String, Taxon>) partitioner.getObjectMap(TAXON_NAMESPACE);
126 classification
= getClassification(state
);
135 ResultSet rs
= partitioner
.getResultSet();
138 Reference
<?
> sec
= state
.getTransactionalSourceReference();
143 if ((i
++ % modCount
) == 0 && i
!= 1 ){ logger
.info(pluralString
+ " handled: " + (i
-1));}
145 Integer id
= rs
.getInt("Id");
146 Integer taxonId
= rs
.getInt("NCUGenID");
147 String genus
= rs
.getString("Genus");
148 String family
= rs
.getString("Family");
149 String pages
= rs
.getString("Pages");
150 String autoren
= rs
.getString("Autoren");
151 String typeStr
= rs
.getString("Type");
152 String nomStatusStr
= rs
.getString("NomenclaturalStatus");
153 String basioStr
= rs
.getString("Basionym");
159 // ,[OriginalCitation]
162 BotanicalName name
= BotanicalName
.NewInstance(Rank
.GENUS());
163 name
.setGenusOrUninomial(genus
);
164 makeAuthors(name
, autoren
, id
);
165 INomenclaturalReference nomRef
= makeNomRef(state
, rs
, id
);
166 name
.setNomenclaturalReference(nomRef
);
167 name
.setNomenclaturalMicroReference(pages
);
168 makeStatus(name
, nomStatusStr
, id
);
171 Taxon taxon
= Taxon
.NewInstance(name
, state
.getTransactionalSourceReference());
172 handleTypes(state
, rs
, taxon
, typeStr
, id
);
173 handleBasionym(state
, rs
, taxon
, basioStr
, id
);
175 Taxon parent
= familyMap
.get(family
);
177 classification
.addParentChild(parent
, taxon
, sec
, null);
179 taxon
.addSource(OriginalSourceType
.Import
, String
.valueOf(taxonId
), "NCUGenID", sec
, null);
183 objectsToSave
.add(taxon
);
187 logger
.warn(pluralString
+ " to save: " + objectsToSave
.size());
188 getTaxonService().save(objectsToSave
);
191 } catch (SQLException e
) {
192 logger
.error("SQLException:" + e
);
197 private void handleBasionym(CaryoImportState state
, ResultSet rs
, Taxon taxon
, String basioStr
, Integer id
) {
198 if (StringUtils
.isNotBlank(basioStr
)){
199 BotanicalName name
= (BotanicalName
) taxon
.getName();
200 BotanicalName basionym
= BotanicalName
.PARSED_REFERENCE(basioStr
);
201 if (basionym
.hasProblem()){
202 logger
.warn("Problem when parsing basionym ("+id
+"): " + basioStr
);
204 name
.addBasionym(basionym
);
205 Synonym syn
= Synonym
.NewInstance(basionym
, state
.getTransactionalSourceReference());
206 taxon
.addSynonym(syn
, SynonymRelationshipType
.HOMOTYPIC_SYNONYM_OF());
207 getTaxonService().save(syn
);
215 private void handleTypes(CaryoImportState state
, ResultSet rs
, Taxon taxon
, String origType
, Integer id
) {
216 NameTypeDesignation desig
= NameTypeDesignation
.NewInstance();
217 String type
= origType
;
218 if (StringUtils
.isBlank(type
) || "to be designated".equalsIgnoreCase(type
)){
221 BotanicalName name
= (BotanicalName
)taxon
.getName();
222 BotanicalName typeName
= BotanicalName
.NewInstance(Rank
.SPECIES());
223 if ("not designated".equalsIgnoreCase(type
)){
224 desig
.setNotDesignated(true);
226 String genus
= name
.getGenusOrUninomial();
227 typeName
.setGenusOrUninomial(genus
);
228 if (! type
.startsWith(genus
.substring(0,1) + ". " )){
229 int i
= type
.indexOf(" ");
230 String genusOrig
= type
.substring(0, i
);
231 logger
.info("First genus letter not recognized: " + genusOrig
+ "-" + genus
+ ":"+ id
);
232 typeName
.setGenusOrUninomial(genusOrig
);
233 type
= type
.substring(i
+ 1).trim();
235 type
= type
.substring(3);
237 int i
= type
.indexOf(" ");
239 logger
.warn("No space: " + type
+"; " + id
);
241 String species
= type
.substring(0, i
);
242 typeName
.setSpecificEpithet(species
);
243 type
= type
.substring(i
+ 1).trim();
245 int posBracket
= type
.indexOf("(", 2);
247 String bracket
= type
.substring(posBracket
);
248 // logger.warn("Type has bracket("+id+"): " + bracket);
249 taxon
.addAnnotation(Annotation
.NewInstance("Type-bracket: " + bracket
, Language
.DEFAULT()));
250 type
= type
.substring(0, posBracket
).trim();
252 Taxon speciesTaxon
= Taxon
.NewInstance(typeName
, state
.getTransactionalSourceReference());
253 classification
.addParentChild(taxon
, speciesTaxon
, null, null);
255 type
= makeTypeNomStatus(typeName
, type
);
258 makeAuthors(typeName
, type
, id
);
261 desig
.setTypeName(typeName
);
263 name
.addTypeDesignation(desig
, true);
272 private String
makeTypeNomStatus(BotanicalName typeName
, String type
) {
273 if (type
.endsWith(", nom. illeg.")){
274 type
= type
.replaceAll(", nom. illeg.", "");
275 typeName
.addStatus(NomenclaturalStatus
.NewInstance(NomenclaturalStatusType
.ILLEGITIMATE()));
283 private void makeStatus(BotanicalName name
, String nomStatusStr
, Integer id
) throws SQLException
{
284 // ,[NomenclaturalStatus]
286 if (StringUtils
.isNotBlank(nomStatusStr
)){
287 NomenclaturalStatusType nomStatusType
;
289 nomStatusType
= NomenclaturalStatusType
.getNomenclaturalStatusTypeByAbbreviation(nomStatusStr
, name
);
290 } catch (UnknownCdmTypeException e
) {
291 if (nomStatusStr
.startsWith("nom. rej. prop.")){
292 nomStatusType
= NomenclaturalStatusType
.REJECTED_PROP();
293 logger
.info("in favour not supported ("+id
+"): " + nomStatusStr
);
294 }else if (nomStatusStr
.startsWith("nom. rej. in favour")){
295 nomStatusType
= NomenclaturalStatusType
.REJECTED();
296 logger
.info("in favour not supported ("+id
+"): " + nomStatusStr
);
297 }else if (nomStatusStr
.startsWith("nom. cons. against")){
298 nomStatusType
= NomenclaturalStatusType
.CONSERVED();
299 logger
.info("against not supported ("+id
+"): " + nomStatusStr
);
300 }else if (nomStatusStr
.startsWith("nom. cons. prop. against")){
301 nomStatusType
= NomenclaturalStatusType
.CONSERVED_PROP();
302 logger
.info("against not supported ("+id
+"): " + nomStatusStr
);
304 logger
.warn("Unknown status type ("+id
+"): " + nomStatusStr
);
305 nomStatusType
= NomenclaturalStatusType
.DOUBTFUL();
309 NomenclaturalStatus status
= NomenclaturalStatus
.NewInstance(nomStatusType
);
310 name
.addStatus(status
);
318 private INomenclaturalReference
makeNomRef(CaryoImportState state
, ResultSet rs
, Integer id
) throws SQLException
{
319 INomenclaturalReference result
;
320 String periodicalTitle
= rs
.getString("PeriodicalTitle");
321 String volume
= rs
.getString("PeriodicalVolume");
322 String bookTitle
= rs
.getString("BookTitle");
323 String inAutorStr
= rs
.getString("InAutor");
324 String autorenStr
= rs
.getString("Autoren");
326 TeamOrPersonBase
<?
> author
= getNomRefAuthor(autorenStr
, id
);
327 if (StringUtils
.isNotBlank(periodicalTitle
)){
328 IJournal journal
= journalMap
.get(periodicalTitle
);
329 if (journal
== null){
330 logger
.warn("Journal not found: " + periodicalTitle
+ ";" + id
);
332 IArticle article
= ReferenceFactory
.newArticle();
333 article
.setInJournal(journal
);
334 article
.setVolume(volume
);
336 }else if (StringUtils
.isNotBlank(bookTitle
)){
337 IBook book
= bookMap
.get(bookTitle
);
338 if (inAutorStr
!= null){
339 IBookSection section
= ReferenceFactory
.newBookSection();
340 section
.setInBook(book
);
341 TeamOrPersonBase
<?
> inAuthor
= getInAuthor(inAutorStr
);
342 book
.setAuthorship(inAuthor
);
348 logger
.warn("No nomRef found: " + id
);
352 result
.setAuthorship(author
);
353 makeDate(state
, rs
, result
, id
);
358 private void makeDate(CaryoImportState state
, ResultSet rs
, INomenclaturalReference ref
, Integer id
) throws SQLException
{
359 TimePeriod tp
= TimePeriod
.NewInstance();
360 String pre1
= rs
.getString("DatePre1");
361 String pre2
= rs
.getString("DatePre2");
362 Float year1
= nullSafeFloat(rs
, "DateYear1");
363 Float year2
= nullSafeFloat(rs
, "DateYear2");
367 String modi1
= rs
.getString("DateModi1");
368 String modi2
= rs
.getString("DateModi2");
369 String date
= rs
.getString("Date");
371 tp
.setStartYear(year1
.intValue());
372 Integer
[] preDate1
= getDay(pre1
,id
);
373 // tp.setStartMonth(preDate1[1]);
374 // tp.setStartDay(preDate1[0]);
376 tp
.setEndYear(year2
.intValue());
378 Integer
[] preDate2
= getDay(pre2
, id
);
379 // tp.setEndMonth(preDate2[1]);
380 // tp.setEndDay(preDate2[0]);
382 // if (StringUtils.isNotBlank(modi1) || StringUtils.isNotBlank(modi2)){
383 // tp.setFreeText(date);
385 ref
.setDatePublished(tp
);
391 private Integer
[] getDay(String pre
, Integer id
) {
392 Integer
[] result
= new Integer
[2];
393 if (! StringUtils
.isBlank(pre
)){
395 String
[] split
= pre
.split("\\s");
397 if (split
.length
> 2){
398 logger
.warn("L > 2: " + pre
);
400 }else if(split
.length
== 2){
401 result
[0] = Integer
.valueOf(split
[0]);
407 if ("Jan".equalsIgnoreCase(monthStr
)){
409 }else if ("Feb".equalsIgnoreCase(monthStr
)){
411 }else if ("Mar".equalsIgnoreCase(monthStr
)){
413 }else if ("Apr".equalsIgnoreCase(monthStr
)){
415 }else if ("Mai".equalsIgnoreCase(monthStr
)){
417 }else if ("Jun".equalsIgnoreCase(monthStr
)){
419 }else if ("Jul".equalsIgnoreCase(monthStr
)){
421 }else if ("Aug".equalsIgnoreCase(monthStr
)){
423 }else if ("Sep".equalsIgnoreCase(monthStr
)){
425 }else if ("Oct".equalsIgnoreCase(monthStr
)){
427 }else if ("Nov".equalsIgnoreCase(monthStr
)){
429 }else if ("Dec".equalsIgnoreCase(monthStr
)){
432 logger
.warn("Unknown month ("+id
+"): " + monthStr
);
436 } catch (Exception e
) {
444 private TeamOrPersonBase
<?
> getInAuthor(String inAutorStr
) {
445 if (StringUtils
.isBlank(inAutorStr
)){
448 TeamOrPersonBase
<?
> inAuthor
= inAuthorMap
.get(inAutorStr
);
449 if (inAuthor
== null){
450 logger
.warn("Inauthor not found: " + inAutorStr
);
457 private void makeAuthors(BotanicalName name
, String autoren
, Integer id
) {
458 String
[] parsedAuthorTeams
= getParsedAuthors(autoren
);
459 name
.setBasionymAuthorship(getTeam(parsedAuthorTeams
[0], id
));
460 name
.setExBasionymAuthorship(getTeam(parsedAuthorTeams
[1], id
));
461 name
.setCombinationAuthorship(getTeam(parsedAuthorTeams
[2], id
));
462 name
.setExCombinationAuthorship(getTeam(parsedAuthorTeams
[3], id
));
466 private TeamOrPersonBase
<?
> getNomRefAuthor(String authorStr
, Integer id
) {
467 String
[] parsedAuthorTeams
= getParsedAuthors(authorStr
);
468 TeamOrPersonBase
<?
> team
= getTeam(parsedAuthorTeams
[2], id
);
473 private TeamOrPersonBase
<?
> getTeam(String author
, Integer id
) {
474 if (StringUtils
.isBlank(author
)){
477 TeamOrPersonBase
<?
> result
;
478 if (personMap
.get(author
) != null){
479 result
= personMap
.get(author
);
481 result
= teamMap
.get(author
);
484 logger
.warn("Team not found ("+id
+"): " + author
);
490 private void doInAuthors(CaryoImportState state
) throws SQLException
{
491 Source source
= state
.getConfig().getSource();
492 String sql
= "SELECT DISTINCT inAutor FROM " + getTableName() + " WHERE inAutor IS NOT NULL AND inAutor <> '' ";
493 ResultSet rs
= source
.getResultSet(sql
);
495 String inAutorStr
= rs
.getString("inAutor");
496 if (inAuthorMap
.get(inAutorStr
) == null){
497 Team team
= Team
.NewTitledInstance(inAutorStr
, inAutorStr
);
499 inAuthorMap
.put(inAutorStr
, team
);
500 getAgentService().save(team
);
507 private void doAuthors(CaryoImportState state
) throws SQLException
{
508 Source source
= state
.getConfig().getSource();
509 String sql
= "SELECT DISTINCT Autoren FROM " + getTableName() + " WHERE Autoren IS NOT NULL AND Autoren <> '' ";
510 ResultSet rs
= source
.getResultSet(sql
);
511 doTypeAuthors(state
);
513 String autorenStr
= rs
.getString("Autoren");
514 String
[] parsedAuthorTeams
= getParsedAuthors(autorenStr
);
515 for (String teamStr
: parsedAuthorTeams
){
524 private void doTypeAuthors(CaryoImportState state
) {
525 doTeam("Dinter & Derenb.");
531 doTeam("Dinter & A. Berger");
533 doTeam("Dinter & Berger");
535 doTeam("J. C. Wendl.");
536 doTeam("Baker & Clarke");
547 doTeam("Moq. & Coss.");
548 doTeam("Durieu & Moq.");
549 doTeam("Lag. & Rodrigues");
550 doTeam("M. Martens & Galeotti");
552 doTeam("Aitch. & Hemsl.");
553 doTeam("Ikonn.-Gal.");
569 doTeam("Werderm. & Backeb.");
574 doTeam("Rol.-Goss.");
576 doTeam("Andreae & Backeberg");
579 doTeam("Backeb. & Voll");
580 doTeam("Engelm. & Bigelow");
581 doTeam("Pfeiffer & Otto");
582 doTeam("Humb. & Bonpl.");
587 doTeam("Regel & Schmalh.");
589 doTeam("Pax & K. Hoff.");
594 doTeam("Schott, Nymann & Kotschy");
595 doTeam("Boiss. & Buhse");
597 doTeam("Coss. & Germ.");
599 doTeam("Pax & Hoffm.");
615 protected void doTeam(String teamStr
) {
616 if (StringUtils
.isBlank(teamStr
)){
619 String
[] parsedTeam
= parseTeam(teamStr
);
620 if (parsedTeam
.length
== 1){
621 savePerson(parsedTeam
[0]);
623 Team team
= teamMap
.get(teamStr
);
625 team
= Team
.NewInstance();
626 for (String member
: parsedTeam
){
627 Person person
= savePerson(member
);
628 team
.addTeamMember(person
);
630 teamMap
.put(teamStr
, team
);
631 getAgentService().saveOrUpdate(team
);
637 private String
[] parseTeam(String teamStr
) {
638 String
[] split
= teamStr
.split("[&,]");
639 for (int i
= 0; i
< split
.length
; i
++){
640 split
[i
] = split
[i
].trim();
645 private Person
savePerson(String personStr
) {
646 Person result
= personMap
.get(personStr
);
647 if (result
== null ){
648 Person person
= Person
.NewTitledInstance(personStr
);
649 personMap
.put(personStr
, person
);
650 getAgentService().save(person
);
659 private String
[] getParsedAuthors(String autorenStr
) {
660 String
[] result
= new String
[4];
661 String basioFull
= null;
664 String
[] split
= autorenStr
.split("\\)");
665 if (split
.length
> 1){
666 basioFull
= split
[0].replace("(", "").trim();
667 origFull
= split
[1].trim();
669 origFull
= split
[0].trim();
671 String
[] splitBasio
= splitExAuthors(basioFull
);
672 String
[] splitOrig
= splitExAuthors(origFull
);
673 result
[0] = splitBasio
[0];
674 result
[1] = splitBasio
[1];
675 result
[2] = splitOrig
[0];
676 result
[3] = splitOrig
[1];
684 private String
[] splitExAuthors(String author
) {
685 String
[] result
= new String
[2];
687 String
[] split
= author
.split("\\sex\\s");
688 if (split
.length
> 1){
689 result
[0] = split
[1].trim();
690 result
[1] = split
[0].trim();
692 result
[0] = split
[0].trim();
701 private void doBooks(CaryoImportState state
) throws SQLException
{
702 Source source
= state
.getConfig().getSource();
703 String sql
= "SELECT DISTINCT BookTitle FROM " + getTableName() + " WHERE BookTitle IS NOT NULL AND BookTitle <> '' ";
704 ResultSet rs
= source
.getResultSet(sql
);
706 String bookStr
= rs
.getString("BookTitle");
707 if (bookMap
.get(bookStr
) == null ){
709 IBook book
= ReferenceFactory
.newBook();
711 book
.setTitle(bookStr
);
713 bookMap
.put(bookStr
, book
);
714 getReferenceService().save((Reference
<?
>)book
);
722 private void doJournals(CaryoImportState state
) throws SQLException
{
723 Source source
= state
.getConfig().getSource();
724 String sqlPeriodical
= "SELECT DISTINCT PeriodicalTitle FROM " + getTableName() + " WHERE PeriodicalTitle IS NOT NULL AND PeriodicalTitle <> '' ";
725 ResultSet rs
= source
.getResultSet(sqlPeriodical
);
727 String periodical
= rs
.getString("PeriodicalTitle");
728 if (journalMap
.get(periodical
) == null ){
730 Reference
<?
> journal
= ReferenceFactory
.newJournal();
732 journal
.setTitle(periodical
);
734 journalMap
.put(periodical
, journal
);
735 getReferenceService().save(journal
);
743 private void doFamilies(CaryoImportState state
) throws SQLException
{
744 Source source
= state
.getConfig().getSource();
745 String sqlFamily
= "SELECT DISTINCT Family FROM " + getTableName() + " WHERE Family IS NOT NULL";
746 ResultSet rs
= source
.getResultSet(sqlFamily
);
748 String family
= rs
.getString("family");
749 if (familyMap
.get(family
) == null ){
751 BotanicalName name
= BotanicalName
.NewInstance(Rank
.FAMILY());
752 name
.setGenusOrUninomial(family
);
753 Taxon taxon
= Taxon
.NewInstance(name
, state
.getTransactionalSourceReference());
754 classification
.addChildTaxon(taxon
, null, null);
755 // taxon.addSource(id, idNamespace, citation, null);
757 familyMap
.put(family
, taxon
);
758 getTaxonService().save(taxon
);
764 private Classification
getClassification(CaryoImportState state
) {
765 if (this.classification
== null){
766 String name
= state
.getConfig().getClassificationName();
767 Reference
<?
> reference
= state
.getTransactionalSourceReference();
768 this.classification
= Classification
.NewInstance(name
, reference
, Language
.DEFAULT());
769 if (state
.getConfig().getClassificationUuid() != null){
770 classification
.setUuid(state
.getConfig().getClassificationUuid());
772 getClassificationService().save(classification
);
774 return this.classification
;
782 public Map
<Object
, Map
<String
, ?
extends CdmBase
>> getRelatedObjectsForPartition(ResultSet rs
, CaryoImportState state
) {
785 // Set<String> idSet;
786 Map
<Object
, Map
<String
, ?
extends CdmBase
>> result
= new HashMap
<Object
, Map
<String
, ?
extends CdmBase
>>();
788 // Set<String> taxonIdSet = new HashSet<String>();
790 // while (rs.next()){
791 //// handleForeignKey(rs, taxonIdSet, "taxonId");
795 // nameSpace = TAXON_NAMESPACE;
796 // cdmClass = Taxon.class;
797 // idSet = taxonIdSet;
798 // Map<String, Taxon> objectMap = (Map<String, Taxon>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
799 // result.put(nameSpace, objectMap);
802 // } catch (SQLException e) {
803 // throw new RuntimeException(e);
809 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IImportConfigurator)
812 protected boolean doCheck(CaryoImportState state
){
818 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator)
821 protected boolean isIgnore(CaryoImportState state
){
822 return ! state
.getConfig().isDoTaxa();