Project

General

Profile

Download (2.32 KB) Statistics
| Branch: | Revision:
1
/**
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
import java.net.URI;
12
import java.net.URISyntaxException;
13
import java.util.HashSet;
14
import java.util.Set;
15

    
16
import eu.etaxonomy.cdm.io.csv.in.CsvImportState;
17
import eu.etaxonomy.cdm.model.agent.Person;
18
import eu.etaxonomy.cdm.model.common.TermVocabulary;
19
import eu.etaxonomy.cdm.model.common.VerbatimTimePeriod;
20
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
    private final Reference citation;
33

    
34

    
35
    protected PlantGlossaryCsvImportState(PlantGlossaryCsvImportConfigurator config) {
36
        super(config);
37
        citation = ReferenceFactory.newGeneric();
38
        citation.setTitle("fna_gloss_final_20130517");
39
        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
    }
53

    
54
    @Override
55
    public void resetSession(){
56
        super.resetSession();
57
    }
58

    
59
    void addVocabulary(TermVocabulary vocabulary) {
60
        vocabularies.add(vocabulary);
61
    }
62

    
63
    TermVocabulary checkVocabularies(String vocName){
64
        for (TermVocabulary termVocabulary : vocabularies) {
65
            if(termVocabulary.getLabel().equals(vocName)){
66
                return termVocabulary;
67
            }
68
        }
69
        return null;
70
    }
71

    
72
    Reference getCitation() {
73
        return citation;
74
    }
75

    
76
}
(4-4/4)