Project

General

Profile

Download (2.32 KB) Statistics
| Branch: | Revision:
1 66768fff Patrick Plitzner
/**
2
* Copyright (C) 2017 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.plantglossary;
10
11 e5d40c14 Patrick Plitzner
import java.net.URI;
12
import java.net.URISyntaxException;
13 66768fff Patrick Plitzner
import java.util.HashSet;
14
import java.util.Set;
15
16
import eu.etaxonomy.cdm.io.csv.in.CsvImportState;
17 e5d40c14 Patrick Plitzner
import eu.etaxonomy.cdm.model.agent.Person;
18 66768fff Patrick Plitzner
import eu.etaxonomy.cdm.model.common.TermVocabulary;
19 e5d40c14 Patrick Plitzner
import eu.etaxonomy.cdm.model.common.VerbatimTimePeriod;
20 66768fff Patrick Plitzner
import eu.etaxonomy.cdm.model.reference.Reference;
21
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
22
23
/**
24
 *
25
 * @author pplitzner
26
 * @since Dec 7, 2018
27
 *
28
 */
29
public class PlantGlossaryCsvImportState extends CsvImportState<PlantGlossaryCsvImportConfigurator> {
30
31
    private Set<TermVocabulary> vocabularies = new HashSet<>();
32 a41e78d9 Patrick Plitzner
    private final Reference citation;
33 66768fff Patrick Plitzner
34
35
    protected PlantGlossaryCsvImportState(PlantGlossaryCsvImportConfigurator config) {
36
        super(config);
37 a41e78d9 Patrick Plitzner
        citation = ReferenceFactory.newGeneric();
38
        citation.setTitle("fna_gloss_final_20130517");
39 e5d40c14 Patrick Plitzner
        Person authorship = Person.NewInstance(null, "Cui", null, "Hong");
40
        citation.setAuthorship(authorship);
41
        VerbatimTimePeriod datePublished = VerbatimTimePeriod.NewVerbatimInstance();
42
        datePublished.setStartYear(2014);
43
        datePublished.setStartMonth(6);
44
        datePublished.setStartDay(13);
45
        citation.setDatePublished(datePublished);
46
        URI uri;
47
        try {
48
            uri = new URI("https://github.com/biosemantics/glossaries/blob/925f2c1691ed00bf2b9a9cd7f83609cffae47145/Plant/0.11/Plant_glossary_term_category.csv");
49
            citation.setUri(uri);
50
        } catch (URISyntaxException e) {
51
        }
52 66768fff Patrick Plitzner
    }
53
54
    @Override
55
    public void resetSession(){
56
        super.resetSession();
57
    }
58
59 a41e78d9 Patrick Plitzner
    void addVocabulary(TermVocabulary vocabulary) {
60
        vocabularies.add(vocabulary);
61 66768fff Patrick Plitzner
    }
62
63 a41e78d9 Patrick Plitzner
    TermVocabulary checkVocabularies(String vocName){
64 66768fff Patrick Plitzner
        for (TermVocabulary termVocabulary : vocabularies) {
65
            if(termVocabulary.getLabel().equals(vocName)){
66
                return termVocabulary;
67
            }
68
        }
69
        return null;
70
    }
71
72 a41e78d9 Patrick Plitzner
    Reference getCitation() {
73
        return citation;
74 66768fff Patrick Plitzner
    }
75
76
}