1
|
/**
|
2
|
* Copyright (C) 2007 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.caryophyllales;
|
10
|
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import eu.etaxonomy.cdm.app.berlinModelImport.SourceBase;
|
16
|
import eu.etaxonomy.cdm.app.common.CdmDestinations;
|
17
|
import eu.etaxonomy.cdm.common.URI;
|
18
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
19
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
20
|
import eu.etaxonomy.cdm.io.caryo.KewExcelTaxonImportConfigurator;
|
21
|
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
|
22
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
|
23
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
24
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
25
|
|
26
|
/**
|
27
|
* @author a.mueller
|
28
|
* @since 05.01.2022
|
29
|
*/
|
30
|
public class CaryophyllaceaeActivator extends SourceBase{
|
31
|
|
32
|
@SuppressWarnings("unused")
|
33
|
private static final Logger logger = Logger.getLogger(CaryophyllaceaeActivator.class);
|
34
|
|
35
|
//database validation status (create, update, validate ...)
|
36
|
static final DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
|
37
|
static final URI source = caryophyllaceae();
|
38
|
|
39
|
|
40
|
// static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
|
41
|
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_caryo_spp();
|
42
|
|
43
|
//classification
|
44
|
static final UUID classificationUuid = UUID.fromString("9edc58b5-de3b-43aa-9f31-1ede7c009c2b");
|
45
|
|
46
|
//check - import
|
47
|
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
|
48
|
|
49
|
//taxa
|
50
|
static final boolean doTaxa = true;
|
51
|
|
52
|
private void doImport(ICdmDataSource cdmDestination){
|
53
|
|
54
|
//make Source
|
55
|
KewExcelTaxonImportConfigurator config= KewExcelTaxonImportConfigurator.NewInstance(source, cdmDestination);
|
56
|
config.setClassificationUuid(classificationUuid);
|
57
|
config.setCheck(check);
|
58
|
// config.setDoTaxa(doTaxa);
|
59
|
config.setDbSchemaValidation(hbm2dll);
|
60
|
config.setSourceReferenceTitle("WCVP2CDM-Caryophyllaceae.xlsx");
|
61
|
|
62
|
CdmDefaultImport<KewExcelTaxonImportConfigurator> myImport = new CdmDefaultImport<>();
|
63
|
|
64
|
//...
|
65
|
if (true){
|
66
|
System.out.println("Start import from ("+ source.toString() + ") ...");
|
67
|
config.setSourceReference(getSourceReference(config.getSourceReferenceTitle()));
|
68
|
myImport.invoke(config);
|
69
|
System.out.println("End import from ("+ source.toString() + ")...");
|
70
|
}
|
71
|
}
|
72
|
|
73
|
private Reference getSourceReference(String string) {
|
74
|
Reference result = ReferenceFactory.newGeneric();
|
75
|
result.setTitleCache(string, true);
|
76
|
return result;
|
77
|
}
|
78
|
|
79
|
|
80
|
public static URI caryophyllaceae(){
|
81
|
String fileName = "WCVP2CDM-Caryophyllaceae.xlsx";
|
82
|
URI uri = URI.create("file:////BGBM-PESIHPC/Caryophyllales/" + fileName);
|
83
|
return uri;
|
84
|
}
|
85
|
|
86
|
public static void main(String[] args) {
|
87
|
CaryophyllaceaeActivator me = new CaryophyllaceaeActivator();
|
88
|
me.doImport(cdmDestination);
|
89
|
System.exit(0);
|
90
|
}
|
91
|
}
|