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.tcs;
|
11
|
|
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.common.IImportConfigurator.DO_REFERENCES;
|
22
|
import eu.etaxonomy.cdm.io.tcs.TcsImportConfigurator;
|
23
|
|
24
|
/**
|
25
|
* @author a.mueller
|
26
|
* @created 20.06.2008
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class PalmaeActivator {
|
30
|
private static Logger logger = Logger.getLogger(PalmaeActivator.class);
|
31
|
|
32
|
//database validation status (create, update, validate ...)
|
33
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
34
|
static final String tcsSource = TcsSources.arecaceae_local();
|
35
|
static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
|
36
|
// static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
|
37
|
|
38
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_portal_test_localhost();
|
39
|
|
40
|
static final UUID secUuid = UUID.fromString("5f32b8af-0c97-48ac-8d33-6099ed68c625");
|
41
|
static final String sourceSecId = "palm_pub_ed_999999";
|
42
|
//should the taxonX import run as well?
|
43
|
static final boolean includeTaxonX = false;
|
44
|
|
45
|
//check - import
|
46
|
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
|
47
|
|
48
|
//authors
|
49
|
static final boolean doAuthors = true;
|
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
|
//static final boolean doTypes = true;
|
57
|
//static final boolean doNameFacts = true;
|
58
|
|
59
|
//taxa
|
60
|
static final boolean doTaxa = true;
|
61
|
static final boolean doRelTaxa = true;
|
62
|
static final boolean doFacts = true;
|
63
|
|
64
|
|
65
|
|
66
|
private boolean doImport(){
|
67
|
boolean success = true;
|
68
|
System.out.println("Start import from Tcs("+ tcsSource.toString() + ") ...");
|
69
|
|
70
|
//make BerlinModel Source
|
71
|
String source = tcsSource;
|
72
|
ICdmDataSource destination = cdmDestination;
|
73
|
|
74
|
TcsImportConfigurator tcsImportConfigurator = TcsImportConfigurator.NewInstance(source, destination);
|
75
|
|
76
|
tcsImportConfigurator.setSecUuid(secUuid);
|
77
|
tcsImportConfigurator.setSourceSecId(sourceSecId);
|
78
|
|
79
|
tcsImportConfigurator.setDoAuthors(doAuthors);
|
80
|
tcsImportConfigurator.setDoReferences(doReferences);
|
81
|
tcsImportConfigurator.setDoTaxonNames(doTaxonNames);
|
82
|
tcsImportConfigurator.setDoRelNames(doRelNames);
|
83
|
//tcsImportConfigurator.setDoNameStatus(doNameStatus);
|
84
|
//tcsImportConfigurator.setDoTypes(doTypes);
|
85
|
//tcsImportConfigurator.setDoNameFacts(doNameFacts);
|
86
|
|
87
|
tcsImportConfigurator.setDoTaxa(doTaxa);
|
88
|
tcsImportConfigurator.setDoRelTaxa(doRelTaxa);
|
89
|
tcsImportConfigurator.setDoFacts(doFacts);
|
90
|
|
91
|
tcsImportConfigurator.setCheck(check);
|
92
|
tcsImportConfigurator.setDbSchemaValidation(hbm2dll);
|
93
|
|
94
|
// invoke import
|
95
|
CdmDefaultImport<TcsImportConfigurator> tcsImport = new CdmDefaultImport<TcsImportConfigurator>();
|
96
|
//new Test().invoke(tcsImportConfigurator);
|
97
|
success &= tcsImport.invoke(tcsImportConfigurator);
|
98
|
System.out.println("End import from TCS ("+ source.toString() + ")...");
|
99
|
|
100
|
return success;
|
101
|
}
|
102
|
|
103
|
/**
|
104
|
* @param args
|
105
|
*/
|
106
|
public static void main(String[] args) {
|
107
|
boolean success = true;
|
108
|
|
109
|
logger.debug("start");
|
110
|
PalmaeActivator me = new PalmaeActivator();
|
111
|
me.doImport();
|
112
|
|
113
|
if (includeTaxonX){
|
114
|
PalmaeTaxonXImportActivator taxonXimporter = new PalmaeTaxonXImportActivator();
|
115
|
PalmaeTaxonXImportActivator.cdmDestination = cdmDestination;
|
116
|
PalmaeTaxonXImportActivator.secUuid = secUuid;
|
117
|
success &= taxonXimporter.runImport();
|
118
|
}
|
119
|
|
120
|
String strSuccess = "";
|
121
|
if (success == false){
|
122
|
strSuccess = "not ";
|
123
|
}
|
124
|
System.out.println("Import " + strSuccess + "successful");
|
125
|
|
126
|
}
|
127
|
|
128
|
}
|