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.berlinModelImport;
|
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.ICdmDataSource;
|
18
|
import eu.etaxonomy.cdm.io.berlinModel.out.BerlinModelExportConfigurator;
|
19
|
import eu.etaxonomy.cdm.io.common.CdmDefaultExport;
|
20
|
import eu.etaxonomy.cdm.io.common.Source;
|
21
|
import eu.etaxonomy.cdm.io.common.IExportConfigurator.CHECK;
|
22
|
import eu.etaxonomy.cdm.io.common.IExportConfigurator.DO_REFERENCES;
|
23
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
24
|
|
25
|
|
26
|
/**
|
27
|
*
|
28
|
* @author a.mueller
|
29
|
*
|
30
|
*/
|
31
|
public class SalvadorExport {
|
32
|
@SuppressWarnings("unused")
|
33
|
private static final Logger logger = Logger.getLogger(SalvadorExport.class);
|
34
|
|
35
|
//database validation status (create, update, validate ...)
|
36
|
static final Source berlinModelDestination = BerlinModelDestinations.El_Salvador_Andreas();
|
37
|
static final ICdmDataSource cdmSource = CdmDestinations.localH2Salvador();
|
38
|
static final UUID secUuid = UUID.fromString("d03ef02a-f226-4cb1-bdb4-f6c154f08a34");
|
39
|
static final int sourceSecId = 7331;
|
40
|
static final int isHomotypicId = 72;
|
41
|
static boolean useClassification = true;
|
42
|
|
43
|
// static final UUID featureTreeUuid = UUID.fromString("ae9615b8-bc60-4ed0-ad96-897f9226d568");
|
44
|
// static final Object[] featureKeyList = new Integer[]{302, 303, 306, 307, 309, 310, 311, 312, 350, 1500, 1800, 1900, 1950, 1980, 2000, 10299};
|
45
|
|
46
|
//check - import
|
47
|
static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;
|
48
|
|
49
|
|
50
|
//NomenclaturalCode
|
51
|
static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICNAFP;
|
52
|
|
53
|
// ****************** ALL *****************************************
|
54
|
|
55
|
//authors
|
56
|
static final boolean doAuthors = true;
|
57
|
//references
|
58
|
static final DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
59
|
//names
|
60
|
static final boolean doTaxonNames = true;
|
61
|
static final boolean doRelNames = true;
|
62
|
static final boolean doTypes = false; //Types do not exist in El_Salvador DB
|
63
|
static final boolean doNameFacts = false; //Name Facts do not exist in El_Salvador DB
|
64
|
|
65
|
//taxa
|
66
|
static final boolean doTaxa = true;
|
67
|
static final boolean doRelTaxa = true;
|
68
|
static final boolean doFacts = true;
|
69
|
static final boolean doOccurences = false; //occurrences do not exist in Salvador
|
70
|
|
71
|
// ************************ NONE **************************************** //
|
72
|
|
73
|
// //authors
|
74
|
// static final boolean doAuthors = false;
|
75
|
// static final boolean doAuthorTeams = false;
|
76
|
// //references
|
77
|
// static final DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
78
|
// //names
|
79
|
// static final boolean doTaxonNames = true;
|
80
|
// static final boolean doTypes = false;
|
81
|
// static final boolean doNameFacts = false;
|
82
|
//
|
83
|
// //taxa
|
84
|
// static final boolean doTaxa = false;
|
85
|
// static final boolean doRelTaxa = false;
|
86
|
// static final boolean doFacts = false;
|
87
|
// static final boolean doOccurences = false;
|
88
|
//
|
89
|
|
90
|
public boolean doExport(ICdmDataSource source){
|
91
|
System.out.println("Start export to Berlin Model ("+ berlinModelDestination.getDatabase() + ") ...");
|
92
|
|
93
|
//make BerlinModel Source
|
94
|
Source destination = berlinModelDestination;
|
95
|
|
96
|
BerlinModelExportConfigurator bmExportConfigurator = BerlinModelExportConfigurator.NewInstance(destination, source);
|
97
|
|
98
|
// bmExportConfigurator.setSecUuid(secUuid);
|
99
|
// bmExportConfigurator.setSourceSecId(sourceSecId);
|
100
|
// bmExportConfigurator.setNomenclaturalCode(nomenclaturalCode);
|
101
|
|
102
|
bmExportConfigurator.setDoAuthors(doAuthors);
|
103
|
// bmExportConfigurator.setDoAuthorTeams(doAuthors);
|
104
|
bmExportConfigurator.setDoReferences(doReferences);
|
105
|
bmExportConfigurator.setDoTaxonNames(doTaxonNames);
|
106
|
bmExportConfigurator.setDoRelNames(doRelNames);
|
107
|
bmExportConfigurator.setDoNameFacts(doNameFacts);
|
108
|
|
109
|
bmExportConfigurator.setDoTaxa(doTaxa);
|
110
|
bmExportConfigurator.setDoRelTaxa(doRelTaxa);
|
111
|
bmExportConfigurator.setDoFacts(doFacts);
|
112
|
bmExportConfigurator.setDoOccurrence(doOccurences);
|
113
|
bmExportConfigurator.setIsHomotypicId(isHomotypicId);
|
114
|
bmExportConfigurator.setCheck(check);
|
115
|
bmExportConfigurator.setUseClassification(useClassification);
|
116
|
|
117
|
// invoke import
|
118
|
CdmDefaultExport<BerlinModelExportConfigurator> bmExport = new CdmDefaultExport<BerlinModelExportConfigurator>();
|
119
|
boolean result = bmExport.invoke(bmExportConfigurator);
|
120
|
|
121
|
System.out.println("End export to BerlinModel ("+ destination.getDatabase() + ")..." + (result? "(successful)":"(with errors)"));
|
122
|
return result;
|
123
|
}
|
124
|
|
125
|
|
126
|
|
127
|
/**
|
128
|
* @param args
|
129
|
*/
|
130
|
public static void main(String[] args) {
|
131
|
SalvadorExport ex = new SalvadorExport();
|
132
|
ICdmDataSource source = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmSource;
|
133
|
|
134
|
ex.doExport(source);
|
135
|
}
|
136
|
|
137
|
|
138
|
|
139
|
|
140
|
}
|