Project

General

Profile

Download (2.31 KB) Statistics
| Branch: | Revision:
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.io.greece;
10

    
11
import java.util.List;
12

    
13
import org.apache.log4j.Logger;
14
import org.springframework.stereotype.Component;
15
import org.springframework.transaction.TransactionStatus;
16

    
17
import eu.etaxonomy.cdm.api.service.config.MatchingTaxonConfigurator;
18
import eu.etaxonomy.cdm.io.common.CdmImportBase;
19
import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState;
20
import eu.etaxonomy.cdm.model.taxon.Taxon;
21
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
22
import eu.etaxonomy.cdm.strategy.homotypicgroup.BasionymRelationCreator;
23
/**
24
 * Creates basionym relationships for all taxa.
25
 *
26
 * @author a.mueller
27
 * @date 03.04.2017
28
 */
29

    
30
@Component
31
public class FloraHellenicaBasionymImport<CONFIG extends FloraHellenicaImportConfigurator>
32
        extends CdmImportBase<CONFIG,SimpleExcelTaxonImportState<CONFIG>>{
33

    
34
    private static final long serialVersionUID = -7066421762179411758L;
35
    @SuppressWarnings("unused")
36
    private static final Logger logger = Logger.getLogger(FloraHellenicaBasionymImport.class);
37

    
38
    /**
39
     * {@inheritDoc}
40
     */
41
    @Override
42
    protected void doInvoke(SimpleExcelTaxonImportState<CONFIG> state) {
43

    
44
        MatchingTaxonConfigurator config = new MatchingTaxonConfigurator();
45
        config.setTaxonNameTitle("Stachys scardica");
46
        config.setIncludeSynonyms(true);
47
        List<TaxonBase> synList = getTaxonService().findTaxaByName(config);
48
        boolean empty = synList.isEmpty();
49

    
50

    
51

    
52
        TransactionStatus tx = this.startTransaction();
53

    
54

    
55

    
56
        List<Taxon> list = getTaxonService().list(Taxon.class, null, null, null, null);
57
        for (Taxon taxon : list){
58
            BasionymRelationCreator creator = new BasionymRelationCreator();
59
            creator.invoke(taxon);
60
        }
61
        this.commitTransaction(tx);
62
    }
63

    
64

    
65

    
66
    /**
67
     * {@inheritDoc}
68
     */
69
    @Override
70
    protected boolean doCheck(SimpleExcelTaxonImportState<CONFIG> state) {
71
        return false;
72
    }
73

    
74
    /**
75
     * {@inheritDoc}
76
     */
77
    @Override
78
    protected boolean isIgnore(SimpleExcelTaxonImportState<CONFIG> state) {
79
        return false;
80
    }
81

    
82

    
83

    
84
}
(1-1/11)