Project

General

Profile

Revision 164a7e77

ID164a7e77b92f4d2e2e03036c0fd532e2970a78a4
Parent 2fb0c44a
Child 54566cb4

Added by Andreas Müller over 3 years ago

ref #6557 first bogotaChecklist import version

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/bogota/BogotaChecklistActivator.java
1
/**
2
* Copyright (C) 2016 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
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.
8
*/
9
package eu.etaxonomy.cdm.app.bogota;
10

  
11
import java.net.URI;
12
import java.util.UUID;
13

  
14
import org.apache.log4j.Logger;
15

  
16
import eu.etaxonomy.cdm.app.common.CdmDestinations;
17
import eu.etaxonomy.cdm.database.DbSchemaValidation;
18
import eu.etaxonomy.cdm.database.ICdmDataSource;
19
import eu.etaxonomy.cdm.io.bogota.BogotaChecklistImportConfigurator;
20
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
21
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
22
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
23
import eu.etaxonomy.cdm.model.reference.IWebPage;
24
import eu.etaxonomy.cdm.model.reference.Reference;
25
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
26
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
27

  
28
/**
29
 * Activator for import of Bogota Checklist
30

  
31
 * @author a.mueller
32
 * @date 21.04.2017
33
 *
34
 */
35
public class BogotaChecklistActivator {
36
    private static final Logger logger = Logger.getLogger(BogotaChecklistActivator.class);
37

  
38
    //database validation status (create, update, validate ...)
39
    static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
40

  
41
//    static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
42
  static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
43
//    static final ICdmDataSource cdmDestination = CdmDestinations.cdm_mexico_rubiaceae_production();
44

  
45
    //classification
46
    static final UUID classificationUuid = UUID.fromString("c7779e17-8d45-4429-a9b0-e9c0fce93ec5");
47
    private static final String classificationName = "Bogota Taxonomic Backbone";
48

  
49
    //check - import
50
    static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
51

  
52
    protected void doImport(ICdmDataSource cdmDestination){
53

  
54
        URI source = bogotaChecklist();
55

  
56
        //make Source
57
        BogotaChecklistImportConfigurator config= BogotaChecklistImportConfigurator.NewInstance(source, cdmDestination);
58
        config.setNomenclaturalCode(NomenclaturalCode.ICNAFP);
59
        config.setClassificationUuid(classificationUuid);
60
        config.setClassificationName(classificationName);
61
        config.setCheck(check);
62
        config.setDbSchemaValidation(hbm2dll);
63
        config.setSecReference(getSecReference());
64

  
65
        config.setSource(source);
66
        String fileName = source.toString();
67
        fileName = fileName.substring(fileName.lastIndexOf("/") + 1 );
68

  
69
        String message = "Start import from ("+ fileName + ") ...";
70
        System.out.println(message);
71
        logger.warn(message);
72

  
73
        config.setSourceReference(getSourceReference());
74

  
75
        CdmDefaultImport<BogotaChecklistImportConfigurator> myImport = new CdmDefaultImport<>();
76

  
77
        myImport.invoke(config);
78

  
79
        System.out.println("End import from ("+ source.toString() + ")...");
80

  
81
    }
82

  
83

  
84
    //bogotaChecklist
85
    public static URI bogotaChecklist() {
86
        return URI.create("file:////BGBM-PESIHPC/Bogota/Resultados_Busqueda_avanzada_2017-04-19_0810_import.xlsx");
87
    }
88

  
89

  
90
    private Reference getSourceReference() {
91
        Reference result = ReferenceFactory.newGeneric();
92
        result.setTitle("Resultados_Busqueda_avanzada_2017-04-19_0810_import.xlsx");
93
//        Person borhidi = Person.NewTitledInstance("Borhidi");
94
//        borhidi.setFirstname("Attila");
95
//        result.setAuthorship(borhidi);
96
        return result;
97
    }
98

  
99
    private Reference getSecReference() {
100
        IWebPage result = ReferenceFactory.newWebPage();
101
        result.setTitle("2017-04-19. En Bernal, R., S.R. Gradstein & M. Celis (eds.). 2016. Catálogo de plantas y líquenes de Colombia. Instituto de Ciencias Naturales, Universidad Nacional de Colombia, Bogotá. http://catalogoplantasdecolombia.unal.edu.co/");
102
        result.setPlacePublished("Bogotá");
103
        result.setPublisher("Instituto de Ciencias Naturales, Universidad Nacional de Colombia");
104
        result.setDatePublished(TimePeriodParser.parseString("2017-04-19"));
105
//        Person borhidi = Person.NewTitledInstance("Borhidi");
106
//        borhidi.setFirstname("Attila");
107
//        result.setAuthorship(borhidi);
108
//        result.setUuid(MexicoConabioTransformer.uuidReferenceBorhidi);
109
        return (Reference)result;
110
    }
111

  
112
    /**
113
     * @param args
114
     */
115
    public static void main(String[] args) {
116
        BogotaChecklistActivator me = new BogotaChecklistActivator();
117
        me.doImport(cdmDestination);
118
        System.exit(0);
119
    }
120
}
app-import/src/main/java/eu/etaxonomy/cdm/io/bogota/BogotaChecklistImportConfigurator.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.io.bogota;
11

  
12
import java.net.URI;
13

  
14
import eu.etaxonomy.cdm.database.ICdmDataSource;
15
import eu.etaxonomy.cdm.io.common.ImportStateBase;
16
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
17
import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState;
18
import eu.etaxonomy.cdm.model.reference.Reference;
19

  
20
/**
21
 * @author a.mueller
22
 * @date 21.04.2017
23
 *
24
 */
