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.database.DbSchemaValidation;
|
18
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
19
|
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
|
20
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
|
21
|
import eu.etaxonomy.cdm.io.greece.FloraHellenicaImportConfigurator;
|
22
|
|
23
|
/**
|
24
|
*
|
25
|
* Import for Checklist of Greece.
|
26
|
*
|
27
|
* https://dev.e-taxonomy.eu/redmine/issues/6286
|
28
|
*
|
29
|
* @author a.mueller
|
30
|
* @date 13.12.2016
|
31
|
*/
|
32
|
public class FloraHellenicaActivator {
|
33
|
@SuppressWarnings("unused")
|
34
|
private static final Logger logger = Logger.getLogger(FloraHellenicaActivator.class);
|
35
|
|
36
|
//database validation status (create, update, validate ...)
|
37
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
38
|
|
39
|
// static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
|
40
|
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
|
41
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_greece_checklist_production();
|
42
|
|
43
|
//feature tree uuid
|
44
|
public static final UUID featureTreeUuid = UUID.fromString("9e1e0e81-7475-4b28-8619-b7f42cd760b6");
|
45
|
private static final String featureTreeTitle = "Flora Hellenica dataportal feature tree";
|
46
|
|
47
|
//classification
|
48
|
static final UUID classificationUuid = UUID.fromString("e537d69a-c2d9-4ac6-8f79-5b5e3dd5c154");
|
49
|
private static final String classificationName = "Greek Checklist";
|
50
|
|
51
|
|
52
|
//check - import
|
53
|
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
|
54
|
|
55
|
boolean doVocabularies = (hbm2dll == DbSchemaValidation.CREATE);
|
56
|
|
57
|
private void doImport(ICdmDataSource cdmDestination){
|
58
|
|
59
|
URI source = greekChecklist(); //just any
|
60
|
|
61
|
//make Source
|
62
|
FloraHellenicaImportConfigurator config= FloraHellenicaImportConfigurator.NewInstance(source, cdmDestination);
|
63
|
config.setClassificationUuid(classificationUuid);
|
64
|
config.setClassificationName(classificationName);
|
65
|
config.setCheck(check);
|
66
|
// config.setDoDistribution(doDistribution);
|
67
|
// config.setDoTaxa(doTaxa);
|
68
|
config.setDbSchemaValidation(hbm2dll);
|
69
|
// config.setSourceReferenceTitle(sourceReferenceTitle);
|
70
|
// config.setDoVocabularies(doVocabularies);
|
71
|
config.setUuidFeatureTree(featureTreeUuid);
|
72
|
config.setFeatureTreeTitle(featureTreeTitle);
|
73
|
|
74
|
CdmDefaultImport<FloraHellenicaImportConfigurator> myImport = new CdmDefaultImport<>();
|
75
|
myImport.invoke(config);
|
76
|
|
77
|
// FeatureTree tree = makeFeatureNodes(myImport.getCdmAppController().getTermService());
|
78
|
// myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
|
79
|
}
|
80
|
|
81
|
|
82
|
private URI greekChecklist(){
|
83
|
return URI.create("file:////BGBM-PESIHPC/Greece/VPG_FINAL_WITH_SYNONYMS_21.01.2017.xlsx");
|
84
|
}
|
85
|
|
86
|
/**
|
87
|
* @param args
|
88
|
*/
|
89
|
public static void main(String[] args) {
|
90
|
FloraHellenicaActivator me = new FloraHellenicaActivator();
|
91
|
me.doImport(cdmDestination);
|
92
|
System.exit(0);
|
93
|
}
|
94
|
}
|