Revision 50818ab7
Added by Katja Luther over 8 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/cichorieae/CichorieaeCommonNameActivator.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 |
*/ |
... | ... | |
18 | 18 |
import eu.etaxonomy.cdm.database.DbSchemaValidation; |
19 | 19 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
20 | 20 |
import eu.etaxonomy.cdm.io.common.CdmDefaultImport; |
21 |
import eu.etaxonomy.cdm.io.common.ImportResult; |
|
21 | 22 |
import eu.etaxonomy.cdm.io.wp6.CommonNameImportConfigurator; |
22 | 23 |
|
23 | 24 |
|
24 | 25 |
/** |
25 | 26 |
* TODO add the following to a wiki page: |
26 |
* 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
|
|
27 |
* 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 |
|
27 | 28 |
* you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names. |
28 |
*
|
|
29 |
*
|
|
29 |
* |
|
30 |
* |
|
30 | 31 |
* @author a.mueller |
31 | 32 |
* |
32 | 33 |
*/ |
... | ... | |
38 | 39 |
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql(); |
39 | 40 |
static String source = "C:/localCopy/Data/wp6/cich/Common names-Ueberarbeitung_AM.xls"; |
40 | 41 |
|
41 |
// **************** ALL *********************
|
|
42 |
// **************** ALL ********************* |
|
42 | 43 |
|
43 |
private boolean doInvoke(ICdmDataSource destination){
|
|
44 |
boolean success = true;
|
|
44 |
private ImportResult doInvoke(ICdmDataSource destination){
|
|
45 |
ImportResult success;
|
|
45 | 46 |
|
46 | 47 |
URI sourceUri = null; |
47 | 48 |
File file = new File(source); |
... | ... | |
50 | 51 |
System.exit(-1); |
51 | 52 |
} |
52 | 53 |
sourceUri = file.toURI(); |
53 |
|
|
54 |
|
|
54 | 55 |
CommonNameImportConfigurator config; |
55 |
|
|
56 |
|
|
56 | 57 |
config = CommonNameImportConfigurator.NewInstance(sourceUri, destination); |
57 |
|
|
58 |
|
|
58 | 59 |
// invoke import |
59 | 60 |
CdmDefaultImport<CommonNameImportConfigurator> myImport = new CdmDefaultImport<CommonNameImportConfigurator>(); |
60 |
success &= myImport.invoke(config);
|
|
61 |
String successString = success ? "successful" : " with errors "; |
|
61 |
success = myImport.invoke(config); |
|
62 |
String successString = success.isSuccess() ? "successful" : " with errors ";
|
|
62 | 63 |
System.out.println("End updating caches for "+ destination.getDatabase() + "..." + successString); |
63 | 64 |
return success; |
64 | 65 |
} |
65 |
|
|
66 |
|
|
66 | 67 |
/** |
67 | 68 |
* @param args |
68 | 69 |
*/ |
69 | 70 |
public static void main(String[] args) { |
70 | 71 |
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination; |
71 |
|
|
72 |
|
|
72 | 73 |
System.out.println("Start updating caches for "+ destination.getDatabase() + "..."); |
73 | 74 |
CichorieaeCommonNameActivator me = new CichorieaeCommonNameActivator(); |
74 | 75 |
me.doInvoke(destination); |
75 |
|
|
76 |
|
|
76 | 77 |
} |
77 | 78 |
|
78 | 79 |
} |
Also available in: Unified diff
adapt the import classes to the new return type ImportResult