Revision f3715fb4
Added by Patricia Kelbert about 10 years ago
.gitattributes | ||
---|---|---|
1 | 1 |
* text=auto !eol |
2 |
/LICENSE.TXT -text |
|
3 |
/README.TXT -text |
|
2 | 4 |
XperCdmIntegration/pom.xml -text |
3 | 5 |
XperCdmIntegration/src/main/java/eu/etaxonomy/cdm/io/xper/BaseCdm.java -text |
4 | 6 |
XperCdmIntegration/src/main/java/eu/etaxonomy/cdm/io/xper/CdmXperAdapter.java -text |
... | ... | |
411 | 413 |
cdm-pesi/src/test/java/eu/etaxonomy/cdm/io/erms/ermsErrors.txt -text |
412 | 414 |
cdm-pesi/src/test/resources/sql/Check_Import_Master.sql -text |
413 | 415 |
cdmapps-parent/pom.xml -text |
416 |
/pom.xml -text |
LICENSE.TXT | ||
---|---|---|
1 |
The contents of this file are subject to the Mozilla Public License |
|
2 |
Version 1.1 (the "License"); you may not use this file except in |
|
3 |
compliance with the License. You may obtain a copy of the License at |
|
4 |
http://www.mozilla.org/MPL/ |
|
5 |
|
|
6 |
Software distributed under the License is distributed on an "AS IS" |
|
7 |
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
8 |
License for the specific language governing rights and limitations |
|
9 |
under the License. |
README.TXT | ||
---|---|---|
1 |
The project uses Maven2 and AspectJ. |
|
2 |
|
|
3 |
Please see http://dev.e-taxonomy.eu/trac/wiki/CdmLibrary for details on installation and usage |
XperCdmIntegration/pom.xml | ||
---|---|---|
14 | 14 |
<modelVersion>4.0.0</modelVersion> |
15 | 15 |
<artifactId>xper2-cdm-integration</artifactId> |
16 | 16 |
<name>xper2 Cdm Integration</name> |
17 |
<description>The Xper integration package for EDIT's CdmLibrary</description>
|
|
17 |
<description>The import-export package for EDIT's cdmLibrary</description>
|
|
18 | 18 |
<scm> |
19 | 19 |
<connection>scm:svn:http://dev.e-taxonomy.eu/svn/trunk/cdmlib-apps/XperCdmIntegration/</connection> |
20 | 20 |
<developerConnection>scm:svn:https://dev.e-taxonomy.eu/svn/trunk/cdmlib-apps/XperCdmIntegration/</developerConnection> |
app-import/src/main/java/eu/etaxonomy/cdm/app/abcdImport/SpecimenImport.java | ||
---|---|---|
25 | 25 |
private static Logger logger = Logger.getLogger(SpecimenImport.class); |
26 | 26 |
|
27 | 27 |
//database validation status (create, update, validate ...) |
28 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
|
28 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
|
|
29 | 29 |
// final static String xmlSource = "/home/patricia/Desktop/multiABCD.xml"; |
30 | 30 |
//final static String xmlSource = "D:\\_Tagungen\\2010-09 TDWG 2010\\Workshop\\data\\specimen\\Picris pauciflora\\B-W14632-000_B-W14632-010_B100097145_B100097146_B100326668_B180004364_B180017717_.xml"; |
31 | 31 |
// final static String xmlSource = "/home/pkelbert/workspace/proibiosphere/cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/specimen/abcd206/in/SpecimenImportConfiguratorTest-input.xml"; |
... | ... | |
54 | 54 |
ICdmDataSource destination = cdmDestination; |
55 | 55 |
Abcd206ImportConfigurator specimenImportConfigurator = Abcd206ImportConfigurator.NewInstance(source, destination); |
56 | 56 |
|
57 |
// specimenImportConfigurator.setClassificationName(specimenImportConfigurator.getSourceReferenceTitle()); |
|
57 |
//// specimenImportConfigurator.setClassificationName(specimenImportConfigurator.getSourceReferenceTitle());
|
|
58 | 58 |
specimenImportConfigurator.setSourceSecId("specimen"); |
59 | 59 |
specimenImportConfigurator.setCheck(check); |
60 | 60 |
specimenImportConfigurator.setDbSchemaValidation(hbm2dll); |
61 |
specimenImportConfigurator.setParseNameAutomatically(false);
|
|
61 |
specimenImportConfigurator.setParseNameAutomatically(true);
|
|
62 | 62 |
specimenImportConfigurator.setReuseExistingMetadata(true); |
63 |
specimenImportConfigurator.reuseExistingDescriptiveGroups(false);
|
|
64 |
|
|
63 |
specimenImportConfigurator.reuseExistingDescriptiveGroups(true);
|
|
64 |
// |
|
65 | 65 |
specimenImportConfigurator.setReuseExistingTaxaWhenPossible(true); |
66 |
|
|
66 |
// |
|
67 | 67 |
specimenImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(true); |
68 | 68 |
specimenImportConfigurator.setUseClassification(true); |
69 | 69 |
specimenImportConfigurator.setInteractWithUser(true); |
70 |
|
|
70 |
// |
|
71 | 71 |
specimenImportConfigurator.setSourceReference(null); |
72 | 72 |
specimenImportConfigurator.setTaxonReference(null); |
73 | 73 |
|
app-import/src/main/java/eu/etaxonomy/cdm/app/abcdImport/SynthesysCacheActivator.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
// static final ICdmDataSource cdmDestination = CdmDestinations.mon_cdm(); |
44 | 44 |
// static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE; |
45 |
static final ICdmDataSource cdmDestination = CdmDestinations.proibiosphere_local(); |
|
45 |
static final ICdmDataSource cdmDestination = CdmDestinations.proibiosphere_chenopodium_local();
|
|
46 | 46 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE; |
47 | 47 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
48 | 48 |
|
app-import/src/main/java/eu/etaxonomy/cdm/app/common/CdmDestinations.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 |
*/ |
... | ... | |
22 | 22 |
public class CdmDestinations { |
23 | 23 |
@SuppressWarnings("unused") |
24 | 24 |
private static Logger logger = Logger.getLogger(CdmDestinations.class); |
25 |
|
|
25 |
|
|
26 | 26 |
/** |
27 | 27 |
* Intended to be used for imports |
28 | 28 |
*/ |
... | ... | |
37 | 37 |
public static ICdmDataSource cdm_test_alex(){ |
38 | 38 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
39 | 39 |
String cdmServer = "192.168.2.10"; |
40 |
String cdmDB = "cdm_production_palmae";
|
|
40 |
String cdmDB = "cdm_production_palmae"; |
|
41 | 41 |
String cdmUserName = "edit"; |
42 | 42 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
43 | 43 |
} |
44 |
|
|
44 |
|
|
45 | 45 |
|
46 | 46 |
public static ICdmDataSource cdm_test_useSummary(){ |
47 | 47 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
48 | 48 |
String cdmServer = "localhost"; |
49 |
String cdmDB = "palmae_2011_07_17";
|
|
49 |
String cdmDB = "palmae_2011_07_17"; |
|
50 | 50 |
String cdmUserName = "root"; |
51 | 51 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
52 | 52 |
} |
53 |
|
|
53 |
|
|
54 | 54 |
public static ICdmDataSource cdm_test_local_mysql(){ |
55 | 55 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
56 | 56 |
String cdmServer = "127.0.0.1"; |
57 |
String cdmDB = "cdm_test";
|
|
57 |
String cdmDB = "cdm_test"; |
|
58 | 58 |
String cdmUserName = "edit"; |
59 | 59 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
60 | 60 |
} |
61 |
|
|
62 |
|
|
61 |
|
|
62 |
|
|
63 | 63 |
public static ICdmDataSource cdm_test_local_mysql_moose(){ |
64 | 64 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
65 | 65 |
String cdmServer = "127.0.0.1"; |
66 |
String cdmDB = "moose";
|
|
66 |
String cdmDB = "moose"; |
|
67 | 67 |
String cdmUserName = "root"; |
68 | 68 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
69 | 69 |
} |
70 |
|
|
70 |
|
|
71 | 71 |
public static ICdmDataSource cdm_test_local_mysql_standardliste(){ |
72 | 72 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
73 | 73 |
String cdmServer = "127.0.0.1"; |
74 |
String cdmDB = "standardliste";
|
|
74 |
String cdmDB = "standardliste"; |
|
75 | 75 |
String cdmUserName = "root"; |
76 | 76 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
77 | 77 |
} |
78 |
|
|
79 | 78 |
public static ICdmDataSource cdm_test_local_mysql_standardliste2(){ |
80 | 79 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
81 | 80 |
String cdmServer = "127.0.0.1"; |
... | ... | |
84 | 83 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
85 | 84 |
} |
86 | 85 |
|
86 |
|
|
87 | 87 |
public static ICdmDataSource cdm_test_local_mysql_dwca(){ |
88 | 88 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
89 | 89 |
String cdmServer = "127.0.0.1"; |
90 |
String cdmDB = "dwca";
|
|
90 |
String cdmDB = "dwca"; |
|
91 | 91 |
String cdmUserName = "edit"; |
92 | 92 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
93 | 93 |
} |
94 | 94 |
|
95 |
|
|
95 |
|
|
96 | 96 |
public static ICdmDataSource cdm_test_local_mysql_fdac(){ |
97 | 97 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
98 | 98 |
String cdmServer = "127.0.0.1"; |
99 |
String cdmDB = "fdac";
|
|
99 |
String cdmDB = "fdac"; |
|
100 | 100 |
String cdmUserName = "edit"; |
101 | 101 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
102 | 102 |
} |
103 |
|
|
103 |
|
|
104 | 104 |
public static ICdmDataSource cdm_test_local_mysql_test(){ |
105 | 105 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
106 | 106 |
String cdmServer = "127.0.0.1"; |
107 |
String cdmDB = "test";
|
|
107 |
String cdmDB = "test"; |
|
108 | 108 |
String cdmUserName = "edit"; |
109 | 109 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
110 | 110 |
} |
111 |
|
|
111 |
|
|
112 | 112 |
public static ICdmDataSource cdm_corvidae_dev(){ |
113 | 113 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
114 | 114 |
String cdmServer = "160.45.63.201"; |
115 |
String cdmDB = "cdm_corvidae";
|
|
115 |
String cdmDB = "cdm_corvidae"; |
|
116 | 116 |
String cdmUserName = "edit"; |
117 | 117 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
118 | 118 |
} |
... | ... | |
124 | 124 |
String cdmUserName = "edit"; |
125 | 125 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
126 | 126 |
} |
127 |
|
|
127 |
|
|
128 | 128 |
// |
129 | 129 |
// public static ICdmDataSource cdm_ildis_production(){ |
130 | 130 |
// DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
... | ... | |
133 | 133 |
// String cdmUserName = "edit"; |
134 | 134 |
// return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
135 | 135 |
// } |
136 |
|
|
136 |
|
|
137 | 137 |
|
138 | 138 |
public static ICdmDataSource cdm_redlist_moose_dev(){ |
139 | 139 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
... | ... | |
142 | 142 |
String cdmUserName = "edit"; |
143 | 143 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
144 | 144 |
} |
145 |
|
|
145 |
|
|
146 | 146 |
public static ICdmDataSource cdm_redlist_standardlist_dev(){ |
147 | 147 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
148 | 148 |
String cdmServer = "160.45.63.201"; |
... | ... | |
150 | 150 |
String cdmUserName = "edit"; |
151 | 151 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
152 | 152 |
} |
153 |
|
|
153 |
|
|
154 | 154 |
public static ICdmDataSource cdm_cyprus_dev(){ |
155 | 155 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
156 | 156 |
String cdmServer = "160.45.63.201"; |
... | ... | |
158 | 158 |
String cdmUserName = "edit"; |
159 | 159 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
160 | 160 |
} |
161 |
|
|
161 |
|
|
162 | 162 |
public static ICdmDataSource cdm_cyprus_production(){ |
163 | 163 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
164 | 164 |
String cdmServer = "160.45.63.171"; |
... | ... | |
175 | 175 |
String cdmUserName = "edit"; |
176 | 176 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
177 | 177 |
} |
178 |
|
|
178 |
|
|
179 | 179 |
public static ICdmDataSource cdm_cyprus_dev_tunnel(){ |
180 | 180 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
181 | 181 |
String cdmServer = "127.0.0.1"; |
... | ... | |
184 | 184 |
String cdmUserName = "edit"; |
185 | 185 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
186 | 186 |
} |
187 |
|
|
187 |
|
|
188 | 188 |
public static ICdmDataSource cdm_campanulaceae_production(){ |
189 | 189 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
190 | 190 |
String cdmServer = "160.45.63.171"; |
... | ... | |
192 | 192 |
String cdmUserName = "edit"; |
193 | 193 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
194 | 194 |
} |
195 |
|
|
195 |
|
|
196 | 196 |
public static ICdmDataSource cdm_flora_malesiana_preview(){ |
197 | 197 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
198 | 198 |
String cdmServer = "160.45.63.201"; |
... | ... | |
208 | 208 |
String cdmUserName = "edit"; |
209 | 209 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
210 | 210 |
} |
211 |
|
|
211 |
|
|
212 | 212 |
public static ICdmDataSource cdm_flora_central_africa_preview(){ |
213 | 213 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
214 | 214 |
String cdmServer = "160.45.63.201"; |
... | ... | |
216 | 216 |
String cdmUserName = "edit"; |
217 | 217 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
218 | 218 |
} |
219 |
|
|
219 |
|
|
220 | 220 |
public static ICdmDataSource cdm_flora_central_africa_production(){ |
221 | 221 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
222 | 222 |
String cdmServer = "160.45.63.171"; |
... | ... | |
224 | 224 |
String cdmUserName = "edit"; |
225 | 225 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
226 | 226 |
} |
227 |
|
|
227 |
|
|
228 | 228 |
public static ICdmDataSource cdm_pesi_euroMed(){ |
229 | 229 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
230 | 230 |
String cdmServer = "192.168.2.10"; |
... | ... | |
232 | 232 |
String cdmUserName = "edit"; |
233 | 233 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
234 | 234 |
} |
235 |
|
|
235 |
|
|
236 | 236 |
public static ICdmDataSource cdm_pesi_all(){ |
237 | 237 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
238 | 238 |
String cdmServer = "192.168.2.10"; |
... | ... | |
240 | 240 |
String cdmUserName = "edit"; |
241 | 241 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
242 | 242 |
} |
243 |
|
|
243 |
|
|
244 | 244 |
public static ICdmDataSource cdm_portal_test_localhost(){ |
245 | 245 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
246 | 246 |
String cdmServer = "127.0.0.1"; |
... | ... | |
248 | 248 |
String cdmUserName = "edit"; |
249 | 249 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
250 | 250 |
} |
251 |
|
|
251 |
|
|
252 | 252 |
public static ICdmDataSource cdm_portal_test_localhost2(){ |
253 | 253 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
254 | 254 |
String cdmServer = "127.0.0.1"; |
... | ... | |
256 | 256 |
String cdmUserName = "edit"; |
257 | 257 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
258 | 258 |
} |
259 |
|
|
259 |
|
|
260 | 260 |
public static ICdmDataSource cdm_local_cichorieae(){ |
261 | 261 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
262 | 262 |
String cdmServer = "127.0.0.1"; |
... | ... | |
264 | 264 |
String cdmUserName = "edit"; |
265 | 265 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
266 | 266 |
} |
267 |
|
|
267 |
|
|
268 | 268 |
public static ICdmDataSource cdm_local_dipera(){ |
269 | 269 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
270 | 270 |
String cdmServer = "127.0.0.1"; |
... | ... | |
272 | 272 |
String cdmUserName = "edit"; |
273 | 273 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
274 | 274 |
} |
275 |
|
|
275 |
|
|
276 | 276 |
public static ICdmDataSource cdm_local_palmae(){ |
277 | 277 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
278 | 278 |
String cdmServer = "127.0.0.1"; |
... | ... | |
280 | 280 |
String cdmUserName = "edit"; |
281 | 281 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
282 | 282 |
} |
283 |
|
|
283 |
|
|
284 | 284 |
public static ICdmDataSource cdm_globis_dev(){ |
285 | 285 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
286 | 286 |
String cdmServer = "160.45.63.201"; |
... | ... | |
288 | 288 |
String cdmUserName = "edit"; |
289 | 289 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
290 | 290 |
} |
291 |
|
|
291 |
|
|
292 | 292 |
public static ICdmDataSource cdm_local_globis(){ |
293 | 293 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
294 | 294 |
String cdmServer = "127.0.0.1"; |
... | ... | |
312 | 312 |
String cdmUserName = "edit"; |
313 | 313 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
314 | 314 |
} |
315 |
|
|
316 |
|
|
315 |
|
|
316 |
|
|
317 | 317 |
public static ICdmDataSource NULL(){ |
318 | 318 |
return null; |
319 | 319 |
} |
320 |
|
|
321 |
|
|
320 |
|
|
321 |
|
|
322 | 322 |
public static ICdmDataSource localH2(){ |
323 | 323 |
return CdmDataSource.NewH2EmbeddedInstance("cdm", "sa", ""); |
324 | 324 |
} |
325 |
|
|
325 |
|
|
326 | 326 |
public static ICdmDataSource localH2(String database, String username, String filePath){ |
327 | 327 |
return CdmDataSource.NewH2EmbeddedInstance(database, "sa", "", filePath, null); |
328 | 328 |
} |
329 |
|
|
329 |
|
|
330 | 330 |
public static ICdmDataSource localH2Salvador(){ |
331 | 331 |
return CdmDataSource.NewH2EmbeddedInstance("salvador", "sa", ""); |
332 | 332 |
} |
333 |
|
|
333 |
|
|
334 | 334 |
public static ICdmDataSource localH2Diptera(){ |
335 | 335 |
return CdmDataSource.NewH2EmbeddedInstance("diptera", "sa", ""); |
336 | 336 |
} |
337 |
|
|
338 |
|
|
337 |
|
|
338 |
|
|
339 | 339 |
public static ICdmDataSource localH2Cichorieae(){ |
340 | 340 |
return CdmDataSource.NewH2EmbeddedInstance("cichorieae", "sa", ""); |
341 | 341 |
} |
342 |
|
|
342 |
|
|
343 | 343 |
public static ICdmDataSource localH2Palmae(){ |
344 | 344 |
return CdmDataSource.NewH2EmbeddedInstance("palmae", "sa", ""); |
345 | 345 |
} |
346 |
|
|
346 |
|
|
347 | 347 |
public static ICdmDataSource localH2EuroMed(){ |
348 | 348 |
return CdmDataSource.NewH2EmbeddedInstance("euroMed", "sa", ""); |
349 | 349 |
} |
350 |
|
|
350 |
|
|
351 | 351 |
public static ICdmDataSource localH2Erms(){ |
352 | 352 |
return CdmDataSource.NewH2EmbeddedInstance("erms", "sa", ""); |
353 | 353 |
} |
354 |
|
|
354 |
|
|
355 | 355 |
public static ICdmDataSource localH2_viola(){ |
356 | 356 |
return CdmDataSource.NewH2EmbeddedInstance("testViola", "sa", ""); |
357 | 357 |
} |
358 |
|
|
358 |
|
|
359 | 359 |
public static ICdmDataSource localH2_LIAS(){ |
360 | 360 |
return CdmDataSource.NewH2EmbeddedInstance("testLIAS", "sa", ""); |
361 | 361 |
} |
362 |
|
|
362 |
|
|
363 | 363 |
public static ICdmDataSource localH2_Erythroneura(){ |
364 | 364 |
return CdmDataSource.NewH2EmbeddedInstance("testErythroneura", "sa", ""); |
365 | 365 |
} |
366 |
|
|
366 |
|
|
367 | 367 |
public static ICdmDataSource localH2_Cicad(){ |
368 | 368 |
return CdmDataSource.NewH2EmbeddedInstance("testCicad", "sa", ""); |
369 | 369 |
} |
370 |
|
|
370 |
|
|
371 | 371 |
public static ICdmDataSource localH2_ValRosandraFRIDAKey(){ |
372 | 372 |
return CdmDataSource.NewH2EmbeddedInstance("testValRosandraFRIDAKey", "sa", ""); |
373 | 373 |
} |
374 |
|
|
374 |
|
|
375 | 375 |
public static ICdmDataSource localH2_FreshwaterAquaticInsects(){ |
376 | 376 |
return CdmDataSource.NewH2EmbeddedInstance("testFreshwaterAquaticInsects", "sa", ""); |
377 | 377 |
} |
... | ... | |
379 | 379 |
public static ICdmDataSource cdm_algaterra_preview(){ |
380 | 380 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
381 | 381 |
String cdmServer = "160.45.63.201"; |
382 |
String cdmDB = "cdm_edit_algaterra";
|
|
382 |
String cdmDB = "cdm_edit_algaterra"; |
|
383 | 383 |
String cdmUserName = "edit"; |
384 | 384 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
385 | 385 |
} |
... | ... | |
387 | 387 |
public static ICdmDataSource cdm_algaterra_production(){ |
388 | 388 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
389 | 389 |
String cdmServer = "160.45.63.171"; |
390 |
String cdmDB = "cdm_production_algaterra";
|
|
390 |
String cdmDB = "cdm_production_algaterra"; |
|
391 | 391 |
String cdmUserName = "edit"; |
392 | 392 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
393 | 393 |
} |
394 |
|
|
394 |
|
|
395 | 395 |
public static ICdmDataSource cdm_edit_cichorieae_local_PG(){ |
396 | 396 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.PostgreSQL; |
397 | 397 |
String cdmServer = "127.0.0.1"; |
398 |
String cdmDB = "cdm_edit_cichorieae_a";
|
|
398 |
String cdmDB = "cdm_edit_cichorieae_a"; |
|
399 | 399 |
String cdmUserName = "edit"; |
400 | 400 |
int port = 15432; |
401 | 401 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
... | ... | |
404 | 404 |
public static ICdmDataSource cdm_cichorieae_preview(){ |
405 | 405 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
406 | 406 |
String cdmServer = "160.45.63.201"; |
407 |
String cdmDB = "cdm_edit_cichorieae";
|
|
407 |
String cdmDB = "cdm_edit_cichorieae"; |
|
408 | 408 |
String cdmUserName = "edit"; |
409 | 409 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
410 | 410 |
} |
411 |
|
|
411 |
|
|
412 | 412 |
public static ICdmDataSource cdm_production_cichorieae(){ |
413 | 413 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
414 | 414 |
String cdmServer = "160.45.63.171"; |
415 | 415 |
// String cdmServer = "127.0.0.1"; |
416 |
String cdmDB = "cdm_production_cichorieae";
|
|
416 |
String cdmDB = "cdm_production_cichorieae"; |
|
417 | 417 |
String cdmUserName = "edit"; |
418 | 418 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
419 | 419 |
} |
420 |
|
|
420 |
|
|
421 | 421 |
public static ICdmDataSource cdm_production_palmae(){ |
422 | 422 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
423 | 423 |
String cdmServer = "160.45.63.171"; |
424 |
String cdmDB = "cdm_production_palmae";
|
|
424 |
String cdmDB = "cdm_production_palmae"; |
|
425 | 425 |
String cdmUserName = "edit"; |
426 | 426 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
427 | 427 |
} |
428 |
|
|
429 |
|
|
428 |
|
|
429 |
|
|
430 | 430 |
public static ICdmDataSource cdm_production_diptera(){ |
431 | 431 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
432 | 432 |
String cdmServer = "160.45.63.171"; |
433 |
String cdmDB = "cdm_production_diptera";
|
|
433 |
String cdmDB = "cdm_production_diptera"; |
|
434 | 434 |
String cdmUserName = "edit"; |
435 | 435 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
436 | 436 |
} |
437 |
|
|
437 |
|
|
438 | 438 |
public static ICdmDataSource local_cdm_edit_cichorieae_a(){ |
439 | 439 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
440 | 440 |
String cdmServer = "127.0.0.1"; |
441 |
String cdmDB = "cdm_edit_cichorieae_a";
|
|
441 |
String cdmDB = "cdm_edit_cichorieae_a"; |
|
442 | 442 |
String cdmUserName = "edit"; |
443 | 443 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
444 | 444 |
} |
... | ... | |
450 | 450 |
String cdmUserName = "edit"; |
451 | 451 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
452 | 452 |
} |
453 |
|
|
453 |
|
|
454 | 454 |
public static ICdmDataSource cdm_edit_cichorieae_preview(){ |
455 | 455 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
456 | 456 |
String cdmServer = "127.0.0.1"; |
457 |
String cdmDB = "cdm_edit_cichorieae";
|
|
457 |
String cdmDB = "cdm_edit_cichorieae"; |
|
458 | 458 |
String cdmUserName = "edit"; |
459 | 459 |
int port = 13306; |
460 | 460 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
461 | 461 |
} |
462 |
|
|
462 |
|
|
463 | 463 |
public static ICdmDataSource cdm_edit_cichorieae_preview_direct(){ |
464 | 464 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
465 | 465 |
String cdmServer = "160.45.63.201"; |
466 |
String cdmDB = "cdm_edit_cichorieae";
|
|
466 |
String cdmDB = "cdm_edit_cichorieae"; |
|
467 | 467 |
String cdmUserName = "edit"; |
468 | 468 |
int port = 3306; |
469 | 469 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
470 | 470 |
} |
471 |
|
|
471 |
|
|
472 | 472 |
public static ICdmDataSource cdm_edit_cichorieae_integration(){ |
473 | 473 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
474 | 474 |
String cdmServer = "127.0.0.1"; |
475 |
String cdmDB = "cdm_integration_cichorieae";
|
|
475 |
String cdmDB = "cdm_integration_cichorieae"; |
|
476 | 476 |
String cdmUserName = "edit"; |
477 | 477 |
int port = 13306; |
478 | 478 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
... | ... | |
481 | 481 |
public static ICdmDataSource cdm_edit_palmae_preview(){ |
482 | 482 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
483 | 483 |
String cdmServer = "127.0.0.1"; |
484 |
String cdmDB = "cdm_edit_palmae";
|
|
484 |
String cdmDB = "cdm_edit_palmae"; |
|
485 | 485 |
String cdmUserName = "edit"; |
486 | 486 |
int port = 13306; |
487 | 487 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
488 |
}
|
|
489 |
|
|
488 |
} |
|
489 |
|
|
490 | 490 |
public static ICdmDataSource cdm_edit_salvador(){ |
491 | 491 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
492 | 492 |
String cdmServer = "192.168.2.10"; |
493 |
String cdmDB = "cdm_edit_salvador";
|
|
493 |
String cdmDB = "cdm_edit_salvador"; |
|
494 | 494 |
String cdmUserName = "edit"; |
495 | 495 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
496 | 496 |
} |
497 |
|
|
497 |
|
|
498 | 498 |
public static ICdmDataSource cdm_import_salvador() { |
499 | 499 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
500 | 500 |
String cdmServer = "192.168.2.10"; |
501 |
String cdmDB = "cdm_import_salvador";
|
|
501 |
String cdmDB = "cdm_import_salvador"; |
|
502 | 502 |
String cdmUserName = "edit"; |
503 | 503 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
504 | 504 |
} |
505 |
|
|
505 |
|
|
506 | 506 |
public static ICdmDataSource cdm_salvador_production() { |
507 | 507 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
508 | 508 |
String cdmServer = "192.168.2.10"; |
509 |
String cdmDB = "salvador_cdm";
|
|
509 |
String cdmDB = "salvador_cdm"; |
|
510 | 510 |
String cdmUserName = "salvador"; |
511 | 511 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
512 | 512 |
} |
513 |
|
|
513 |
|
|
514 | 514 |
/** |
515 | 515 |
* patricia |
516 | 516 |
*/ |
... | ... | |
521 | 521 |
String cdmUserName = "root"; |
522 | 522 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
523 | 523 |
} |
524 |
|
|
525 |
public static ICdmDataSource proibiosphere_local() { |
|
524 |
|
|
525 |
public static ICdmDataSource mon_corvids() { |
|
526 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
|
527 |
String cdmServer = "localhost"; |
|
528 |
String cdmDB = "cdm_production_corvidae"; |
|
529 |
String cdmUserName = "root"; |
|
530 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, "mysqlr00t"); |
|
531 |
} |
|
532 |
|
|
533 |
public static ICdmDataSource proibiosphere_chenopodium_local() { |
|
526 | 534 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
527 | 535 |
String cdmServer = "localhost"; |
528 | 536 |
String cdmDB = "cdm_production_proibiosphere_chenopodium_pilot"; |
529 | 537 |
String cdmUserName = "root"; |
530 | 538 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
531 | 539 |
} |
532 |
|
|
540 |
|
|
541 |
public static ICdmDataSource proibiosphere_ants_local() { |
|
542 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
|
543 |
String cdmServer = "localhost"; |
|
544 |
String cdmDB = "cdm_production_proibiosphere_ants_pilot"; |
|
545 |
String cdmUserName = "root"; |
|
546 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
|
547 |
} |
|
548 |
|
|
549 |
public static ICdmDataSource proibiosphere_fungi_local() { |
|
550 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
|
551 |
String cdmServer = "localhost"; |
|
552 |
String cdmDB = "cdm_production_proibiosphere_fungi_pilot"; |
|
553 |
String cdmUserName = "root"; |
|
554 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
|
555 |
} |
|
556 |
|
|
557 |
public static ICdmDataSource proibiosphere_campylopus_local() { |
|
558 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
|
559 |
String cdmServer = "localhost"; |
|
560 |
String cdmDB = "cdm_production_proibiosphere_campylopus_pilot"; |
|
561 |
String cdmUserName = "root"; |
|
562 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
|
563 |
} |
|
564 |
|
|
565 |
|
|
566 |
public static ICdmDataSource proibiosphere_eupolybothrus_local() { |
|
567 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
|
568 |
String cdmServer = "localhost"; |
|
569 |
String cdmDB = "cdm_production_proibiosphere_eupolybothrus_pilot"; |
|
570 |
String cdmUserName = "root"; |
|
571 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
|
572 |
} |
|
573 |
|
|
574 |
public static ICdmDataSource proibiosphere_spiders_local() { |
|
575 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
|
576 |
String cdmServer = "localhost"; |
|
577 |
String cdmDB = "cdm_production_proibiosphere_spiders_pilot"; |
|
578 |
String cdmUserName = "root"; |
|
579 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
|
580 |
} |
|
533 | 581 |
// public static ICdmDataSource LAPTOP_HP(){ |
534 | 582 |
// DatabaseTypeEnum dbType = DatabaseTypeEnum.SqlServer2005; |
535 | 583 |
// String cdmServer = "LAPTOPHP"; |
536 |
// String cdmDB = "cdmTest";
|
|
584 |
// String cdmDB = "cdmTest"; |
|
537 | 585 |
// String cdmUserName = "edit"; |
538 | 586 |
// return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null); |
539 | 587 |
// } |
540 |
|
|
541 |
|
|
542 | 588 |
|
543 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
544 | 592 |
/** |
545 | 593 |
* initializes source |
546 | 594 |
* TODO only supports MySQL and PostgreSQL |
547 |
*
|
|
595 |
* |
|
548 | 596 |
* @param dbType |
549 | 597 |
* @param cdmServer |
550 | 598 |
* @param cdmDB |
... | ... | |
558 | 606 |
pwd = AccountStore.readOrStorePassword(cdmServer, cdmDB, cdmUserName, pwd); |
559 | 607 |
ICdmDataSource destination; |
560 | 608 |
if(dbType.equals(DatabaseTypeEnum.MySQL)){ |
561 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
|
|
609 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null); |
|
562 | 610 |
} else if(dbType.equals(DatabaseTypeEnum.PostgreSQL)){ |
563 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
|
|
611 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null); |
|
564 | 612 |
} else { |
565 | 613 |
//TODO others |
566 | 614 |
throw new RuntimeException("Unsupported DatabaseType"); |
... | ... | |
571 | 619 |
|
572 | 620 |
|
573 | 621 |
/** |
574 |
* Accepts a string array and tries to find a method returning an ICdmDataSource with
|
|
622 |
* Accepts a string array and tries to find a method returning an ICdmDataSource with |
|
575 | 623 |
* the name of the given first string in the array |
576 |
*
|
|
624 |
* |
|
577 | 625 |
* @param args |
578 | 626 |
* @return |
579 | 627 |
*/ |
580 | 628 |
public static ICdmDataSource chooseDestination(String[] args) { |
581 |
if(args == null) |
|
582 |
return null; |
|
583 |
|
|
584 |
if(args.length != 1) |
|
585 |
return null; |
|
586 |
|
|
629 |
if(args == null) { |
|
630 |
return null; |
|
631 |
} |
|
632 |
|
|
633 |
if(args.length != 1) { |
|
634 |
return null; |
|
635 |
} |
|
636 |
|
|
587 | 637 |
String possibleDestination = args[0]; |
588 |
|
|
638 |
|
|
589 | 639 |
Method[] methods = CdmDestinations.class.getMethods(); |
590 |
|
|
640 |
|
|
591 | 641 |
for (Method method : methods){ |
592 | 642 |
if(method.getName().equals(possibleDestination)){ |
593 | 643 |
try { |
app-import/src/main/java/eu/etaxonomy/cdm/app/excelImport/taxa/NormalExplicitActivator.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 |
public class NormalExplicitActivator { |
29 | 29 |
private static final Logger logger = Logger.getLogger(NormalExplicitActivator.class); |
30 |
|
|
31 |
// private static String fileName =
|
|
30 |
|
|
31 |
// private static String fileName = |
|
32 | 32 |
// new String("D:\\_Tagungen\\2010-09 TDWG 2010\\Workshop\\data\\NormalExplicit.xls"); |
33 |
|
|
34 |
private static URI source = |
|
35 |
URI.create("file:/C:/localCopy/meetings_workshops/2011_G�ttingen/GermanSL12/GermanSL.xls"); |
|
33 |
|
|
34 |
private static URI source = |
|
35 |
// URI.create("file:/C:/localCopy/meetings_workshops/2011_G�ttingen/GermanSL12/GermanSL.xls"); |
|
36 |
URI.create("/home/pkelbert/Documents/Proibiosphere/Presentations/Demo/Excel/Cichorium_simple.xls"); |
|
36 | 37 |
|
37 | 38 |
private static DbSchemaValidation dbSchemaValidation = DbSchemaValidation.CREATE; |
38 |
|
|
39 |
|
|
39 | 40 |
// private static final ICdmDataSource destinationDb = CdmDestinations.cdm_test_jaxb(); |
40 |
private static final ICdmDataSource destinationDb = CdmDestinations.cdm_test_local_mysql();
|
|
41 |
|
|
41 |
private static final ICdmDataSource destinationDb = CdmDestinations.mon_cdm();
|
|
42 |
|
|
42 | 43 |
public static void main(String[] args) { |
43 | 44 |
|
44 | 45 |
NomenclaturalCode code = NomenclaturalCode.ICNAFP; |
45 | 46 |
URI uri = source; |
46 |
NormalExplicitImportConfigurator normalExplicitImportConfigurator =
|
|
47 |
NormalExplicitImportConfigurator normalExplicitImportConfigurator = |
|
47 | 48 |
NormalExplicitImportConfigurator.NewInstance(uri, destinationDb, code,dbSchemaValidation); |
48 | 49 |
|
49 |
CdmDefaultImport<NormalExplicitImportConfigurator> normalExplicitImport =
|
|
50 |
CdmDefaultImport<NormalExplicitImportConfigurator> normalExplicitImport = |
|
50 | 51 |
new CdmDefaultImport<NormalExplicitImportConfigurator>(); |
51 | 52 |
|
52 | 53 |
// invoke import |
53 | 54 |
logger.debug("Invoking Normal Explicit Excel import"); |
54 | 55 |
normalExplicitImport.invoke(normalExplicitImportConfigurator); |
55 |
|
|
56 |
|
|
56 | 57 |
} |
57 | 58 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/proibiosphere/SpecimenImportActivator.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
//database validation status (create, update, validate ...) |
32 | 32 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE; |
33 |
final static String excelSource = "/home/pkelbert/Documents/Proibiosphere/ChenopodiumQuentin/dca_UK_records.xls";
|
|
34 |
// final static String excelSource = "/home/pkelbert/Documents/Proibiosphere/ChenopodiumQuentin/dca_UK_specimens.xls"; |
|
33 |
final static String excelSource = "/home/pkelbert/Documents/Proibiosphere/ChenopodiumQuentin/dca_UK_records.xls"; |
|
34 |
// final static String excelSource = "/home/pkelbert/Documents/Proibiosphere/ChenopodiumQuentin/dca_UK_specimens.xls";
|
|
35 | 35 |
|
36 | 36 |
// final static String xmlSource = "C:\\localCopy\\eclipse\\cdmlib\\app-import\\src\\main\\resources\\specimenABCD\\CDMtabular9c04a474e2_23_09_08.xls"; |
37 | 37 |
|
38 | 38 |
|
39 | 39 |
|
40 |
static final ICdmDataSource cdmDestination = CdmDestinations.proibiosphere_local(); |
|
40 |
static final ICdmDataSource cdmDestination = CdmDestinations.proibiosphere_chenopodium_local();
|
|
41 | 41 |
//check - import |
42 | 42 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
43 | 43 |
|
... | ... | |
68 | 68 |
// specimenImportConfigurator.setDoCreateIndividualsAssociations(true); |
69 | 69 |
|
70 | 70 |
Reference<?> ref = ReferenceFactory.newBook(); |
71 |
ref.setUuid(UUID.fromString("98b0a618-a95b-464e-943a-25aaaef202f6"));//observations
|
|
72 |
ref.setTitle("Chenopodium vulvaria observations from the British Isles");
|
|
71 |
ref.setUuid(UUID.fromString("98b0a618-a95b-464e-943a-25aaaef202f6"));//observations |
|
72 |
ref.setTitle("Chenopodium vulvaria observations from the British Isles"); |
|
73 | 73 |
// |
74 |
// ref.setUuid(UUID.fromString("5480eed1-1a23-4ce8-ac4d-c2893e178dea"));//specimens |
|
75 |
// ref.setTitle("Chenopodium vulvaria specimens from the British Isles"); |
|
74 |
// ref.setUuid(UUID.fromString("5480eed1-1a23-4ce8-ac4d-c2893e178dea"));//specimens
|
|
75 |
// ref.setTitle("Chenopodium vulvaria specimens from the British Isles");
|
|
76 | 76 |
|
77 | 77 |
specimenImportConfigurator.setDataReference(ref); |
78 | 78 |
specimenImportConfigurator.setSourceReference(null); |
app-import/src/main/java/eu/etaxonomy/cdm/app/proibiosphere/SynthesysCacheActivator.java | ||
---|---|---|
39 | 39 |
|
40 | 40 |
//database validation status (create, update, validate ...) |
41 | 41 |
|
42 |
// final static String xmlSource = "/home/pkelbert/workspace/proibiosphere/cdmlib-io/target/test-classes/eu/etaxonomy/cdm/io/specimen/excel/in/ExcelImportConfiguratorTest-input.xls"; |
|
42 |
// final static String xmlSource = "/home/pkelbert/workspace/proibiosphere/cdmlib-io/target/test-classes/eu/etaxonomy/cdm/io/specimen/excel/in/ExcelImportConfiguratorTest-input.xls";
|
|
43 | 43 |
final static String xmlSource = "/home/pkelbert/Documents/Proibiosphere/ChenopodiumQuentin/dca UK records.xls"; |
44 | 44 |
|
45 | 45 |
|
46 | 46 |
static final ICdmDataSource cdmDestination = CdmDestinations.mon_cdm(); |
47 | 47 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE; |
48 |
// static final ICdmDataSource cdmDestination = CdmDestinations.proibiosphere_local(); |
|
49 |
// static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE; |
|
48 |
// static final ICdmDataSource cdmDestination = CdmDestinations.proibiosphere_local();
|
|
49 |
// static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
|
|
50 | 50 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
51 | 51 |
|
52 | 52 |
/** |
... | ... | |
70 | 70 |
specimenImportConfigurator.setReUseExistingMetadata(true); |
71 | 71 |
specimenImportConfigurator.setAskForDate(true); |
72 | 72 |
specimenImportConfigurator.setDefaultAuthor("L."); |
73 |
// specimenImportConfigurator.setClassificationName("Chenopodium"); |
|
73 |
// specimenImportConfigurator.setClassificationName("Chenopodium");
|
|
74 | 74 |
|
75 | 75 |
specimenImportConfigurator.setReUseTaxon(true); |
76 | 76 |
|
app-import/src/main/java/eu/etaxonomy/cdm/app/proibiosphere/TaxonXImportLauncher.java | ||
---|---|---|
53 | 53 |
// private static final Logger log = Logger.getLogger(CdmEntityDaoBase.class); |
54 | 54 |
|
55 | 55 |
//database validation status (create, update, validate ...) |
56 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
|
|
57 |
static final ICdmDataSource cdmDestination = CdmDestinations.proibiosphere_local();
|
|
56 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
|
57 |
static final ICdmDataSource cdmDestination = CdmDestinations.mon_cdm();
|
|
58 | 58 |
|
59 | 59 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
60 | 60 |
|
61 | 61 |
|
62 |
static String plaziUrl = "http://plazi.cs.umb.edu/GgServer/search?taxonomicName.isNomenclature=true&taxonomicName.exactMatch=true&indexName=0&subIndexName=taxonomicName&subIndexName=MODS&minSubResultSize=1&searchMode=index&resultFormat=xml&xsltUrl=http%3A%2F%2Fplazi.cs.umb.edu%2FGgServer%2Fresources%2FsrsWebPortalData%2FCdmSyncTreatmentList.xslt&taxonomicName.taxonomicName="; |
|
63 |
static String plaziUrlDoc = "http://plazi.cs.umb.edu/GgServer/search?taxonomicName.isNomenclature=true&taxonomicName.exactMatch=true&indexName=0&subIndexName=taxonomicName&subIndexName=MODS&minSubResultSize=1&searchMode=index&resultFormat=xml&xsltUrl=http%3A%2F%2Fplazi.cs.umb.edu%2FGgServer%2Fresources%2FsrsWebPortalData%2FCdmSyncTreatmentList.xslt&MODS.ModsDocID="; |
|
64 |
|
|
65 |
|
|
62 | 66 |
private static String askQuestion(String question){ |
63 | 67 |
Scanner scan = new Scanner(System.in); |
64 | 68 |
System.out.println(question); |
... | ... | |
67 | 71 |
} |
68 | 72 |
|
69 | 73 |
public static void main(String[] args) { |
74 |
String[] taxonList = new String[] {"Polybothrus","Eupolybothrus"}; |
|
75 |
// /*ants*/ String[] modsList = new String[] {"3924", "3743", "4375","6757","6752","3481","21401_fisher_smith_plos_2008","2592","4096","6877","6192","8071"}; |
|
76 |
// String[] modsList = new String[] {"FloNuttDuWin1838"}; |
|
77 |
// modsList = new String[] {"Zapparoli-1986-Eupolybothrus-fasciatus"}; |
|
78 |
String tnomenclature = "ICZN"; |
|
70 | 79 |
|
71 |
String plaziUrl = "http://plazi.cs.umb.edu/GgServer/search?taxonomicName.isNomenclature=true&taxonomicName.exactMatch=true&indexName=0&subIndexName=taxonomicName&subIndexName=MODS&minSubResultSize=1&searchMode=index&resultFormat=xml&xsltUrl=http%3A%2F%2Fplazi.cs.umb.edu%2FGgServer%2FsrsWebPortalData%2FCdmSyncTreatmentList.xslt&taxonomicName.taxonomicName="; |
|
72 |
String plaziUrlDoc = "http://plazi.cs.umb.edu/GgServer/search?taxonomicName.isNomenclature=true&taxonomicName.exactMatch=true&indexName=0&subIndexName=taxonomicName&subIndexName=MODS&minSubResultSize=1&searchMode=index&resultFormat=xml&xsltUrl=http%3A%2F%2Fplazi.cs.umb.edu%2FGgServer%2FsrsWebPortalData%2FCdmSyncTreatmentList.xslt&MODS.ModsDocID="; |
|
73 |
// String plaziUrl = "http://plazi.cs.umb.edu/GgServer/xslt/E01DD5BE427421156E0C0BAC56389E0D?xsltUrl=http%3A%2F%2Fplazi.cs.umb.edu%2FGgServer%2FsrsWebPortalData%2FLinkers%2FXmlDocumentLinkerData%2Fgg2taxonx.xsl"; |
|
74 |
List<String> sourcesStr = new ArrayList<String>(); |
|
75 |
boolean plaziNotServer=false; |
|
80 |
String defaultClassif="Eupolybothrus and Polybothrus"; |
|
76 | 81 |
|
77 | 82 |
Map<String,List<String>> documents = new HashMap<String,List<String>>(); |
78 |
// plaziUrl=plaziUrl+"Chenopodium"; |
|
79 |
plaziUrl=plaziUrlDoc+"0910-2878-5652"; |
|
83 |
HashMap<String,List<URI>>documentMap = new HashMap<String, List<URI>>(); |
|
80 | 84 |
|
81 | 85 |
/*HOW TO HANDLE SECUNDUM REFERENCE*/ |
82 | 86 |
boolean reuseSecundum = askIfReuseSecundum(); |
... | ... | |
85 | 89 |
secundum = askForSecundum(); |
86 | 90 |
} |
87 | 91 |
|
88 |
String tnomenclature = "ICBN"; |
|
92 |
checkTreatmentPresence("taxon",taxonList, documents,documentMap); |
|
93 |
// checkTreatmentPresence("modsid",modsList, documents,documentMap); |
|
94 |
|
|
95 |
TaxonXImportConfigurator taxonxImportConfigurator =null; |
|
96 |
CdmDefaultImport<TaxonXImportConfigurator> taxonImport = new CdmDefaultImport<TaxonXImportConfigurator>(); |
|
97 |
|
|
98 |
ICdmDataSource destination = cdmDestination; |
|
99 |
taxonxImportConfigurator = prepareTaxonXImport(destination,reuseSecundum, secundum); |
|
100 |
|
|
101 |
taxonxImportConfigurator.setImportClassificationName(defaultClassif); |
|
102 |
log.info("Start import from TaxonX Data"); |
|
103 |
|
|
104 |
taxonxImportConfigurator.setLastImport(false); |
|
105 |
|
|
106 |
int j=0; |
|
107 |
for (String document:documentMap.keySet()){ |
|
108 |
j++; |
|
109 |
if (doImportDocument(document, documentMap.get(document).size())){ |
|
110 |
int i=0; |
|
111 |
for (URI source:documentMap.get(document)){ |
|
112 |
System.out.println("START "+i+" ("+(documentMap.get(document)).size()+"): "+source.getPath()); |
|
113 |
i++; |
|
114 |
if (j==documentMap.keySet().size() && i==documentMap.get(document).size()) { |
|
115 |
taxonxImportConfigurator.setLastImport(true); |
|
116 |
} |
|
117 |
prepareReferenceAndSource(taxonxImportConfigurator,source); |
|
118 |
prepareNomenclature(taxonxImportConfigurator,tnomenclature); |
|
119 |
// taxonxImportConfigurator.setTaxonReference(null); |
|
120 |
taxonImport.invoke(taxonxImportConfigurator); |
|
121 |
log.info("End import from SpecimenData ("+ source.toString() + ")..."); |
|
122 |
|
|
123 |
// //deduplicate |
|
124 |
// ICdmApplicationConfiguration app = taxonImport.getCdmAppController(); |
|
125 |
// int count = app.getAgentService().deduplicate(Person.class, null, null); |
|
126 |
// logger.warn("Deduplicated " + count + " persons."); |
|
127 |
// count = app.getReferenceService().deduplicate(Reference.class, null, null); |
|
128 |
// logger.warn("Deduplicated " + count + " references."); |
|
129 |
} |
|
130 |
} |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
/** |
|
137 |
* @param taxonxImportConfigurator |
|
138 |
* @param tnomenclature |
|
139 |
*/ |
|
140 |
private static void prepareNomenclature(TaxonXImportConfigurator taxonxImportConfigurator, String tnomenclature) { |
|
141 |
// String tnomenclature = askQuestion("ICBN or ICZN ?"); |
|
142 |
taxonxImportConfigurator.setNomenclaturalCode(NomenclaturalCode.ICNAFP); |
|
143 |
if (tnomenclature.equalsIgnoreCase("ICBN")) { |
|
144 |
taxonxImportConfigurator.setNomenclaturalCode(NomenclaturalCode.ICNAFP); |
|
145 |
// taxonxImportConfigurator.setClassificationName("Chenopodiaceae"); |
|
146 |
} |
|
147 |
if(tnomenclature.equalsIgnoreCase("ICZN")){ |
|
148 |
taxonxImportConfigurator.setNomenclaturalCode(NomenclaturalCode.ICZN); |
|
149 |
// taxonxImportConfigurator.setClassificationName("Ants"); |
|
150 |
} |
|
151 |
if(tnomenclature.equalsIgnoreCase("ICNB")){ |
|
152 |
taxonxImportConfigurator.setNomenclaturalCode(NomenclaturalCode.ICNB); |
|
153 |
// taxonxImportConfigurator.setClassificationName("Bacteria"); |
|
154 |
} |
|
155 |
|
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* @param taxonxImportConfigurator |
|
160 |
* @param source |
|
161 |
* |
|
162 |
*/ |
|
163 |
private static void prepareReferenceAndSource(TaxonXImportConfigurator taxonxImportConfigurator, URI source) { |
|
164 |
Reference<?> reference = ReferenceFactory.newGeneric(); |
|
165 |
// String tref = askQuestion("Import source? (ie Plazi document ID)"); |
|
166 |
String tref="PLAZI - "+source.getPath().split("/")[source.getPath().split("/").length-1]; |
|
167 |
reference.setTitleCache(tref,true); |
|
168 |
reference.setTitle(tref); |
|
169 |
reference.generateTitle(); |
|
170 |
|
|
171 |
taxonxImportConfigurator.setSourceReference(reference); |
|
172 |
TaxonXImportConfigurator.setSourceRef(reference); |
|
173 |
|
|
174 |
Reference<?> referenceUrl = ReferenceFactory.newWebPage(); |
|
175 |
referenceUrl.setTitleCache(source.toString(), true); |
|
176 |
referenceUrl.setTitle(source.toString()); |
|
177 |
reference.setUri(source); |
|
178 |
referenceUrl.generateTitle(); |
|
179 |
|
|
180 |
taxonxImportConfigurator.addOriginalSource(referenceUrl); |
|
181 |
taxonxImportConfigurator.setSource(source); |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* @param destination |
|
186 |
* @param reuseSecundum |
|
187 |
* @param secundum |
|
188 |
* @return |
|
189 |
*/ |
|
190 |
private static TaxonXImportConfigurator prepareTaxonXImport(ICdmDataSource destination, boolean reuseSecundum, Reference<?> secundum) { |
|
191 |
TaxonXImportConfigurator taxonxImportConfigurator = TaxonXImportConfigurator.NewInstance(destination); |
|
192 |
|
|
193 |
// taxonxImportConfigurator.setClassificationName(taxonxImportConfigurator.getSourceReferenceTitle()); |
|
194 |
taxonxImportConfigurator.setCheck(check); |
|
195 |
taxonxImportConfigurator.setDbSchemaValidation(hbm2dll); |
|
196 |
taxonxImportConfigurator.setDoAutomaticParsing(true); |
|
197 |
|
|
198 |
taxonxImportConfigurator.setInteractWithUser(true); |
|
199 |
|
|
200 |
|
|
201 |
taxonxImportConfigurator.setKeepOriginalSecundum(reuseSecundum); |
|
202 |
if (!reuseSecundum) { |
|
203 |
taxonxImportConfigurator.setSecundum(secundum); |
|
204 |
} |
|
205 |
|
|
206 |
// taxonxImportConfigurator.setDoMatchTaxa(true); |
|
207 |
// taxonxImportConfigurator.setReUseTaxon(true); |
|
208 |
return taxonxImportConfigurator; |
|
209 |
} |
|
210 |
|
|
211 |
/** |
|
212 |
* @param importFilter |
|
213 |
* @param modsList |
|
214 |
* @param documents |
|
215 |
* @param documentMap |
|
216 |
* @return |
|
217 |
*/ |
|
218 |
private static HashMap<String, List<URI>> checkTreatmentPresence(String importFilter, String[] modsList, Map<String, List<String>> documents, HashMap<String, List<URI>> documentMap) { |
|
89 | 219 |
URL plaziURL; |
90 |
try { |
|
91 |
plaziURL = new URL(plaziUrl); |
|
92 |
BufferedReader in = new BufferedReader(new InputStreamReader(plaziURL.openStream())); |
|
220 |
// System.out.println(plaziUrl); |
|
93 | 221 |
|
222 |
Map<String, List<String>> docs = new HashMap<String, List<String>>(); |
|
223 |
try { |
|
224 |
BufferedReader in=null; |
|
94 | 225 |
List<String> docList; |
95 | 226 |
String inputLine; |
96 | 227 |
String docID; |
... | ... | |
98 | 229 |
String pageEnd; |
99 | 230 |
String taxon; |
100 | 231 |
String link; |
101 |
//TODO lastUpdate field |
|
102 |
if(!plaziNotServer){ |
|
232 |
String urlstr=""; |
|
233 |
|
|
234 |
for(String modsID : modsList){ |
|
235 |
// plaziUrl=plaziUrl+"Eupolybothrus"; |
|
236 |
if (importFilter.equalsIgnoreCase("modsid")) { |
|
237 |
urlstr=plaziUrlDoc+modsID; |
|
238 |
} |
|
239 |
if (importFilter.equalsIgnoreCase("taxon")) { |
|
240 |
urlstr=plaziUrl+modsID; |
|
241 |
} |
|
242 |
// System.out.println(url); |
|
243 |
|
|
244 |
plaziURL = new URL(urlstr); |
|
245 |
in = new BufferedReader(new InputStreamReader(plaziURL.openStream())); |
|
246 |
|
|
247 |
|
|
248 |
//TODO lastUpdate field |
|
249 |
// if(!plaziNotServer){ |
|
103 | 250 |
while ((inputLine = in.readLine()) != null) { |
251 |
System.out.println(inputLine); |
|
104 | 252 |
if (inputLine.startsWith("<treatment ")){ |
105 | 253 |
taxon = inputLine.split("taxon=\"")[1].split("\"")[0]; |
106 | 254 |
docID=inputLine.split("docId=\"")[1].split("\"")[0]; |
255 |
System.out.println("docID: "+docID); |
|
107 | 256 |
link=inputLine.split("link=\"")[1].split("\"")[0]; |
108 | 257 |
pageStart = inputLine.split("startPage=\"")[1].split("\"")[0]; |
109 | 258 |
pageEnd = inputLine.split("endPage=\"")[1].split("\"")[0]; |
... | ... | |
116 | 265 |
} |
117 | 266 |
} |
118 | 267 |
} |
268 |
System.out.println("hop"); |
|
269 |
|
|
270 |
|
|
271 |
|
|
119 | 272 |
for (String docId:documents.keySet()){ |
120 | 273 |
in = new BufferedReader(new InputStreamReader(new URL(plaziUrlDoc+docId).openStream())); |
121 | 274 |
while ((inputLine = in.readLine()) != null) { |
... | ... | |
130 | 283 |
docList = new ArrayList<String>(); |
131 | 284 |
} |
132 | 285 |
docList.add(pageStart+"---"+pageEnd+"---"+taxon+"---"+link); |
133 |
documents.put(docID,docList);
|
|
286 |
docs.put(docID,docList); |
|
134 | 287 |
} |
135 | 288 |
} |
136 | 289 |
} |
137 |
if(plaziNotServer) { |
|
138 |
sourcesStr.add(plaziUrl); |
|
139 |
} |
|
140 |
in.close(); |
|
290 |
// if(plaziNotServer) {
|
|
291 |
// sourcesStr.add(plaziUrl);
|
|
292 |
// }
|
|
293 |
// in.close();
|
|
141 | 294 |
} catch (MalformedURLException e1) { |
142 | 295 |
// TODO Auto-generated catch block |
143 | 296 |
e1.printStackTrace(); |
... | ... | |
150 | 303 |
|
151 | 304 |
// sourcesStr.add("/home/pkelbert/Documents/Proibiosphere/ChenopodiumXML/1362148061170_Chenopodium_K_hn_U_1993_tx.xml"); |
152 | 305 |
|
153 |
for (String docId : documents.keySet()){ |
|
154 |
/*remove documents bad quality*/ |
|
155 |
log.info(docId); |
|
156 |
// if (!docId.equalsIgnoreCase("3891-7797-6564")){ |
|
157 |
log.info("document "+docId); |
|
158 |
List<String> treatments = new ArrayList<String>(new HashSet<String>(documents.get(docId))); |
|
159 |
|
|
160 |
Map<Integer, List<String>> startPages = new HashMap<Integer, List<String>>(); |
|
161 |
for (String treatment:treatments) { |
|
162 |
List<String>tmplist = startPages.get(Integer.valueOf(treatment.split("---")[0])); |
|
163 |
if (tmplist == null) { |
|
164 |
tmplist = new ArrayList<String>(); |
|
165 |
} |
|
166 |
tmplist.add(treatment.split("---")[3]); |
|
167 |
startPages.put(Integer.valueOf(treatment.split("---")[0]),tmplist); |
|
306 |
//System.out.println(documents); |
|
307 |
for (String docId : docs.keySet()){ |
|
308 |
List<String> treatments = new ArrayList<String>(new HashSet<String>(docs.get(docId))); |
|
309 |
|
|
310 |
Map<Integer, List<String>> startPages = new HashMap<Integer, List<String>>(); |
|
311 |
for (String treatment:treatments) { |
|
312 |
List<String>tmplist = startPages.get(Integer.valueOf(treatment.split("---")[0])); |
|
313 |
if (tmplist == null) { |
|
314 |
tmplist = new ArrayList<String>(); |
|
168 | 315 |
} |
169 |
List<Integer> pages = new ArrayList<Integer>(); |
|
170 |
pages.addAll(startPages.keySet()); |
|
171 |
|
|
172 |
Collections.sort(pages); |
|
173 |
// log.info(pages); |
|
174 |
|
|
175 |
log.info("Document "+docId+" should have "+treatments.size()+" treatments"); |
|
176 |
int cnt=0; |
|
177 |
for (String source:treatments){ |
|
178 |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
|
179 |
DocumentBuilder builder; |
|
180 |
URL url; |
|
181 |
|
|
182 |
try { |
|
183 |
builder = factory.newDocumentBuilder(); |
|
184 |
url = new URL(source.split("---")[3]); |
|
185 |
Object o = url.getContent(); |
|
186 |
InputStream is = (InputStream) o; |
|
187 |
Document document = builder.parse(is); |
|
188 |
cnt++; |
|
189 |
}catch(Exception e){ |
|
190 |
// e.printStackTrace(); |
|
191 |
log.warn(e); |
|
192 |
} |
|
316 |
tmplist.add(treatment.split("---")[3]); |
|
317 |
startPages.put(Integer.valueOf(treatment.split("---")[0]),tmplist); |
|
318 |
} |
|
319 |
List<Integer> pages = new ArrayList<Integer>(); |
|
320 |
pages.addAll(startPages.keySet()); |
|
321 |
|
|
322 |
Collections.sort(pages); |
|
323 |
// log.info(pages); |
|
324 |
|
|
325 |
log.info("Document "+docId+" should have "+treatments.size()+" treatments"); |
|
326 |
int cnt=0; |
|
327 |
if(treatments.size()<150){ |
|
328 |
|
|
329 |
for (String source:treatments){ |
|
330 |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
|
331 |
DocumentBuilder builder; |
|
332 |
URL url; |
|
333 |
|
|
334 |
try { |
|
335 |
builder = factory.newDocumentBuilder(); |
|
336 |
url = new URL(source.split("---")[3]); |
|
337 |
Object o = url.getContent(); |
|
338 |
InputStream is = (InputStream) o; |
|
339 |
Document document = builder.parse(is); |
|
340 |
cnt++; |
|
341 |
}catch(Exception e){ |
|
342 |
// e.printStackTrace(); |
|
343 |
log.warn(e); |
|
344 |
} |
|
345 |
} |
|
346 |
log.info("Document "+docId+" has "+cnt+" treatments available"); |
|
347 |
} |
|
348 |
if(treatments.size() != cnt) |
|
349 |
{ |
|
350 |
File file = new File("/home/pkelbert/Bureau/urlTaxonXToDoLater.txt"); |
|
351 |
FileWriter writer; |
|
352 |
try { |
|
353 |
writer = new FileWriter(file ,true); |
|
354 |
writer.write(docId+"\n"); |
|
355 |
writer.flush(); |
|
356 |
writer.close(); |
|
357 |
} catch (IOException e1) { |
|
358 |
// TODO Auto-generated catch block |
|
359 |
e1.printStackTrace(); |
|
193 | 360 |
} |
194 |
log.info("Document "+docId+" has "+cnt+" treatments available"); |
|
195 |
if(treatments.size() != cnt) |
|
196 |
{ |
|
197 |
File file = new File("/home/pkelbert/Bureau/urlTaxonXToDoLater.txt"); |
|
198 |
FileWriter writer; |
|
199 |
try { |
|
200 |
writer = new FileWriter(file ,true); |
|
201 |
writer.write(docId+"\n"); |
|
202 |
writer.flush(); |
|
203 |
writer.close(); |
|
204 |
} catch (IOException e1) { |
|
205 |
// TODO Auto-generated catch block |
|
206 |
e1.printStackTrace(); |
|
207 |
} |
|
208 | 361 |
|
362 |
} |
|
363 |
else{ |
|
364 |
List<URI> uritmp = documentMap.get(docId); |
|
365 |
if (uritmp == null) { |
|
366 |
uritmp = new ArrayList<URI>(); |
|
209 | 367 |
} |
210 |
else{ |
|
211 |
for (int page:pages) { |
|
212 |
for (String treatment: startPages.get(page)) { |
|
213 |
sourcesStr.add(treatment); |
|
368 |
for (int page:pages) { |
|
369 |
for (String treatment: startPages.get(page)) { |
|
370 |
try { |
|
371 |
uritmp.add(new URL(treatment).toURI()); |
|
372 |
} catch (MalformedURLException e) { |
|
373 |
// TODO Auto-generated catch block |
|
374 |
e.printStackTrace(); |
|
375 |
} catch (URISyntaxException e) { |
|
376 |
// TODO Auto-generated catch block |
|
377 |
e.printStackTrace(); |
|
214 | 378 |
} |
215 | 379 |
} |
216 | 380 |
} |
217 |
// } |
|
218 |
} |
|
219 |
log.info("NB SOURCES : "+sourcesStr.size()); |
|
220 |
// sourcesStr = new ArrayList<String>(); |
|
221 |
// sourcesStr.add("http://plazi.cs.umb.edu/exist/rest/db/taxonx_docs/cdmSync/4E7390346C05780D32283CCF6F5E4431_tx.xml"); |
|
222 |
|
|
223 |
List<URI> sources = new ArrayList<URI>(); |
|
224 |
for (String src: sourcesStr){ |
|
225 |
URI uri; |
|
226 |
try { |
|
227 |
uri = new URL(src).toURI(); |
|
228 |
sources.add(new URI(uri.toString())); |
|
229 |
} catch (MalformedURLException e1) { |
|
230 |
// TODO Auto-generated catch block |
|
231 |
e1.printStackTrace(); |
|
232 |
} catch (URISyntaxException e1) { |
|
233 |
// TODO Auto-generated catch block |
|
234 |
e1.printStackTrace(); |
|
381 |
documentMap.put(docId, uritmp); |
|
235 | 382 |
} |
236 |
} |
|
237 | 383 |
|
238 |
log.info("Start import from TaxonX Data"); |
|
239 | 384 |
|
240 |
ICdmDataSource destination = cdmDestination; |
|
241 |
TaxonXImportConfigurator taxonxImportConfigurator = TaxonXImportConfigurator.NewInstance(destination); |
|
242 |
|
|
243 |
// taxonxImportConfigurator.setClassificationName(taxonxImportConfigurator.getSourceReferenceTitle()); |
|
244 |
taxonxImportConfigurator.setCheck(check); |
|
245 |
taxonxImportConfigurator.setDbSchemaValidation(hbm2dll); |
|
246 |
taxonxImportConfigurator.setDoAutomaticParsing(true); |
|
247 | 385 |
|
248 |
// invoke import |
|
249 |
CdmDefaultImport<TaxonXImportConfigurator> taxonImport = new CdmDefaultImport<TaxonXImportConfigurator>(); |
|
250 | 386 |
|
251 |
taxonxImportConfigurator.setKeepOriginalSecundum(reuseSecundum); |
|
252 |
if (!reuseSecundum) { |
|
253 |
taxonxImportConfigurator.setSecundum(secundum); |
|
254 | 387 |
} |
388 |
////// log.info("NB SOURCES : "+sourcesStr.size()); |
|
389 |
// List<URI> sourcesStr = new ArrayList<URI>(); |
|
390 |
// try { |
|
391 |
//// documentMap = new HashMap<String, List<URI>>(); |
|
392 |
// sourcesStr.add(new URI("http://plazi.cs.umb.edu/GgServer/cdmSync/8F5B3EA099D371BC41CC5DDBFEDCFBED")); |
|
393 |
// documentMap.put("singlesource", sourcesStr); |
|
394 |
// } catch (URISyntaxException e) { |
|
395 |
// // TODO Auto-generated catch block |
|
396 |
// e.printStackTrace(); |
|
397 |
// } |
|
398 |
|
|
399 |
return documentMap; |
|
255 | 400 |
|
401 |
} |
|
256 | 402 |
|
257 |
// taxonxImportConfigurator.setDoMatchTaxa(true); |
|
258 |
// taxonxImportConfigurator.setReUseTaxon(true); |
|
259 |
|
|
260 |
for (URI source:sources){ |
|
261 |
log.info("START : "+source.getPath()); |
|
262 |
taxonxImportConfigurator.setSource(source); |
|
263 |
|
|
264 |
Reference<?> reference = ReferenceFactory.newGeneric(); |
|
265 |
// String tref = askQuestion("Import source? (ie Plazi document ID)"); |
|
266 |
String tref="PLAZI - "+source.getPath().split("/")[source.getPath().split("/").length-1]; |
|
267 |
reference.setTitleCache(tref,true); |
|
268 |
reference.setTitle(tref); |
|
269 |
reference.generateTitle(); |
|
270 |
|
|
271 |
taxonxImportConfigurator.setSourceReference(reference); |
|
272 |
taxonxImportConfigurator.setSourceRef(reference); |
|
273 |
|
|
274 |
// String tnomenclature = askQuestion("ICBN or ICZN ?"); |
|
275 |
|
|
276 |
if (tnomenclature.equalsIgnoreCase("ICBN")) { |
|
277 |
taxonxImportConfigurator.setNomenclaturalCode(NomenclaturalCode.ICNAFP); |
|
278 |
// taxonxImportConfigurator.setClassificationName("Chenopodiaceae"); |
|
279 |
} |
|
280 |
if(tnomenclature.equalsIgnoreCase("ICZN")){ |
|
281 |
taxonxImportConfigurator.setNomenclaturalCode(NomenclaturalCode.ICZN); |
|
282 |
// taxonxImportConfigurator.setClassificationName("Ants"); |
|
283 |
} |
|
284 |
|
|
285 |
// taxonxImportConfigurator.setTaxonReference(null); |
|
286 |
|
|
287 |
// log.info("INVOKE"); |
|
288 |
|
|
289 |
taxonImport.invoke(taxonxImportConfigurator); |
|
290 |
log.info("End import from SpecimenData ("+ source.toString() + ")..."); |
|
291 |
|
|
292 |
// //deduplicate |
|
293 |
// ICdmApplicationConfiguration app = taxonImport.getCdmAppController(); |
|
294 |
// int count = app.getAgentService().deduplicate(Person.class, null, null); |
|
295 |
// logger.warn("Deduplicated " + count + " persons."); |
|
296 |
// count = app.getReferenceService().deduplicate(Reference.class, null, null); |
|
297 |
// logger.warn("Deduplicated " + count + " references."); |
|
403 |
/** |
|
404 |
* @param document |
|
405 |
* @return |
|
406 |
*/ |
|
407 |
private static boolean doImportDocument(String document, int nbtreatments) { |
|
408 |
return true; |
|
409 |
/* |
|
410 |
// List<String> docDone = Arrays.asList(new String[]{"3540555099", "0910-2878-5652", "5012-9059-4108", |
|
411 |
// "3784-0748-2261","3-201-00728-5", "FloNuttDuWin1838", "FlNordica_chenop","2580-1363-7530", |
|
412 |
// "1842460692","5161-7797-8064","FlCaboVerde_Chen","2819-9661-8339","2626-3794-9273"});//, |
|
413 |
// // "8776-7797-8303"}); |
|
414 |
// if (docDone.contains(document)) { |
|
415 |
// return false; |
|
416 |
// } |
|
417 |
|
|
418 |
JTextArea textArea = new JTextArea("Should this document be imported ("+nbtreatments+")? \n'"+document+"'"); |
|
419 |
JScrollPane scrollPane = new JScrollPane(textArea); |
|
420 |
textArea.setLineWrap(true); |
|
421 |
textArea.setWrapStyleWord(true); |
|
422 |
scrollPane.setPreferredSize( new Dimension( 700, 70 ) ); |
|
423 |
|
|
424 |
// JFrame frame = new JFrame("I have a question"); |
|
425 |
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
426 |
int s = JOptionPane.showConfirmDialog(null, scrollPane); |
|
427 |
if (s==0) { |
|
428 |
return true; |
|
429 |
} else { |
|
430 |
return false; |
|
298 | 431 |
} |
299 |
|
|
300 |
|
|
432 |
*/ |
|
301 | 433 |
} |
302 | 434 |
|
303 |
|
|
304 |
|
|
305 | 435 |
/** |
306 | 436 |
* @return |
307 | 437 |
*/ |
308 | 438 |
private static boolean askIfReuseSecundum() { |
309 |
// logger.info("getFullReference for "+ name);
|
|
310 |
JTextArea textArea = new JTextArea("Reuse the secundum present in the current classification? " +
|
|
311 |
"\n Click Yes to reuse it, click No or Cancel to create a new one.");
|
|
312 |
JScrollPane scrollPane = new JScrollPane(textArea);
|
|
313 |
textArea.setLineWrap(true);
|
|
314 |
textArea.setWrapStyleWord(true);
|
|
315 |
scrollPane.setPreferredSize( new Dimension( 700, 100 ) );
|
|
316 |
|
|
317 |
// JFrame frame = new JFrame("I have a question");
|
|
318 |
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
319 |
int s = JOptionPane.showConfirmDialog(null, scrollPane);
|
|
320 |
if (s==0) {
|
|
439 |
// logger.info("getFullReference for "+ name); |
|
440 |
JTextArea textArea = new JTextArea("Reuse the secundum present in the current classification? " + |
|
441 |
"\n Click Yes to reuse it, click No or Cancel to create a new one.\nA default secundum will be created if needed.");
|
|
442 |
JScrollPane scrollPane = new JScrollPane(textArea); |
|
443 |
textArea.setLineWrap(true); |
|
444 |
textArea.setWrapStyleWord(true); |
|
445 |
scrollPane.setPreferredSize( new Dimension( 700, 70 ) );
|
|
446 |
|
|
447 |
// JFrame frame = new JFrame("I have a question"); |
|
448 |
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
449 |
int s = JOptionPane.showConfirmDialog(null, scrollPane); |
|
450 |
if (s==0) { |
|
321 | 451 |
return true; |
322 | 452 |
} else { |
323 | 453 |
return false; |
... | ... | |
328 | 458 |
* @return |
329 | 459 |
*/ |
330 | 460 |
private static Reference<?> askForSecundum() { |
331 |
// logger.info("getFullReference for "+ name); |
|
332 |
JTextArea textArea = new JTextArea("Enter the secundum name"); |
|
333 |
JScrollPane scrollPane = new JScrollPane(textArea); |
|
334 |
textArea.setLineWrap(true); |
|
335 |
textArea.setWrapStyleWord(true); |
|
336 |
scrollPane.setPreferredSize( new Dimension( 700, 100 ) ); |
|
337 |
|
|
338 |
// JFrame frame = new JFrame("I have a question"); |
|
339 |
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
340 |
String s = (String) JOptionPane.showInputDialog( |
|
341 |
null, |
|
342 |
scrollPane, |
|
343 |
"", |
|
344 |
JOptionPane.PLAIN_MESSAGE, |
|
345 |
null, |
|
346 |
null, |
|
347 |
null); |
|
348 |
Reference<?> ref = ReferenceFactory.newGeneric(); |
|
349 |
ref.setTitle(s); |
|
350 |
return ref; |
|
461 |
// logger.info("getFullReference for "+ name); |
|
462 |
JTextArea textArea = new JTextArea("Enter the secundum name"); |
|
463 |
JScrollPane scrollPane = new JScrollPane(textArea); |
|
464 |
textArea.setLineWrap(true); |
|
465 |
textArea.setWrapStyleWord(true); |
|
466 |
scrollPane.setPreferredSize( new Dimension( 700, 100 ) ); |
|
467 |
|
Also available in: Unified diff
reintegrate cdmlib-apps patricia into trunk