25
public class BogotaChecklistImportConfigurator extends ExcelImportConfiguratorBase{
26
    private static final long serialVersionUID = 5988430626932820343L;
27

  
28
    private Reference secReference;
29

  
30
    /**
31
     * @param source
32
     * @param cdmDestination
33
     * @return
34
     */
35
    public static BogotaChecklistImportConfigurator NewInstance(URI source, ICdmDataSource destination) {
36
        return new BogotaChecklistImportConfigurator(source, destination);
37
    }
38

  
39
    /**
40
     * @param uri
41
     * @param destination
42
     */
43
    private BogotaChecklistImportConfigurator(URI uri, ICdmDataSource destination) {
44
        super(uri, destination);
45
    }
46

  
47
    /**
48
     * {@inheritDoc}
49
     */
50
    @Override
51
    public ImportStateBase getNewState() {
52
        return new SimpleExcelTaxonImportState<>(this);
53
    }
54

  
55
    /**
56
     * {@inheritDoc}
57
     */
58
    @Override
59
    protected void makeIoClassList() {
60
        ioClassList = new Class[]{
61
                BogotaChecklistTaxonImport.class,
62
        };
63
    }
64

  
65
    /**
66
     * @return the secReference
67
     */
68
    public Reference getSecReference() {
69
        return secReference;
70
    }
71

  
72

  
73
    /**
74
     * @param secReference
75
     */
76
    public void setSecReference(Reference secReference) {
77
        this.secReference = secReference;
78
    }
79

  
80
}
app-import/src/main/java/eu/etaxonomy/cdm/io/bogota/BogotaChecklistTaxonImport.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.io.bogota;
11

  
12
import java.util.HashMap;
13
import java.util.UUID;
14

  
15
import org.apache.log4j.Logger;
16
import org.springframework.stereotype.Component;
17
import org.springframework.transaction.TransactionStatus;
18

  
19
import eu.etaxonomy.cdm.common.CdmUtils;
20
import eu.etaxonomy.cdm.io.common.utils.ImportDeduplicationHelper;
21
import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImport;
22
import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState;
23
import eu.etaxonomy.cdm.model.common.Language;
24
import eu.etaxonomy.cdm.model.name.BotanicalName;
25
import eu.etaxonomy.cdm.model.name.Rank;
26
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
27
import eu.etaxonomy.cdm.model.reference.Reference;
28
import eu.etaxonomy.cdm.model.taxon.Classification;
29
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
30
import eu.etaxonomy.cdm.model.taxon.Synonym;
31
import eu.etaxonomy.cdm.model.taxon.SynonymType;
32
import eu.etaxonomy.cdm.model.taxon.Taxon;
33
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
34
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
35

  
36
/**
37
 * @author a.mueller
38
 * @date 21.04.2017
39
 *
40
 */
