Project

General

Profile

« Previous | Next » 

Revision 23c6cd1b

Added by Andreas Müller over 6 years ago

rename FloraHellenicaActivator

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/greece/FloraHellenicaActivator.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.greece;
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.common.DOI;
18
import eu.etaxonomy.cdm.database.DbSchemaValidation;
19
import eu.etaxonomy.cdm.database.ICdmDataSource;
20
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
21
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
22
import eu.etaxonomy.cdm.io.greece.FloraHellenicaImportConfigurator;
23
import eu.etaxonomy.cdm.model.agent.Person;
24
import eu.etaxonomy.cdm.model.agent.Team;
25
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
26
import eu.etaxonomy.cdm.model.reference.Reference;
27
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
28
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
29

  
30
/**
31
 *
32
 * Import for Checklist of Greece.
33
 *
34
 * https://dev.e-taxonomy.eu/redmine/issues/6286
35
 *
36
 * @author a.mueller
37
 * @date 13.12.2016
38
 */
39
public class FloraHellenicaActivator {
40
    @SuppressWarnings("unused")
41
    private static final Logger logger = Logger.getLogger(FloraHellenicaActivator.class);
42

  
43
    //database validation status (create, update, validate ...)
44
    static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
45

  
46
    static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
47
//  static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
48
//    static final ICdmDataSource cdmDestination = CdmDestinations.cdm_greece_checklist_production();
49

  
50
    //feature tree uuid
51
    public static final UUID featureTreeUuid = UUID.fromString("9e1e0e81-7475-4b28-8619-b7f42cd760b6");
52
    private static final String featureTreeTitle = "Flora of Greece dataportal feature tree";
53

  
54
    //classification
55
    static final UUID classificationUuid = UUID.fromString("e537d69a-c2d9-4ac6-8f79-5b5e3dd5c154");
56
    private static final String classificationName = "Vascular plants of Greece";
57

  
58

  
59
    //check - import
60
    static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
61

  
62
    boolean doImages = true;
63

  
64
    boolean doVocabularies = (hbm2dll == DbSchemaValidation.CREATE);
65

  
66
    private void doImport(ICdmDataSource cdmDestination){
67

  
68
        URI source = greekChecklist();  //just any
69

  
70
        //make Source
71
        FloraHellenicaImportConfigurator config = FloraHellenicaImportConfigurator.NewInstance(source, cdmDestination);
72
        config.setClassificationUuid(classificationUuid);
73
        config.setClassificationName(classificationName);
74
        config.setCheck(check);
75
        config.setDbSchemaValidation(hbm2dll);
76
        config.setUuidFeatureTree(featureTreeUuid);
77
        config.setFeatureTreeTitle(featureTreeTitle);
78
        config.setDoImages(doImages);
79
        config.setSecReference(getSecReference());
80
        config.setSourceReference(getSourceReference());
81
        config.setSecReference2(getSecReference2());
82

  
83
        CdmDefaultImport<FloraHellenicaImportConfigurator> myImport = new CdmDefaultImport<>();
84
        myImport.invoke(config);
85

  
86
    }
87

  
88

  
89
    private URI greekChecklist(){
90
        return URI.create("file:////BGBM-PESIHPC/Greece/VPG_FINAL_WITH_SYNONYMS_21.01.2017.xlsx");
91
    }
92

  
93
    private Reference secRef;
94
    private Reference getSecReference(){
95
        if (secRef != null){
96
            return secRef;
97
        }
98
        Reference result = ReferenceFactory.newBook();
99
        result.setTitle("Vascular plants of Greece: An annotated checklist.");
100
        result.setDatePublished(TimePeriodParser.parseString("2013"));
101

  
102
        Team team = Team.NewInstance();
103

  
104
        Person person = Person.NewInstance();
105
        person.setFirstname("P.");
106
        person.setLastname("Dimopoulos");
107
        team.addTeamMember(person);
108

  
109
        person = Person.NewInstance();
110
        person.setFirstname("Th.");
111
        person.setLastname("Raus");
112
        team.addTeamMember(person);
113

  
114
        person = Person.NewInstance();
115
        person.setFirstname("E.");
116
        person.setLastname("Bergmeier");
117
        team.addTeamMember(person);
118

  
119
        person = Person.NewInstance();
120
        person.setFirstname("Th.");
121
        person.setLastname("Constantinidis");
122
        team.addTeamMember(person);
123

  
124
        person = Person.NewInstance();
125
        person.setFirstname("G.");
126
        person.setLastname("Iatrou");
127
        team.addTeamMember(person);
128

  
129
        person = Person.NewInstance();
130
        person.setFirstname("S.");
131
        person.setLastname("Kokkini");
132
        team.addTeamMember(person);
133

  
134
        person = Person.NewInstance();
135
        person.setFirstname("A.");
136
        person.setLastname("Strid");
137
        team.addTeamMember(person);
138

  
139
        person = Person.NewInstance();
140
        person.setFirstname("D.");
141
        person.setLastname("Tzanoudakis");
142
        team.addTeamMember(person);
143

  
144
        result.setAuthorship(team);
145

  
146
        result.setPublisher("Berlin: Botanic Garden and Botanical Museum Berlin-Dahlem; Athens: Hellenic Botanical Society.");
147

  
148
        result.setVolume("31");
149
        Reference englera = ReferenceFactory.newPrintSeries();
150
        englera.setTitle("Englera");
151
        result.setInReference(englera);
152
        secRef = result;
153

  
154
        secRef.setUuid(UUID.fromString("1f78fd94-3a99-4a7b-881f-71cb099ea13a"));
155
        return result;
156
    }
157

  
158
    private Reference getSecReference2(){
159
        Reference result = ReferenceFactory.newArticle();
160
        result.setTitle("Vascular plants of Greece: An annotated checklist. Supplement");
161
        result.setDatePublished(TimePeriodParser.parseString("26.10.2016"));
162

  
163
        TeamOrPersonBase<?> team = getSecReference().getAuthorship();
164
                result.setAuthorship(team);
165

  
166
        result.setPublisher("Berlin: Botanic Garden and Botanical Museum Berlin-Dahlem; Athens: Hellenic Botanical Society.");
167

  
168
        result.setVolume("46(3)");
169
        result.setPages("301–347");
170
        Reference journal = ReferenceFactory.newJournal();
171
        journal.setTitle("Willdenowia");
172
        result.setInReference(journal);
173
        result.setDoi(DOI.fromString("http://dx.doi.org/10.3372/wi.46.46303"));
174
        result.setReferenceAbstract("Supplementary information on taxonomy, nomenclature, distribution within Greece, total range, life form and ecological traits of vascular plants known to occur in Greece is presented and the revised data are quantitatively analysed. Floristic discrepancies between Vascular plants of Greece: An annotated checklist (Dimopoulos & al. 2013) and relevant influential datasets (Flora europaea, Med-Checklist, Euro+Med PlantBase, etc.) are explained and clarified. An additional quantity of synonyms and misapplied names used in previous Greek floristic literature is presented. Taxonomic and floristic novelties published after 31 October 2013 are not considered.");
175
        result.setUri(URI.create("http://www.bioone.org/doi/full/10.3372/wi.46.46303"));
176
        result.setUuid(UUID.fromString("94fad58e-34de-48b6-a130-ffa3e7cf9a3c"));
177

  
178
        return result;
179
    }
180

  
181
    private Reference getSourceReference(){
182
        Reference result = ReferenceFactory.newDatabase();
183
        result.setTitle("Excelfile (VPG_FINAL_WITH_SYNONYMS_21.01.2017.xlsx) derived from ");
184
        result.setInReference(getSecReference());
185
        result.setUuid(UUID.fromString("7e14e5d2-b3aa-486b-ba31-41dbb91d7fe3"));
186

  
187
        return result;
188
    }
189

  
190
    /**
191
     * @param args
192
     */
193
    public static void main(String[] args) {
194
        FloraHellenicaActivator me = new FloraHellenicaActivator();
195
        me.doImport(cdmDestination);
196
        System.exit(0);
197
    }
198
}
app-import/src/main/java/eu/etaxonomy/cdm/app/greece/GreeceActivator.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.greece;
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.common.DOI;
18
import eu.etaxonomy.cdm.database.DbSchemaValidation;
19
import eu.etaxonomy.cdm.database.ICdmDataSource;
20
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
21
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
22
import eu.etaxonomy.cdm.io.greece.FloraHellenicaImportConfigurator;
23
import eu.etaxonomy.cdm.model.agent.Person;
24
import eu.etaxonomy.cdm.model.agent.Team;
25
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
26
import eu.etaxonomy.cdm.model.reference.Reference;
27
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
28
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
29

  
30
/**
31
 *
32
 * Import for Checklist of Greece.
33
 *
34
 * https://dev.e-taxonomy.eu/redmine/issues/6286
35
 *
36
 * @author a.mueller
37
 * @date 13.12.2016
38
 */
