Revision 37c7b75c
Added by Andreas Müller over 2 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/MTMooseActivator.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
27 | 27 |
|
28 | 28 |
/** |
29 | 29 |
* TODO add the following to a wiki page: |
30 |
* HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen
|
|
30 |
* HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen |
|
31 | 31 |
* you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names. |
32 |
*
|
|
33 |
*
|
|
32 |
* |
|
33 |
* |
|
34 | 34 |
* @author a.mueller |
35 | 35 |
* |
36 | 36 |
*/ |
... | ... | |
40 | 40 |
//database validation status (create, update, validate ...) |
41 | 41 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE_DROP; |
42 | 42 |
static final Source berlinModelSource = BerlinModelSources.MT_MOOSE(); |
43 |
|
|
43 |
|
|
44 | 44 |
// static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); |
45 | 45 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_redlist_moose_dev(); |
46 | 46 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_redlist_moose_production(); |
47 | 47 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_moose(); |
48 | 48 |
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test(); |
49 |
|
|
49 |
|
|
50 | 50 |
static final UUID classificationUuid = UUID.fromString("601d8a00-cffe-4509-af93-b15b543ccf8d"); |
51 | 51 |
static final UUID sourceRefUuid = UUID.fromString("601d8a00-cffe-4509-af93-b15b543ccf8d"); |
52 |
|
|
52 |
|
|
53 | 53 |
// static final UUID featureTreeUuid = UUID.fromString("4c5b5bbe-6fef-4607-96b2-1b0104eac19e"); |
54 |
// static final Object[] featureKeyList = new Integer[]{7,201,202,203,204,205,206,207};
|
|
55 |
|
|
56 |
static final boolean includeFlatClassifications = true;
|
|
54 |
// static final Object[] featureKeyList = new Integer[]{7,201,202,203,204,205,206,207}; |
|
55 |
|
|
56 |
static final boolean includeFlatClassifications = true; |
|
57 | 57 |
|
58 |
static final String relPTaxonIdQuery = "SELECT * FROM RelPTaxon r " +
|
|
58 |
static final String relPTaxonIdQuery = "SELECT * FROM RelPTaxon r " + |
|
59 | 59 |
" WHERE NOT (r.PTRefFk1 <> r.PTRefFk2 AND r.RelQualifierFk = 1)"; |
60 |
|
|
60 |
|
|
61 | 61 |
//check - import |
62 | 62 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
63 | 63 |
|
64 | 64 |
|
65 | 65 |
//NomenclaturalCode |
66 | 66 |
static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICNAFP; |
67 |
|
|
67 |
|
|
68 | 68 |
static final EDITOR editor = EDITOR.EDITOR_AS_EDITOR; |
69 | 69 |
|
70 | 70 |
// ****************** ALL ***************************************** |
71 |
|
|
71 |
|
|
72 | 72 |
//authors |
73 | 73 |
static final boolean doAuthors = true; |
74 | 74 |
//references |
... | ... | |
77 | 77 |
static final boolean doTaxonNames = true; |
78 | 78 |
static final boolean doRelNames = true; |
79 | 79 |
static final boolean doNameStatus = true; |
80 |
static final boolean doTypes = true;
|
|
80 |
static final boolean doTypes = true; |
|
81 | 81 |
static final boolean doNameFacts = false; //no name facts exist |
82 |
|
|
82 |
|
|
83 | 83 |
//taxa |
84 | 84 |
static final boolean doTaxa = true; |
85 | 85 |
static final boolean doRelTaxa = true; |
... | ... | |
88 | 88 |
static final boolean doCommonNames = false; //no common names exist |
89 | 89 |
|
90 | 90 |
// ************************ NONE **************************************** // |
91 |
|
|
91 |
|
|
92 | 92 |
// //authors |
93 | 93 |
// static final boolean doAuthors = false; |
94 | 94 |
// //references |
... | ... | |
99 | 99 |
// static final boolean doNameStatus = false; |
100 | 100 |
// static final boolean doTypes = false; |
101 | 101 |
// static final boolean doNameFacts = false; |
102 |
//
|
|
102 |
// |
|
103 | 103 |
// //taxa |
104 | 104 |
// static final boolean doTaxa = false; |
105 | 105 |
// static final boolean doRelTaxa = false; |
106 | 106 |
// static final boolean doFacts = false; |
107 | 107 |
// static final boolean doOccurences = false; |
108 | 108 |
// static final boolean doCommonNames = false; |
109 |
|
|
110 |
|
|
109 |
|
|
110 |
|
|
111 | 111 |
public void invoke(String[] args){ |
112 | 112 |
System.out.println("Start import from BerlinModel("+ berlinModelSource.getDatabase() + ") ..."); |
113 | 113 |
logger.debug("Start"); |
114 | 114 |
//make BerlinModel Source |
115 | 115 |
Source source = berlinModelSource; |
116 | 116 |
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination; |
117 |
|
|
117 |
|
|
118 | 118 |
BerlinModelImportConfigurator config = BerlinModelImportConfigurator.NewInstance(source, destination); |
119 |
|
|
119 |
|
|
120 | 120 |
config.setClassificationUuid(classificationUuid); |
121 | 121 |
// bmImportConfigurator.setSourceSecId(sourceSecId); |
122 | 122 |
config.setNomenclaturalCode(nomenclaturalCode); |
... | ... | |
130 | 130 |
config.setDoNameStatus(doNameStatus); |
131 | 131 |
config.setDoTypes(doTypes); |
132 | 132 |
config.setDoNameFacts(doNameFacts); |
133 |
|
|
133 |
|
|
134 | 134 |
config.setDoTaxa(doTaxa); |
135 | 135 |
config.setDoRelTaxa(doRelTaxa); |
136 | 136 |
config.setDoFacts(doFacts); |
... | ... | |
138 | 138 |
config.setDoCommonNames(doCommonNames); |
139 | 139 |
config.setSourceRefUuid(sourceRefUuid); |
140 | 140 |
config.setRelTaxaIdQuery(relPTaxonIdQuery); |
141 |
|
|
141 |
|
|
142 | 142 |
config.setDbSchemaValidation(hbm2dll); |
143 | 143 |
|
144 | 144 |
config.setCheck(check); |
145 |
|
|
145 |
|
|
146 | 146 |
// invoke import |
147 | 147 |
CdmDefaultImport<BerlinModelImportConfigurator> bmImport = new CdmDefaultImport<BerlinModelImportConfigurator>(); |
148 | 148 |
bmImport.invoke(config); |
149 | 149 |
|
150 | 150 |
// if (doFacts && (config.getCheck().equals(CHECK.CHECK_AND_IMPORT) || config.getCheck().equals(CHECK.IMPORT_WITHOUT_CHECK) ) ){ |
151 | 151 |
// ICdmRepository app = bmImport.getCdmAppController(); |
152 |
//
|
|
152 |
// |
|
153 | 153 |
// //make feature tree |
154 | 154 |
// FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList); |
155 | 155 |
// FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION()); |
156 |
// tree.getRoot().addChild(distributionNode, 0);
|
|
157 |
// app.getFeatureTreeService().saveOrUpdate(tree);
|
|
156 |
// tree.getRoot().addChild(distributionNode, 0); |
|
157 |
// app.getTermTreeService().saveOrUpdate(tree);
|
|
158 | 158 |
// } |
159 |
|
|
160 |
|
|
159 |
|
|
160 |
|
|
161 | 161 |
System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")..."); |
162 | 162 |
} |
163 |
|
|
164 |
|
|
163 |
|
|
164 |
|
|
165 | 165 |
/** |
166 | 166 |
* @param args |
167 | 167 |
*/ |
Also available in: Unified diff
cleanup and remove usage of feature tree service