41
@Component
42
public class BogotaChecklistTaxonImport<CONFIG extends BogotaChecklistImportConfigurator>
43
        extends SimpleExcelTaxonImport<CONFIG> {
44

  
45
    private static final long serialVersionUID = -884838817884874228L;
46
    private static final Logger logger = Logger.getLogger(BogotaChecklistTaxonImport.class);
47

  
48
    private static final String AUTHOR = "Autor";
49
    private static final String NAME = "Nombre";
50
    private static final String GENUS = "Género";
51
    private static final String FAMILIA = "Familia";
52

  
53
    private static UUID rootUuid = UUID.fromString("d66eda18-4c11-4472-bfe8-f6cd5ed95c9f");
54
    private static UUID plantaeUuid = UUID.fromString("032fc183-eb4f-4f19-a290-28597a849096");
55

  
56
    @SuppressWarnings("unchecked")
57
    private ImportDeduplicationHelper<SimpleExcelTaxonImportState<?>> deduplicationHelper = (ImportDeduplicationHelper<SimpleExcelTaxonImportState<?>>)ImportDeduplicationHelper.NewStandaloneInstance();
58

  
59
    private String lastGenus;
60
    private NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance();
61

  
62

  
63
    @Override
64
    protected String getWorksheetName() {
65
        return "Resultados Busqueda Avanzada";
66
    }
67

  
68
    private boolean isFirst = true;
69
    private TransactionStatus tx = null;
70

  
71
    /**
72
     * {@inheritDoc}
73
     */
74
    @Override
75
    protected void firstPass(SimpleExcelTaxonImportState<CONFIG> state) {
76
        if (isFirst){
77
            tx = this.startTransaction();
78
            isFirst = false;
79
        }
80

  
81
        String line = state.getCurrentLine() + ": ";
82
        HashMap<String, String> record = state.getOriginalRecord();
83

  
84
        String noStr = getValue(record, "#");
85

  
86
        //species
87
        TaxonNode taxonNode = makeTaxon(state, line, record, noStr);
88
        if (taxonNode != null){
89
            //synonyms
90
            makeSynonyms(state, record, line, taxonNode.getTaxon(), noStr);
91

  
92
            //infraspecific
93
            makeInfraSpecific(state, record, line, taxonNode, noStr);
94
        }else{
95
            logger.warn(line + "No taxon node given");
96
        }
97
    }
98

  
99

  
100
    @Override
101
    protected void secondPass(SimpleExcelTaxonImportState<CONFIG> state) {
102
        if (tx != null){
103
            this.commitTransaction(tx);
104
            tx = null;
105
        }
106
    }
107

  
108
    /**
109
     * @param state
110
     * @param record
111
     * @param line
112
     * @param taxon
113
     */
114
    private void makeSynonyms(SimpleExcelTaxonImportState<CONFIG> state, HashMap<String, String> record, String line,
115
            Taxon taxon, String noStr) {
116

  
117
        String synonymsStr = getValue(record, "Sinonimos");
118
        if (synonymsStr != null){
119
            String[] splits = synonymsStr.split(",");
120
            for(String split : splits){
121
                split = split.trim();
122
                boolean isMisapplied = split.contains("auct.") || split.contains(" sensu ");
123
                if (split.endsWith(" None")){
124
                    split.replace(" None", "").trim();
125
                }
126
                if (isMisapplied){
127
                    handleSingleMisapplied(state, split, line, taxon, noStr);
128
                }else{
129
                    handleSingleSynonym(state, split, line, taxon, noStr);
130
                }
131
            }
132
        }
133
    }
134

  
135
    /**
136
     * @param state
137
     * @param trim
138
     * @param line
139
     * @param taxon
140
     * @param noStr
141
     */
142
    private void handleSingleMisapplied(SimpleExcelTaxonImportState<CONFIG> state, String nameStr, String line,
143
            Taxon taxon, String noStr) {
144
        Rank rank = Rank.SPECIES();
145
        String AUCT_NON = "auct. non ";
146
        String auctStr = nameStr.contains(AUCT_NON)? AUCT_NON: nameStr.endsWith("auct.")? "auct.": null;
147
        boolean auctRequired = false;
148
        if (auctStr == null){
149
            auctRequired = true;
150
            if (nameStr.endsWith("auct.colomb.")){
151
                nameStr = nameStr.replace(" auct.colomb.", "");
152
                auctStr = "auct.colomb.";
153
            }else if (nameStr.endsWith(" [auct.mult.non Sw.]")){
154
                nameStr = nameStr.replace(" [auct.mult.non Sw.]", "");
155
                auctStr = "[auct.mult.non Sw.]";
156
            }else if (nameStr.endsWith(" auct.pr.p.")){
157
                nameStr = nameStr.replace(" auct.pr.p.", "");
158
                auctStr = "auct.pr.p.";
159
            }else if (nameStr.contains(" sensu ")){
160
                logger.warn(line + "sensu not yet handled correctly:" +  nameStr);
161
                auctRequired = false;
162
            }else{
163
                auctRequired = false;
164
                logger.warn(line + "auct. not recognized: " + nameStr);
165
            }
166

  
167
        }else{
168
            nameStr = nameStr.replace(auctStr, "").trim();
169
        }
170
        BotanicalName name = (BotanicalName)parser.parseFullName(nameStr, state.getConfig().getNomenclaturalCode(), rank);
171
        if (name.isProtectedTitleCache()){
172
            logger.warn(line + "Misapplied name could not be parsed: " + nameStr);
173
        }
174
        Taxon misApp = Taxon.NewInstance(name, null);
175
        if (auctRequired){
176
            misApp.setAppendedPhrase(auctStr);
177
        }
178
        misApp.addImportSource(noStr, getWorksheetName(), getSourceCitation(state), null);
179
        name.addImportSource(noStr, getWorksheetName(), getSourceCitation(state), null);
180
        taxon.addMisappliedName(misApp, state.getConfig().getSecReference(), null);
181
        deduplicationHelper.replaceAuthorNamesAndNomRef(state, name);
182
      }
183

  
184

  
185
    /**
186
     * @param state
187
     * @param record
188
     * @param line
189
     * @param taxon
190
     * @param noStr
191
     */
192
    private void handleSingleSynonym(SimpleExcelTaxonImportState<CONFIG> state, String nameStr,
193
            String line, Taxon taxon, String noStr) {
194
        Rank rank = Rank.SPECIES();
195
        BotanicalName name = (BotanicalName)parser.parseFullName(nameStr, state.getConfig().getNomenclaturalCode(), rank);
196
        if (name.isProtectedTitleCache()){
197
            logger.warn(line + "Synonym could not be parsed: " + nameStr);
198
        }
199
        Synonym synonym = Synonym.NewInstance(name, getSecReference(state));
200
        synonym.addImportSource(noStr, getWorksheetName(), getSourceCitation(state), null);
201
        name.addImportSource(noStr, getWorksheetName(), getSourceCitation(state), null);
202
        taxon.addSynonym(synonym, SynonymType.SYNONYM_OF());
203
        deduplicationHelper.replaceAuthorNamesAndNomRef(state, name);
204
    }
205

  
206

  
207
    /**
208
     * @param state
209
     * @param line
210
     * @param record
211
     * @param taxon
212
     * @param noStr
213
     */
214
    private void makeInfraSpecific(SimpleExcelTaxonImportState<CONFIG> state, HashMap<String, String> record, String line,
215
            TaxonNode speciesNode, String noStr) {
216
        String subSpeciesStr = getValue(record, "Taxones infraespecíficos");
217
        if (subSpeciesStr != null){
218
            String[] splits = subSpeciesStr.split(",");
219
            for(String split : splits){
220
                if (split.endsWith(" None")){
221
                    split.replace(" None", "").trim();
222
                }
223
                Rank rank = Rank.SUBSPECIES();
224
                BotanicalName name = (BotanicalName)parser.parseFullName(split.trim(), state.getConfig().getNomenclaturalCode(), rank);
225
                if (name.isProtectedTitleCache()){
226
                    logger.warn(line + "Infraspecific taxon could not be parsed: " + split.trim());
227
                }
228
                Taxon subSpecies = Taxon.NewInstance(name, getSecReference(state));
229
                subSpecies.addImportSource(noStr, getWorksheetName(), getSourceCitation(state), null);
230
                name.addImportSource(noStr, getWorksheetName(), getSourceCitation(state), null);
231
                TaxonNode subSpeciesNode = speciesNode.addChildTaxon(subSpecies, getSecReference(state), null);
232
                getTaxonNodeService().save(subSpeciesNode);
233
                deduplicationHelper.replaceAuthorNamesAndNomRef(state, name);
234
            }
235
        }
236
    }
237

  
238
    /**
239
     * @param state
240
     * @param line
241
     * @param record
242
     * @param noStr
243
     * @return
244
     */
245
    private TaxonNode makeTaxon(SimpleExcelTaxonImportState<CONFIG> state, String line, HashMap<String, String> record,
246
            String noStr) {
247

  
248
        TaxonNode familyTaxon = getFamilyTaxon(record, state);
249
        if (familyTaxon == null){
250
            logger.warn(line + "Family not created: " + record.get(FAMILIA));
251
        }
252

  
253
        String genusStr = getValue(record, GENUS);
254
        String nameStr = getValue(record, NAME);
255
        String speciesAuthorStr = getValue(record, AUTHOR);
256

  
257
        nameStr = CdmUtils.concat(" ", nameStr, speciesAuthorStr);
258
        Rank rank = Rank.SPECIES();
259
        BotanicalName name = (BotanicalName)parser.parseFullName(nameStr, state.getConfig().getNomenclaturalCode(), rank);
260
        if (name.isProtectedTitleCache()){
261
            logger.warn(line + "Name could not be parsed: " + nameStr);
262
        }
263
        Taxon taxon = Taxon.NewInstance(name, getSecReference(state));
264
        taxon.addImportSource(noStr, getWorksheetName(), getSourceCitation(state), null);
265
        name.addImportSource(noStr, getWorksheetName(), getSourceCitation(state), null);
266

  
267
        String parentStr = genusStr;
268
        boolean genusAsBefore = genusStr.equals(lastGenus);
269
        TaxonNode parent = getParent(state, parentStr);
270
        TaxonNode newNode;
271
        if (parent != null){
272
            if (genusAsBefore ){
273
                //everything as expected
274
                newNode = parent.addChildTaxon(taxon, getSecReference(state), null);
275
                getTaxonNodeService().save(newNode);
276
            }else{
277
                logger.warn(line + "Unexpected non-missing parent");
278
                newNode = null;
279
            }
280
        }else{
281
            if (genusAsBefore){
282
                logger.warn(line + "Unexpected missing genus parent");
283
                newNode = null;
284
            }else{
285
                parent = makeGenusNode(state, record, genusStr);
286
                newNode = parent.addChildTaxon(taxon, getSecReference(state), null);
287
                getTaxonNodeService().save(newNode);
288
            }
289
        }
290

  
291
        deduplicationHelper.replaceAuthorNamesAndNomRef(state, name);
292

  
293
        this.lastGenus = genusStr;
294
        return newNode;
295
    }
296

  
297
    /**
298
     * @param record
299
     * @param state
300
     * @return
301
     */
302
    private TaxonNode getFamilyTaxon(HashMap<String, String> record, SimpleExcelTaxonImportState<CONFIG> state) {
303
        String familyStr = getValue(record, FAMILIA);
304
        if (familyStr == null){
305
            return null;
306
        }
307
        familyStr = familyStr.trim();
308

  
309
        Taxon family = state.getHigherTaxon(familyStr);
310
        TaxonNode familyNode;
311
        if (family != null){
312
            familyNode = family.getTaxonNodes().iterator().next();
313
        }else{
314
            BotanicalName name = makeFamilyName(state, familyStr);
315
            Reference sec = getSecReference(state);
316
            family = Taxon.NewInstance(name, sec);
317

  
318
            ITaxonTreeNode classificationNode = getClassification(state);
319
            familyNode = classificationNode.addChildTaxon(family, sec, null);
320
            state.putHigherTaxon(familyStr, family);
321
            getTaxonNodeService().save(familyNode);
322
        }
323

  
324
        return familyNode;
325
    }
326

  
327

  
328
    private TaxonNode rootNode;
329
    private TaxonNode getClassification(SimpleExcelTaxonImportState<CONFIG> state) {
330
        if (rootNode == null){
331
            Reference sec = getSecReference(state);
332
            String classificationName = state.getConfig().getClassificationName();
333
            Language language = Language.DEFAULT();
334
            Classification classification = Classification.NewInstance(classificationName, sec, language);
335
            classification.setUuid(state.getConfig().getClassificationUuid());
336
            classification.getRootNode().setUuid(rootUuid);
337

  
338
            BotanicalName plantaeName = TaxonNameFactory.NewBotanicalInstance(Rank.KINGDOM());
339
            plantaeName.setGenusOrUninomial("Plantae");
340
            Taxon plantae = Taxon.NewInstance(plantaeName, sec);
341
            TaxonNode plantaeNode = classification.addChildTaxon(plantae, null, null);
342
            plantaeNode.setUuid(plantaeUuid);
343
            getClassificationService().save(classification);
344

  
345
            rootNode = plantaeNode;
346
        }
347
        return rootNode;
348
    }
349

  
350

  
351
    protected BotanicalName makeFamilyName(SimpleExcelTaxonImportState<CONFIG> state, String famStr) {
352
        BotanicalName name = TaxonNameFactory.NewBotanicalInstance(Rank.FAMILY());
353
        name.setGenusOrUninomial(famStr);
354
        name.addSource(makeOriginalSource(state));
355
        return name;
356
    }
357

  
358
    protected Reference getSecReference(SimpleExcelTaxonImportState<CONFIG> state) {
359
        return state.getConfig().getSecReference();
360
    }
361

  
362
    /**
363
     * @param state
364
     * @return
365
     */
366
    protected Reference getSourceCitation(SimpleExcelTaxonImportState<CONFIG> state) {
367
        return state.getConfig().getSourceReference();
368
    }
369

  
370
    /**
371
     * @param state
372
     * @param parentStr
373
     * @return
374
     */
375
    private TaxonNode getParent(SimpleExcelTaxonImportState<CONFIG> state, String parentStr) {
376
        Taxon taxon = state.getHigherTaxon(parentStr);
377

  
378
        return taxon == null ? null : taxon.getTaxonNodes().iterator().next();
379
    }
380

  
381
    /**
382
     * @param state
383
     * @param record
384
     * @param genusStr
385
     * @return
386
     */
387
    private TaxonNode makeGenusNode(SimpleExcelTaxonImportState<CONFIG> state,
388
            HashMap<String, String> record, String genusStr) {
389
        BotanicalName name = TaxonNameFactory.NewBotanicalInstance(Rank.GENUS());
390
        name.setGenusOrUninomial(genusStr);
391
        Taxon genus = Taxon.NewInstance(name, getSecReference(state));
392
        TaxonNode family = getFamilyTaxon(record, state);
393
        TaxonNode genusNode = family.addChildTaxon(genus, getSecReference(state), null);
394
        state.putHigherTaxon(genusStr, genus);
395
        genus.addSource(makeOriginalSource(state));
396
        getTaxonNodeService().save(genusNode);
397
        return genusNode;
398
    }
399

  
400
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)