39
public class GreeceActivator {
40
    @SuppressWarnings("unused")
41
    private static final Logger logger = Logger.getLogger(GreeceActivator.class);
42

  
43
    //database validation status (create, update, validate ...)
44
    static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
45

  
46
    static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
47
//  static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
48
//    static final ICdmDataSource cdmDestination = CdmDestinations.cdm_greece_checklist_production();
49

  
50
    //feature tree uuid
51
    public static final UUID featureTreeUuid = UUID.fromString("9e1e0e81-7475-4b28-8619-b7f42cd760b6");
52
    private static final String featureTreeTitle = "Flora of Greece dataportal feature tree";
53

  
54
    //classification
55
    static final UUID classificationUuid = UUID.fromString("e537d69a-c2d9-4ac6-8f79-5b5e3dd5c154");
56
    private static final String classificationName = "Vascular plants of Greece";
57

  
58

  
59
    //check - import
60
    static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
61

  
62
    boolean doImages = true;
63

  
64
    boolean doVocabularies = (hbm2dll == DbSchemaValidation.CREATE);
65

  
66
    private void doImport(ICdmDataSource cdmDestination){
67

  
68
        URI source = greekChecklist();  //just any
69

  
70
        //make Source
71
        FloraHellenicaImportConfigurator config = FloraHellenicaImportConfigurator.NewInstance(source, cdmDestination);
72
        config.setClassificationUuid(classificationUuid);
73
        config.setClassificationName(classificationName);
74
        config.setCheck(check);
75
        config.setDbSchemaValidation(hbm2dll);
76
        config.setUuidFeatureTree(featureTreeUuid);
77
        config.setFeatureTreeTitle(featureTreeTitle);
78
        config.setDoImages(doImages);
79
        config.setSecReference(getSecReference());
80
        config.setSourceReference(getSourceReference());
81
        config.setSecReference2(getSecReference2());
82

  
83
        CdmDefaultImport<FloraHellenicaImportConfigurator> myImport = new CdmDefaultImport<>();
84
        myImport.invoke(config);
85

  
86
    }
87

  
88

  
89
    private URI greekChecklist(){
90
        return URI.create("file:////BGBM-PESIHPC/Greece/VPG_FINAL_WITH_SYNONYMS_21.01.2017.xlsx");
91
    }
92

  
93
    private Reference secRef;
94
    private Reference getSecReference(){
95
        if (secRef != null){
96
            return secRef;
97
        }
98
        Reference result = ReferenceFactory.newBook();
99
        result.setTitle("Vascular plants of Greece: An annotated checklist.");
100
        result.setDatePublished(TimePeriodParser.parseString("2013"));
101

  
102
        Team team = Team.NewInstance();
103

  
104
        Person person = Person.NewInstance();
105
        person.setFirstname("P.");
106
        person.setLastname("Dimopoulos");
107
        team.addTeamMember(person);
108

  
109
        person = Person.NewInstance();
110
        person.setFirstname("Th.");
111
        person.setLastname("Raus");
112
        team.addTeamMember(person);
113

  
114
        person = Person.NewInstance();
115
        person.setFirstname("E.");
116
        person.setLastname("Bergmeier");
117
        team.addTeamMember(person);
118

  
119
        person = Person.NewInstance();
120
        person.setFirstname("Th.");
121
        person.setLastname("Constantinidis");
122
        team.addTeamMember(person);
123

  
124
        person = Person.NewInstance();
125
        person.setFirstname("G.");
126
        person.setLastname("Iatrou");
127
        team.addTeamMember(person);
128

  
129
        person = Person.NewInstance();
130
        person.setFirstname("S.");
131
        person.setLastname("Kokkini");
132
        team.addTeamMember(person);
133

  
134
        person = Person.NewInstance();
135
        person.setFirstname("A.");
136
        person.setLastname("Strid");
137
        team.addTeamMember(person);
138

  
139
        person = Person.NewInstance();
140
        person.setFirstname("D.");
141
        person.setLastname("Tzanoudakis");
142
        team.addTeamMember(person);
143

  
144
        result.setAuthorship(team);
145

  
146
        result.setPublisher("Berlin: Botanic Garden and Botanical Museum Berlin-Dahlem; Athens: Hellenic Botanical Society.");
147

  
148
        result.setVolume("31");
149
        Reference englera = ReferenceFactory.newPrintSeries();
150
        englera.setTitle("Englera");
151
        result.setInReference(englera);
152
        secRef = result;
153

  
154
        secRef.setUuid(UUID.fromString("1f78fd94-3a99-4a7b-881f-71cb099ea13a"));
155
        return result;
156
    }
157

  
158
    private Reference getSecReference2(){
159
        Reference result = ReferenceFactory.newArticle();
160
        result.setTitle("Vascular plants of Greece: An annotated checklist. Supplement");
161
        result.setDatePublished(TimePeriodParser.parseString("26.10.2016"));
162

  
163
        TeamOrPersonBase<?> team = getSecReference().getAuthorship();
164
                result.setAuthorship(team);
165

  
166
        result.setPublisher("Berlin: Botanic Garden and Botanical Museum Berlin-Dahlem; Athens: Hellenic Botanical Society.");
167

  
168
        result.setVolume("46(3)");
169
        result.setPages("301–347");
170
        Reference journal = ReferenceFactory.newJournal();
171
        journal.setTitle("Willdenowia");
172
        result.setInReference(journal);
173
        result.setDoi(DOI.fromString("http://dx.doi.org/10.3372/wi.46.46303"));
174
        result.setReferenceAbstract("Supplementary information on taxonomy, nomenclature, distribution within Greece, total range, life form and ecological traits of vascular plants known to occur in Greece is presented and the revised data are quantitatively analysed. Floristic discrepancies between Vascular plants of Greece: An annotated checklist (Dimopoulos & al. 2013) and relevant influential datasets (Flora europaea, Med-Checklist, Euro+Med PlantBase, etc.) are explained and clarified. An additional quantity of synonyms and misapplied names used in previous Greek floristic literature is presented. Taxonomic and floristic novelties published after 31 October 2013 are not considered.");
175
        result.setUri(URI.create("http://www.bioone.org/doi/full/10.3372/wi.46.46303"));
176
        result.setUuid(UUID.fromString("94fad58e-34de-48b6-a130-ffa3e7cf9a3c"));
177

  
178
        return result;
179
    }
180

  
181
    private Reference getSourceReference(){
182
        Reference result = ReferenceFactory.newDatabase();
183
        result.setTitle("Excelfile (VPG_FINAL_WITH_SYNONYMS_21.01.2017.xlsx) derived from ");
184
        result.setInReference(getSecReference());
185
        result.setUuid(UUID.fromString("7e14e5d2-b3aa-486b-ba31-41dbb91d7fe3"));
186

  
187
        return result;
188
    }
189

  
190
    /**
191
     * @param args
192
     */
193
    public static void main(String[] args) {
194
        GreeceActivator me = new GreeceActivator();
195
        me.doImport(cdmDestination);
196
        System.exit(0);
197
    }
198
}

Also available in: Unified diff