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
|
|
10
|
package eu.etaxonomy.cdm.app.synthesysImport;
|
11
|
|
12
|
import java.net.URI;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.app.common.CdmDestinations;
|
18
|
import eu.etaxonomy.cdm.app.common.CdmImportSources;
|
19
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
20
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
21
|
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
|
22
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
|
23
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;
|
24
|
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenSynthesysExcelImportConfigurator;
|
25
|
|
26
|
/**
|
27
|
* @author a.mueller
|
28
|
* @since 20.06.2008
|
29
|
* @version 1.0
|
30
|
*/
|
31
|
public class SynthesysSpecimenTestActivator {
|
32
|
private static final Logger logger = Logger.getLogger(SynthesysSpecimenTestActivator.class);
|
33
|
|
34
|
//database validation status (create, update, validate ...)
|
35
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
36
|
// static final String mySources = TcsSources.taxonX_local();
|
37
|
static final URI mySource = CdmImportSources.SYNTHESYS_SPECIMEN();
|
38
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_tdwg2010();
|
39
|
static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
|
40
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest();
|
41
|
|
42
|
static final UUID treeUuid = UUID.fromString("190d9456-12e8-47a4-a235-bab36adb247c");
|
43
|
static final String sourceSecId = "TestSynthesysSpecimen";
|
44
|
|
45
|
//check - import
|
46
|
static final CHECK check = CHECK.CHECK_AND_IMPORT;
|
47
|
|
48
|
static final boolean doMatchTaxa = true;
|
49
|
|
50
|
//references
|
51
|
static final DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
52
|
//names
|
53
|
static final boolean doTaxonNames = true;
|
54
|
static final boolean doRelNames = true;
|
55
|
|
56
|
//taxa
|
57
|
static final boolean doTaxa = true;
|
58
|
static final boolean doRelTaxa = true;
|
59
|
|
60
|
|
61
|
public void doImport(ICdmDataSource destination, DbSchemaValidation hbm2dll){
|
62
|
System.out.println("Start import from Tcs("+ mySource.toString() + ") ...");
|
63
|
|
64
|
SpecimenSynthesysExcelImportConfigurator config = SpecimenSynthesysExcelImportConfigurator.NewInstance(mySource, destination,false);
|
65
|
config.setInteractWithUser(false);
|
66
|
config.setClassificationUuid(treeUuid);
|
67
|
config.setSourceSecId(sourceSecId);
|
68
|
|
69
|
// config.setDoReferences(doReferences);
|
70
|
// config.setDoTaxonNames(doTaxonNames);
|
71
|
//
|
72
|
// config.setDoMatchTaxa(doMatchTaxa);
|
73
|
// config.setDoTaxa(doTaxa);
|
74
|
// config.setDoRelTaxa(doRelTaxa);
|
75
|
|
76
|
config.setCheck(check);
|
77
|
config.setDbSchemaValidation(hbm2dll);
|
78
|
|
79
|
// invoke import
|
80
|
CdmDefaultImport<SpecimenSynthesysExcelImportConfigurator> myImport = new CdmDefaultImport<SpecimenSynthesysExcelImportConfigurator>();
|
81
|
//new Test().invoke(tcsImportConfigurator);
|
82
|
myImport.invoke(config);
|
83
|
|
84
|
|
85
|
logger.info("End");
|
86
|
System.out.println("End import from Normal Explicit ("+ mySource.toString() + ")...");
|
87
|
|
88
|
}
|
89
|
|
90
|
/**
|
91
|
* @param args
|
92
|
*/
|
93
|
public static void main(String[] args) {
|
94
|
SynthesysSpecimenTestActivator me = new SynthesysSpecimenTestActivator();
|
95
|
me.doImport(cdmDestination, hbm2dll);
|
96
|
}
|
97
|
|
98
|
}
|