Revision b920f5c2
Added by Andreas Müller over 3 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/abcdImport/SpecimenImport.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.abcdImport; |
10 |
|
|
11 | 11 |
import java.io.File; |
12 | 12 |
import java.net.URI; |
13 | 13 |
|
... | ... | |
31 | 31 |
|
32 | 32 |
final static String xmlSource = "/home/pkelbert/Documents/Proibiosphere/Presentations/Demo/ABCD/calvum.xml"; |
33 | 33 |
|
34 |
|
|
35 | 34 |
static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); |
36 | 35 |
// static final ICdmDataSource cdmDestination = CdmDestinations.makeDestination(DatabaseTypeEnum.H2, "localhost", "abcd_import_test", 8082, "root", "root"); |
37 | 36 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
38 | 37 |
|
39 |
/** |
|
40 |
* @param args |
|
41 |
*/ |
|
42 | 38 |
public static void main(String[] args) { |
43 | 39 |
|
44 |
|
|
45 | 40 |
URI source; |
46 | 41 |
try { |
47 | 42 |
URI uri = new File(xmlSource).toURI(); |
... | ... | |
50 | 45 |
System.out.println("Start import from ABCD Specimen data("+ source.toString() + ") ..."); |
51 | 46 |
|
52 | 47 |
ICdmDataSource destination = cdmDestination; |
53 |
Abcd206ImportConfigurator specimenImportConfigurator = Abcd206ImportConfigurator.NewInstance(source, destination);
|
|
48 |
Abcd206ImportConfigurator specimenImportConfigurator = Abcd206ImportConfigurator.NewInstance(source, destination); |
|
54 | 49 |
|
55 | 50 |
//// specimenImportConfigurator.setClassificationName(specimenImportConfigurator.getSourceReferenceTitle()); |
56 | 51 |
specimenImportConfigurator.setSourceSecId("specimen"); |
... | ... | |
76 | 71 |
} catch (Exception e) { |
77 | 72 |
e.printStackTrace(); |
78 | 73 |
} |
79 |
|
|
80 | 74 |
} |
81 |
|
|
82 |
} |
|
75 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/abcdImport/SynthesysCacheActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.abcdImport; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
22 | 21 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK; |
23 | 22 |
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenSynthesysExcelImportConfigurator; |
24 | 23 |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 | 24 |
/** |
29 | 25 |
* @author PK |
30 | 26 |
* @since 19.09.2008 |
31 | 27 |
*/ |
32 | 28 |
public class SynthesysCacheActivator { |
29 |
|
|
33 | 30 |
@SuppressWarnings("unused") |
34 | 31 |
private static Logger logger = Logger.getLogger(SynthesysCacheActivator.class); |
35 | 32 |
|
... | ... | |
38 | 35 |
// final static String xmlSource = "/home/pkelbert/workspace/proibiosphere/cdmlib-io/target/test-classes/eu/etaxonomy/cdm/io/specimen/excel/in/ExcelImportConfiguratorTest-input.xls"; |
39 | 36 |
final static String xmlSource = "/home/pkelbert/Documents/Proibiosphere/ChenopodiumQuentin/GBIF data etc.xls"; |
40 | 37 |
|
41 |
|
|
42 | 38 |
// static final ICdmDataSource cdmDestination = CdmDestinations.mon_cdm(); |
43 | 39 |
// static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE; |
44 | 40 |
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_proibiosphere_chenopodium(); |
45 | 41 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE; |
46 | 42 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
47 | 43 |
|
48 |
/** |
|
49 |
* @param args |
|
50 |
*/ |
|
51 | 44 |
public static void main(String[] args) { |
52 | 45 |
URI source; |
53 | 46 |
try { |
... | ... | |
82 | 75 |
e.printStackTrace(); |
83 | 76 |
} |
84 | 77 |
} |
85 |
} |
|
78 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/caryophyllales/TcsSources.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.caryophyllales; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
24 | 23 |
* @since May 2014 |
25 | 24 |
*/ |
26 | 25 |
public class TcsSources { |
27 |
private static final Logger logger = Logger.getLogger(TcsSources.class); |
|
28 | 26 |
|
27 |
private static final Logger logger = Logger.getLogger(TcsSources.class); |
|
29 | 28 |
|
30 | 29 |
public static URI normalExplicit(){ |
31 | 30 |
try { |
... | ... | |
50 | 49 |
e.printStackTrace(); |
51 | 50 |
throw new RuntimeException(e); |
52 | 51 |
} |
53 |
|
|
54 | 52 |
} |
55 | 53 |
|
56 | 54 |
public static String arecaceae(){ |
... | ... | |
99 | 97 |
} catch (MalformedURLException e) { |
100 | 98 |
throw new RuntimeException(e); |
101 | 99 |
} |
102 |
|
|
103 | 100 |
} |
104 | 101 |
|
105 |
|
|
106 |
|
|
107 | 102 |
public static String tcsXml_localPath(){ |
108 | 103 |
File file = new File("C:\\localCopy\\Data\\tdwg\\Cichorium_tcs.xml"); |
109 | 104 |
String sourceUrl; |
... | ... | |
114 | 109 |
throw new RuntimeException(e); |
115 | 110 |
} |
116 | 111 |
return sourceUrl; |
117 |
|
|
118 | 112 |
} |
119 | 113 |
|
120 | 114 |
public static String tcsXmlTest_local2(){ |
... | ... | |
131 | 125 |
URL resourceUrl = new TcsSources().getClass().getResource(sourceUrl); |
132 | 126 |
logger.debug("TcsRdfSource " + resourceUrl.toString()); |
133 | 127 |
return resourceUrl.toString(); |
134 |
|
|
135 | 128 |
} |
136 |
|
|
137 |
|
|
138 |
|
|
139 |
} |
|
129 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/jaxb/JaxbExportActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.jaxb; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
54 | 53 |
// String username = "edit"; |
55 | 54 |
// sourceParam = CdmDataSource.NewMySqlInstance(server, database, username, AccountStore.readOrStorePassword(server, database, username, null)); |
56 | 55 |
|
57 |
|
|
58 |
|
|
59 | 56 |
JaxbExportConfigurator jaxbExportConfigurator; |
60 | 57 |
if (file !=null && sourceParam != null){ |
61 | 58 |
jaxbExportConfigurator = JaxbExportConfigurator.NewInstance(sourceParam, file); |
... | ... | |
67 | 64 |
jaxbExportConfigurator = JaxbExportConfigurator.NewInstance(cdmSource, new File(exportFileName)); |
68 | 65 |
} |
69 | 66 |
|
70 |
|
|
71 | 67 |
CdmDefaultExport<JaxbExportConfigurator> jaxbExport = |
72 | 68 |
new CdmDefaultExport<JaxbExportConfigurator>(); |
73 | 69 |
|
74 |
|
|
75 | 70 |
// invoke export |
76 | 71 |
logger.debug("Invoking Jaxb export"); |
77 | 72 |
jaxbExport.invoke(jaxbExportConfigurator); |
... | ... | |
89 | 84 |
return null; |
90 | 85 |
} |
91 | 86 |
|
92 |
|
|
93 |
|
|
94 |
|
|
95 | 87 |
private CdmApplicationController initDb(ICdmDataSource db) { |
96 |
|
|
97 | 88 |
// Init source DB |
98 | 89 |
CdmApplicationController appCtrInit = TestDatabase.initDb(db, DbSchemaValidation.VALIDATE, false); |
99 |
|
|
100 | 90 |
return appCtrInit; |
101 | 91 |
} |
102 | 92 |
|
103 |
|
|
104 | 93 |
// Load test data to DB |
105 | 94 |
private void loadTestData(CdmApplicationController appCtrInit) { |
106 | 95 |
TestDatabase.loadTestData("", appCtrInit); |
107 | 96 |
} |
108 | 97 |
|
109 |
|
|
110 |
/** |
|
111 |
* @param args |
|
112 |
*/ |
|
113 | 98 |
public static void main(String[] args) { |
114 | 99 |
|
115 | 100 |
JaxbExportActivator sc = new JaxbExportActivator(); |
... | ... | |
132 | 117 |
// TODO Auto-generated catch block |
133 | 118 |
e.printStackTrace(); |
134 | 119 |
} |
135 |
|
|
136 | 120 |
} |
137 |
|
|
138 |
} |
|
121 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/jaxb/JaxbImportActivator.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2008 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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.jaxb; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
26 | 25 |
/** |
27 | 26 |
* @author a.babadshanjan |
28 | 27 |
* @since 25.09.2008 |
29 |
*
|
|
30 |
* NOTE: the result may go into
|
|
28 |
* |
|
29 |
* NOTE: the result may go into |
|
31 | 30 |
* cdmlib-persistence\target\test-classes\eu\etaxonomy\cdm\h2\LocalH2 |
32 | 31 |
*/ |
33 | 32 |
public class JaxbImportActivator { |
... | ... | |
36 | 35 |
// private static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test(); |
37 | 36 |
//if you run from IDE it may run into {cdmlib-folder}\cdmlib-persistence\target\test-classes\eu\etaxonomy\cdm\h2\LocalH2\ |
38 | 37 |
private static final ICdmDataSource cdmDestination = CdmDestinations.localH2Armeria(); |
39 |
|
|
40 |
|
|
38 |
|
|
41 | 39 |
// Import: |
42 |
private static String importFileNameString =
|
|
40 |
private static String importFileNameString = |
|
43 | 41 |
//"C:\\workspace\\cdmlib_2.2\\cdmlib-io\\src\\test\\resources\\eu\\etaxonomy\\cdm\\io\\jaxb\\export_test_app_import.xml"; |
44 | 42 |
// "file:/C:/export_test_app_import.xml"; |
45 | 43 |
// "file:/C:/opt/data/rl/201406041541-jaxb_export-Regenwuermer.xml"; |
... | ... | |
48 | 46 |
// "//PESIIMPORT3/redlist/standardliste/standardliste_jaxb.xml"; |
49 | 47 |
"//PESIIMPORT3/redlist/201411261506-jaxb_export-armeria_demo_local.xml"; |
50 | 48 |
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 | 49 |
|
56 | 50 |
/** NUMBER_ROWS_TO_RETRIEVE = 0 is the default case to retrieve all rows. |
57 |
* For testing purposes: If NUMBER_ROWS_TO_RETRIEVE >0 then retrieve
|
|
58 |
* as many rows as specified for agents, references, etc.
|
|
51 |
* For testing purposes: If NUMBER_ROWS_TO_RETRIEVE >0 then retrieve |
|
52 |
* as many rows as specified for agents, references, etc. |
|
59 | 53 |
* Only root taxa and no synonyms and relationships are retrieved. */ |
60 | 54 |
private static final int NUMBER_ROWS_TO_RETRIEVE = 0; |
61 | 55 |
|
... | ... | |
67 | 61 |
if (importFileParamString !=null && destination != null){ |
68 | 62 |
URI importFileParam = new URI(importFileParamString); |
69 | 63 |
jaxbImportConfigurator = JaxbImportConfigurator.NewInstance(importFileParam, destination); |
70 |
}else if (destination != null){
|
|
64 |
}else if (destination != null){ |
|
71 | 65 |
URI importFileName = new URI(importFileNameString); |
72 | 66 |
jaxbImportConfigurator = JaxbImportConfigurator.NewInstance(importFileName, destination); |
73 | 67 |
} else if (importFileParamString !=null ){ |
... | ... | |
77 | 71 |
URI importFileName = new URI(importFileNameString); |
78 | 72 |
jaxbImportConfigurator = JaxbImportConfigurator.NewInstance(importFileName, cdmDestination); |
79 | 73 |
} |
80 |
|
|
81 |
CdmDefaultImport<JaxbImportConfigurator> jaxbImport =
|
|
74 |
|
|
75 |
CdmDefaultImport<JaxbImportConfigurator> jaxbImport = |
|
82 | 76 |
new CdmDefaultImport<JaxbImportConfigurator>(); |
83 |
|
|
84 |
|
|
77 |
|
|
78 |
|
|
85 | 79 |
// invoke import |
86 | 80 |
logger.debug("Invoking Jaxb import"); |
87 |
|
|
81 |
|
|
88 | 82 |
jaxbImport.invoke(jaxbImportConfigurator, destination, true); |
89 | 83 |
} catch (URISyntaxException e) { |
90 | 84 |
e.printStackTrace(); |
... | ... | |
98 | 92 |
}else { |
99 | 93 |
jaxbImportConfigurator = JaxbImportConfigurator.NewInstance(importUri, cdmDestination); |
100 | 94 |
} |
101 |
|
|
102 |
CdmDefaultImport<JaxbImportConfigurator> jaxbImport = |
|
103 |
new CdmDefaultImport<JaxbImportConfigurator>(); |
|
104 | 95 |
|
96 |
CdmDefaultImport<JaxbImportConfigurator> jaxbImport = |
|
97 |
new CdmDefaultImport<JaxbImportConfigurator>(); |
|
105 | 98 |
|
106 | 99 |
// invoke import |
107 | 100 |
logger.debug("Invoking Jaxb import"); |
108 | 101 |
|
109 | 102 |
jaxbImport.invoke(jaxbImportConfigurator, destination, true); |
110 |
|
|
111 | 103 |
} |
112 | 104 |
|
113 |
|
|
114 | 105 |
private CdmApplicationController initDb(ICdmDataSource db) { |
115 |
|
|
116 | 106 |
// Init source DB |
117 | 107 |
CdmApplicationController appCtrInit = null; |
118 |
|
|
119 | 108 |
appCtrInit = TestDatabase.initDb(db, DbSchemaValidation.CREATE, false); |
120 |
|
|
121 | 109 |
return appCtrInit; |
122 | 110 |
} |
123 | 111 |
|
124 |
|
|
125 | 112 |
// Load test data to DB |
126 | 113 |
private void loadTestData(CdmApplicationController appCtrInit) { |
127 | 114 |
|
128 | 115 |
TestDatabase.loadTestData("", appCtrInit); |
129 | 116 |
} |
130 |
|
|
117 |
|
|
131 | 118 |
public static String chooseFile(String[] args) { |
132 |
if(args == null) |
|
133 |
return null; |
|
119 |
if(args == null) { |
|
120 |
return null; |
|
121 |
} |
|
134 | 122 |
for (String dest: args){ |
135 | 123 |
if (dest.endsWith(".xml")){ |
136 | 124 |
return args[0]; |
... | ... | |
139 | 127 |
return null; |
140 | 128 |
} |
141 | 129 |
|
142 |
/** |
|
143 |
* @param args |
|
144 |
*/ |
|
145 | 130 |
public static void main(String[] args) { |
146 | 131 |
|
147 | 132 |
JaxbImportActivator jia = new JaxbImportActivator(); |
... | ... | |
157 | 142 |
} |
158 | 143 |
jia.invokeImport(uri, destination); |
159 | 144 |
} |
160 |
|
|
161 |
} |
|
145 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/phycobank/IAPTActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.phycobank; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
28 | 27 |
import eu.etaxonomy.cdm.model.reference.Reference; |
29 | 28 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
30 | 29 |
|
31 |
|
|
32 | 30 |
/** |
33 | 31 |
* @author a.kohlbecker |
34 | 32 |
* @since Jul 26, 2016 |
35 |
* |
|
36 | 33 |
*/ |
37 | 34 |
public class IAPTActivator { |
38 | 35 |
private static final Logger logger = Logger.getLogger(IAPTActivator.class); |
... | ... | |
112 | 109 |
doSingleSource(fileURI(), config, myImport); |
113 | 110 |
|
114 | 111 |
System.exit(0); |
115 |
|
|
116 | 112 |
} |
117 | 113 |
|
118 |
/** |
|
119 |
* @param source |
|
120 |
* @param config |
|
121 |
* @param myImport |
|
122 |
*/ |
|
123 | 114 |
private void doSingleSource(URI source, IAPTImportConfigurator config, CdmDefaultImport<IAPTImportConfigurator> myImport) { |
124 | 115 |
config.setSource(source); |
125 | 116 |
String fileName = source.toString(); |
... | ... | |
150 | 141 |
return f.toURI(); |
151 | 142 |
} |
152 | 143 |
|
153 |
/** |
|
154 |
* @param args |
|
155 |
*/ |
|
156 | 144 |
public static void main(String[] args) { |
157 | 145 |
if(args.length == 0){ |
158 | 146 |
logger.warn("Missing argument, valid values are: 'import' , 'createRegistrations'"); |
... | ... | |
160 | 148 |
IAPTActivator me = new IAPTActivator(); |
161 | 149 |
me.doImport(cdmDestination); |
162 | 150 |
} |
163 |
|
|
164 |
} |
|
151 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/proibiosphere/SpecimenImportActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.proibiosphere; |
11 | 10 |
import java.io.File; |
12 | 11 |
import java.net.URI; |
... | ... | |
35 | 34 |
|
36 | 35 |
// final static String xmlSource = "C:\\localCopy\\eclipse\\cdmlib\\app-import\\src\\main\\resources\\specimenABCD\\CDMtabular9c04a474e2_23_09_08.xls"; |
37 | 36 |
|
38 |
|
|
39 |
|
|
40 | 37 |
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_proibiosphere_chenopodium(); |
41 | 38 |
//check - import |
42 | 39 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
43 | 40 |
|
44 |
/** |
|
45 |
* @param args |
|
46 |
*/ |
|
47 | 41 |
public static void main(String[] args) { |
48 | 42 |
URI source; |
49 | 43 |
try { |
... | ... | |
87 | 81 |
} catch (URISyntaxException e) { |
88 | 82 |
e.printStackTrace(); |
89 | 83 |
} |
90 |
|
|
91 | 84 |
} |
92 |
|
|
93 |
} |
|
85 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/proibiosphere/TaxonXImportLauncher.java | ||
---|---|---|
264 | 264 |
} |
265 | 265 |
documentMap.put(docId, uritmp); |
266 | 266 |
} |
267 |
|
|
268 | 267 |
return documentMap; |
269 |
|
|
270 | 268 |
} |
271 | 269 |
|
272 | 270 |
private static void checkTreatmentAvailable(Map<String, List<String>> documents, Map<String, List<String>> docs) |
app-import/src/main/java/eu/etaxonomy/cdm/app/sdd/SDDImportActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.sdd; |
11 | 10 |
|
12 | 11 |
import java.net.URI; |
... | ... | |
31 | 30 |
* @author h.fradin |
32 | 31 |
* @author l.morris |
33 | 32 |
* @since 24.10.2008 |
34 |
* @version 1.0 |
|
35 | 33 |
*/ |
36 | 34 |
public class SDDImportActivator { |
37 | 35 |
@SuppressWarnings("unused") |
... | ... | |
86 | 84 |
//return loadedDataSource; |
87 | 85 |
return dataSource; |
88 | 86 |
} |
89 |
/** |
|
90 |
* @param args |
|
91 |
*/ |
|
87 |
|
|
92 | 88 |
public static void main(String[] args) { |
93 | 89 |
//String sddSource = SDDSources.SDDImport_local(args[0]+args[1]); |
94 | 90 |
//System.out.println("Start import from SDD("+ sddSource.toString() + ") ..."); |
... | ... | |
126 | 122 |
} catch (URISyntaxException e) { |
127 | 123 |
e.printStackTrace(); |
128 | 124 |
} |
129 |
|
|
130 | 125 |
} |
131 |
|
|
132 |
|
|
133 |
} |
|
126 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/sdd/SDDSources.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 |
*/ |
... | ... | |
23 | 23 |
public class SDDSources { |
24 | 24 |
@SuppressWarnings("unused") |
25 | 25 |
private static final Logger logger = Logger.getLogger(SDDSources.class); |
26 |
|
|
26 |
|
|
27 | 27 |
|
28 | 28 |
public static URI tdwg_expert(){ |
29 | 29 |
|
... | ... | |
35 | 35 |
// // TODO Auto-generated catch block |
36 | 36 |
// e.printStackTrace(); |
37 | 37 |
// } |
38 |
//
|
|
38 |
// |
|
39 | 39 |
// URL url = new SDDSources().getClass().getResource("/sdd/SDD-Test-Simple.xml"); |
40 | 40 |
String sourceUrl = "C:\\localCopy\\tdwg2010\\data\\descriptions\\sdd\\Xper-Cichorium_spinosum.sdd.xml"; |
41 | 41 |
// String sourceUrl = url.toString(); |
42 | 42 |
URI uri = new File(sourceUrl).toURI(); |
43 | 43 |
return uri; |
44 |
|
|
44 |
|
|
45 | 45 |
} |
46 | 46 |
|
47 |
|
|
47 |
|
|
48 | 48 |
public static String viola_local(){ |
49 | 49 |
// SDD XML example from the SDD v1.1 package |
50 | 50 |
URL url = new SDDSources().getClass().getResource("/sdd/SDD-Test-Simple.xml"); |
51 | 51 |
String sourceUrl = url.toString(); |
52 | 52 |
return sourceUrl; |
53 |
|
|
53 |
|
|
54 | 54 |
} |
55 |
|
|
55 |
|
|
56 | 56 |
public static String SDDImport_local(String filePath){ |
57 | 57 |
// any SDD XML file |
58 | 58 |
String sourceUrl = "file:" + filePath; |
59 | 59 |
return sourceUrl; |
60 |
|
|
60 |
|
|
61 | 61 |
} |
62 |
|
|
62 |
|
|
63 | 63 |
public static String LIAS_local(){ |
64 | 64 |
// SDD XML example from http://wiki.tdwg.org/twiki/bin/view/SDD/RealWorldExamples_SDD1dot1 |
65 | 65 |
//String sourceUrl = "file:C:/Documents and Settings/lis/Mes documents/SDD/SDD bis/SDD1.1/SDD1.1/examples/LIAS_Main.sdd11/LIAS_Main.sdd11.xml"; |
66 | 66 |
URL url = new SDDSources().getClass().getResource("/sdd/LIAS_Main.sdd11.xml"); |
67 | 67 |
String sourceUrl = url.toString(); |
68 | 68 |
return sourceUrl; |
69 |
|
|
69 |
|
|
70 | 70 |
} |
71 |
|
|
71 |
|
|
72 | 72 |
public static String Erythroneura_local(){ |
73 | 73 |
// SDD XML example from http://wiki.tdwg.org/twiki/bin/view/SDD/RealWorldExamples_SDD1dot1 |
74 | 74 |
//String sourceUrl = "file:C:/Documents and Settings/lis/Mes documents/SDD/SDD bis/SDD1.1/SDD1.1/examples/Erythroneura.sdd11/Erythroneura.sdd11.xml"; |
75 | 75 |
URL url = new SDDSources().getClass().getResource("/sdd/Erythroneura.sdd11.xml"); |
76 | 76 |
String sourceUrl = url.toString(); |
77 | 77 |
return sourceUrl; |
78 |
|
|
78 |
|
|
79 | 79 |
} |
80 |
|
|
80 |
|
|
81 | 81 |
public static String Cicad_local(){ |
82 | 82 |
// SDD XML example from http://wiki.tdwg.org/twiki/bin/view/SDD/RealWorldExamples_SDD1dot1 |
83 | 83 |
//String sourceUrl = "file:C:/Documents and Settings/lis/Mes documents/SDD/SDD bis/SDD1.1/SDD1.1/examples/Cicad.sdd11/Cicad.sdd11.xml"; |
84 | 84 |
URL url = new SDDSources().getClass().getResource("/sdd/Cicad.sdd11.xml"); |
85 | 85 |
String sourceUrl = url.toString(); |
86 | 86 |
return sourceUrl; |
87 |
|
|
87 |
|
|
88 | 88 |
} |
89 |
|
|
89 |
|
|
90 | 90 |
public static String ValRosandraFRIDAKey_local(){ |
91 | 91 |
// SDD XML example from http://wiki.tdwg.org/twiki/bin/view/SDD/RealWorldExamples_SDD1dot1 |
92 | 92 |
//String sourceUrl = "file:C:/Documents and Settings/lis/Mes documents/SDD/SDD bis/SDD1.1/SDD1.1/examples/Val-Rosandra-FRIDA-Key.sdd11/Val-Rosandra-FRIDA-Key.sdd11.xml"; |
93 | 93 |
URL url = new SDDSources().getClass().getResource("/sdd/Val-Rosandra-FRIDA-Key.sdd11.xml"); |
94 | 94 |
String sourceUrl = url.toString(); |
95 | 95 |
return sourceUrl; |
96 |
|
|
96 |
|
|
97 | 97 |
} |
98 |
|
|
98 |
|
|
99 | 99 |
public static String FreshwaterAquaticInsects_local(){ |
100 | 100 |
// SDD export from an Xper2 application |
101 | 101 |
String sourceUrl = "file:C:/Documents and Settings/lis/Mes documents/SDD/SDD bis/SDD1.1/SDD1.1/examples/Freshwater aquatic insects/test v2.sdd.xml"; |
102 | 102 |
return sourceUrl; |
103 | 103 |
} |
104 |
|
|
104 |
|
|
105 | 105 |
public static String cichorieae_Xper2_local(){ |
106 | 106 |
URL url = new SDDSources().getClass().getResource("/sdd/cichorieae-Xper2.xml"); |
107 | 107 |
String sourceUrl = url.toString(); |
108 |
return sourceUrl;
|
|
108 |
return sourceUrl; |
|
109 | 109 |
} |
110 |
|
|
110 |
|
|
111 | 111 |
public static String Cichorieae_DA_export_sdd(){ |
112 | 112 |
String locationString = "/sdd/Xper2-import-export.sdd.xml"; |
113 | 113 |
//String locationString = "/sdd/Cichorieae-DA-export-sdd.xml"; |
114 |
|
|
114 |
|
|
115 | 115 |
URL url = new SDDSources().getClass().getResource(locationString); |
116 | 116 |
String sourceUrl = url.toString(); |
117 |
return sourceUrl;
|
|
117 |
return sourceUrl; |
|
118 | 118 |
} |
119 |
|
|
119 |
|
|
120 | 120 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/tcs/TcsSources.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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.tcs; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
22 | 21 |
/** |
23 | 22 |
* @author a.mueller |
24 | 23 |
* @since 20.06.2008 |
25 |
* @version 1.0 |
|
26 | 24 |
*/ |
27 | 25 |
public class TcsSources { |
28 |
private static final Logger logger = Logger.getLogger(TcsSources.class); |
|
29 |
|
|
30 |
|
|
26 |
|
|
27 |
private static final Logger logger = Logger.getLogger(TcsSources.class); |
|
28 |
|
|
31 | 29 |
public static URI normalExplicit(){ |
32 | 30 |
try { |
33 | 31 |
// URL url = new File(("C:\\localCopy\\eclipse\\cdmlib\\trunk\\app-import\\src\\main\\resources\\excel\\NormalExplicit.xls")).toURL(); |
34 |
|
|
32 |
|
|
35 | 33 |
// FIXME what is this???? |
36 | 34 |
URL url = new File("D:\\NormalExplicit.xls").toURI().toURL(); |
37 | 35 |
|
38 |
|
|
36 |
|
|
39 | 37 |
// URL url = new TcsSources().getClass().getResource("excel/NormalExplicit.xls"); |
40 | 38 |
boolean exists = new File(url.getFile()).exists(); |
41 | 39 |
if (! exists) throw new RuntimeException("File not found: " + url); |
... | ... | |
49 | 47 |
e.printStackTrace(); |
50 | 48 |
throw new RuntimeException(e); |
51 | 49 |
} |
52 |
|
|
53 | 50 |
} |
54 |
|
|
51 |
|
|
55 | 52 |
public static String arecaceae(){ |
56 | 53 |
// Monocots rdf |
57 | 54 |
String sourceUrl = "http://dev.e-taxonomy.eu/trac/attachment/wiki/SampleDataConversion/Monocotyledonae/arecaceae.rdf?format=raw"; |
58 | 55 |
logger.debug("TcsSource " + sourceUrl); |
59 | 56 |
return sourceUrl; |
60 |
|
|
61 | 57 |
} |
62 |
|
|
58 |
|
|
63 | 59 |
public static String taxonX_local(){ |
64 | 60 |
// Monocots rdf |
65 | 61 |
//String sourceUrl = "file:C:/localCopy/eclipse/cdmlib/app-import/src/main/resources/palm_tn_29336.xml"; |
... | ... | |
73 | 69 |
File sourceDir = new File("target/classes/taxonX/"); //palm_tc_14495.xml |
74 | 70 |
return sourceDir; |
75 | 71 |
} |
76 |
|
|
72 |
|
|
77 | 73 |
public static String arecaceae_local(){ |
78 | 74 |
// Monocots rdf |
79 | 75 |
//String sourceUrl = "file:C:/localCopy/eclipse/cdmlib/app-import/src/main/resources/arecaceae.rdf"; |
80 | 76 |
URL url = new SDDSources().getClass().getResource("/arecaceae.rdf"); |
81 | 77 |
String sourceUrl = url.toString(); |
82 | 78 |
return sourceUrl; |
83 |
|
|
84 | 79 |
} |
85 | 80 |
|
86 |
|
|
87 | 81 |
public static String tcsXml_cichorium(){ |
88 | 82 |
// tcsXmlTest.xml |
89 | 83 |
URL url = new TcsSources().getClass().getResource("/tcs/Cichorium_tcs.xml"); |
90 | 84 |
String sourceUrl = url.toString(); |
91 |
return sourceUrl;
|
|
85 |
return sourceUrl; |
|
92 | 86 |
} |
93 | 87 |
|
94 | 88 |
public static String tcsXml_nyctaginaceae(){ |
... | ... | |
98 | 92 |
} catch (MalformedURLException e) { |
99 | 93 |
throw new RuntimeException(e); |
100 | 94 |
} |
101 |
|
|
102 | 95 |
} |
103 | 96 |
|
104 |
|
|
105 |
|
|
106 | 97 |
public static String tcsXml_localPath(){ |
107 | 98 |
File file = new File("C:\\localCopy\\Data\\tdwg\\Cichorium_tcs.xml"); |
108 | 99 |
String sourceUrl; |
... | ... | |
113 | 104 |
throw new RuntimeException(e); |
114 | 105 |
} |
115 | 106 |
return sourceUrl; |
116 |
|
|
117 |
} |
|
118 |
|
|
107 |
} |
|
108 |
|
|
119 | 109 |
public static String tcsXmlTest_local2(){ |
120 | 110 |
// tcsXmlTest.xml |
121 | 111 |
URL url = new TcsSources().getClass().getResource("/TcsXmlImportConfiguratorTest-input.xml"); |
122 | 112 |
String sourceUrl = url.toString(); |
123 |
return sourceUrl;
|
|
113 |
return sourceUrl; |
|
124 | 114 |
} |
125 |
|
|
115 |
|
|
126 | 116 |
public static String tcsRdf_globis(){ |
127 | 117 |
// globis.rdf.xml |
128 | 118 |
//String sourceUrl = "file:C:/Dokumente und Einstellungen/a.kohlbecker.BGBM/Desktop/globis.rdf.xml"; |
... | ... | |
130 | 120 |
URL resourceUrl = new TcsSources().getClass().getResource(sourceUrl); |
131 | 121 |
logger.debug("TcsRdfSource " + resourceUrl.toString()); |
132 | 122 |
return resourceUrl.toString(); |
133 |
|
|
134 |
} |
|
135 |
|
|
123 |
} |
|
124 |
|
|
136 | 125 |
public static String tcsRdf_test(){ |
137 | 126 |
// globis.rdf.xml |
138 | 127 |
//String sourceUrl = "file:C:/Dokumente und Einstellungen/a.kohlbecker.BGBM/Desktop/globis.rdf.xml"; |
... | ... | |
140 | 129 |
URL resourceUrl = new TcsSources().getClass().getResource(sourceUrl); |
141 | 130 |
logger.debug("TcsRdfSource " + resourceUrl.toString()); |
142 | 131 |
return resourceUrl.toString(); |
143 |
|
|
144 |
} |
|
145 |
|
|
146 |
|
|
147 |
} |
|
132 |
} |
|
133 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/uzbekistan/UzbekistanDescriptionsActivator.java | ||
---|---|---|
77 | 77 |
System.out.println(result.createReport()); |
78 | 78 |
} |
79 | 79 |
|
80 |
|
|
81 | 80 |
private URI fileName(){ |
82 | 81 |
return URI.create("file:////BGBM-PESIHPC/Uzbekistan/" + fileName); |
83 | 82 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/uzbekistan/UzbekistanHabitatActivator.java | ||
---|---|---|
27 | 27 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
28 | 28 |
|
29 | 29 |
/** |
30 |
* |
|
31 | 30 |
* Import for Flora of Uzbekistan habitats. |
32 | 31 |
* |
33 | 32 |
* https://dev.e-taxonomy.eu/redmine/issues/9049 |
... | ... | |
78 | 77 |
System.out.println(result.createReport()); |
79 | 78 |
} |
80 | 79 |
|
81 |
|
|
82 | 80 |
private URI fileName(){ |
83 | 81 |
return URI.create("file:////BGBM-PESIHPC/Uzbekistan/" + fileName); |
84 | 82 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/uzbekistan/UzbekistanPhenologyActivator.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
27 | 27 |
|
28 | 28 |
/** |
29 |
* |
|
30 | 29 |
* Import for Flora of Uzbekistan phenology. |
31 | 30 |
* |
32 | 31 |
* https://dev.e-taxonomy.eu/redmine/issues/9126 |
... | ... | |
75 | 74 |
System.out.println(result.createReport()); |
76 | 75 |
} |
77 | 76 |
|
78 |
|
|
79 | 77 |
private URI fileName(){ |
80 | 78 |
return URI.create("file:////BGBM-PESIHPC/Uzbekistan/" + fileName); |
81 | 79 |
} |
... | ... | |
97 | 95 |
me.doImport(cdmDestination); |
98 | 96 |
System.exit(0); |
99 | 97 |
} |
100 |
} |
|
98 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/uzbekistan/UzbekistanTaxonActivator.java | ||
---|---|---|
28 | 28 |
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser; |
29 | 29 |
|
30 | 30 |
/** |
31 |
* |
|
32 | 31 |
* Import for Flora of Uzbekistan taxa. |
33 | 32 |
* |
34 | 33 |
* https://dev.e-taxonomy.eu/redmine/issues/8996 |
... | ... | |
81 | 80 |
System.out.println(result.createReport()); |
82 | 81 |
} |
83 | 82 |
|
84 |
|
|
85 | 83 |
private URI uzbekistanChecklist(){ |
86 | 84 |
return URI.create("file:////BGBM-PESIHPC/Uzbekistan/" + fileName); |
87 | 85 |
} |
... | ... | |
135 | 133 |
me.doImport(cdmDestination); |
136 | 134 |
System.exit(0); |
137 | 135 |
} |
138 |
} |
|
136 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/cichorieae/CichorieaeCommonNameActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.wp6.cichorieae; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
21 | 20 |
import eu.etaxonomy.cdm.io.common.ImportResult; |
22 | 21 |
import eu.etaxonomy.cdm.io.wp6.CommonNameImportConfigurator; |
23 | 22 |
|
24 |
|
|
25 | 23 |
/** |
26 | 24 |
* TODO add the following to a wiki page: |
27 | 25 |
* 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 |
28 | 26 |
* you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names. |
29 | 27 |
* |
30 |
* |
|
31 | 28 |
* @author a.mueller |
32 |
* |
|
33 | 29 |
*/ |
34 | 30 |
public class CichorieaeCommonNameActivator { |
35 | 31 |
private static final Logger logger = Logger.getLogger(CichorieaeCommonNameActivator.class); |
... | ... | |
64 | 60 |
return success; |
65 | 61 |
} |
66 | 62 |
|
67 |
/** |
|
68 |
* @param args |
|
69 |
*/ |
|
70 | 63 |
public static void main(String[] args) { |
71 | 64 |
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination; |
72 | 65 |
|
73 | 66 |
System.out.println("Start updating caches for "+ destination.getDatabase() + "..."); |
74 | 67 |
CichorieaeCommonNameActivator me = new CichorieaeCommonNameActivator(); |
75 | 68 |
me.doInvoke(destination); |
76 |
|
|
77 | 69 |
} |
78 |
|
|
79 |
} |
|
70 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/palmae/UseSummaryActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.wp6.palmae; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
26 | 25 |
* |
27 | 26 |
* @author a.mueller |
28 | 27 |
* @since 18.07.2011 |
29 |
* |
|
30 | 28 |
*/ |
31 | 29 |
public class UseSummaryActivator { |
32 | 30 |
private static final Logger logger = Logger.getLogger(UseSummaryActivator.class); |
... | ... | |
59 | 57 |
// } catch (URISyntaxException e) { |
60 | 58 |
// e.printStackTrace(); |
61 | 59 |
// } |
62 |
|
|
63 | 60 |
} |
64 |
} |
|
61 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/io/PalmaeImageImport.java | ||
---|---|---|
165 | 165 |
return result; |
166 | 166 |
} |
167 | 167 |
|
168 |
|
|
169 |
|
|
170 | 168 |
@Override |
171 | 169 |
protected void invokeImageImport (ImageImportState state){ |
172 | 170 |
|
... | ... | |
324 | 322 |
if (artist.contains(",")){ |
325 | 323 |
String [] artistSplits = artist.split(","); |
326 | 324 |
artist = artistSplits[0]; |
327 |
|
|
328 | 325 |
} |
329 | 326 |
|
330 | 327 |
try{ |
... | ... | |
356 | 353 |
protected void doCount(int count, int modCount, String pluralString){ |
357 | 354 |
if ((count % modCount ) == 0 && count!= 0 ){ logger.info(pluralString + " handled: " + (count));} |
358 | 355 |
} |
359 |
|
|
360 | 356 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/io/bogota/BogotaChecklistImportConfigurator.java | ||
---|---|---|
1 |
// $Id$ |
|
2 | 1 |
/** |
3 | 2 |
* Copyright (C) 2017 EDIT |
4 | 3 |
* European Distributed Institute of Taxonomy |
... | ... | |
20 | 19 |
/** |
21 | 20 |
* @author a.mueller |
22 | 21 |
* @since 21.04.2017 |
23 |
* |
|
24 | 22 |
*/ |
25 | 23 |
public class BogotaChecklistImportConfigurator extends ExcelImportConfiguratorBase{ |
24 |
|
|
26 | 25 |
private static final long serialVersionUID = 5988430626932820343L; |
27 | 26 |
|
28 | 27 |
private Reference secReference; |
app-import/src/main/java/eu/etaxonomy/cdm/io/bogota/BogotaSpecimenImportConfigurator.java | ||
---|---|---|
1 |
// $Id$ |
|
2 | 1 |
/** |
3 | 2 |
* Copyright (C) 2017 EDIT |
4 | 3 |
* European Distributed Institute of Taxonomy |
... | ... | |
19 | 18 |
/** |
20 | 19 |
* @author a.mueller |
21 | 20 |
* @since 21.04.2017 |
22 |
* |
|
23 | 21 |
*/ |
24 | 22 |
public class BogotaSpecimenImportConfigurator extends ExcelImportConfiguratorBase{ |
25 | 23 |
|
... | ... | |
31 | 29 |
private Reference secReference; |
32 | 30 |
private boolean onlyNonCdmTaxa; |
33 | 31 |
|
34 |
/** |
|
35 |
* @param source |
|
36 |
* @param cdmDestination |
|
37 |
* @return |
|
38 |
*/ |
|
39 | 32 |
public static BogotaSpecimenImportConfigurator NewInstance(URI source, ICdmDataSource destination) { |
40 | 33 |
return new BogotaSpecimenImportConfigurator(source, destination); |
41 | 34 |
} |
42 | 35 |
|
43 |
/** |
|
44 |
* @param uri |
|
45 |
* @param destination |
|
46 |
*/ |
|
47 | 36 |
private BogotaSpecimenImportConfigurator(URI uri, ICdmDataSource destination) { |
48 | 37 |
super(uri, destination); |
49 | 38 |
} |
50 | 39 |
|
51 |
/** |
|
52 |
* {@inheritDoc} |
|
53 |
*/ |
|
54 | 40 |
@Override |
55 | 41 |
public ImportStateBase getNewState() { |
56 | 42 |
return new SimpleExcelSpecimenImportState<>(this); |
57 | 43 |
} |
58 | 44 |
|
59 |
/** |
|
60 |
* {@inheritDoc} |
|
61 |
*/ |
|
62 | 45 |
@Override |
63 | 46 |
protected void makeIoClassList() { |
64 | 47 |
ioClassList = new Class[]{ |
... | ... | |
96 | 79 |
public void setOnlyNonCdmTaxa(boolean onlyNonCdmTaxa) { |
97 | 80 |
this.onlyNonCdmTaxa = onlyNonCdmTaxa; |
98 | 81 |
} |
99 |
|
|
100 |
} |
|
82 |
} |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaEricaceaeActivator.java | ||
---|---|---|
48 | 48 |
/** |
49 | 49 |
* @author a.mueller |
50 | 50 |
* @since 20.06.2008 |
51 |
* @version 1.0 |
|
52 | 51 |
*/ |
53 | 52 |
public class CentralAfricaEricaceaeActivator { |
54 | 53 |
private static final Logger logger = Logger.getLogger(CentralAfricaEricaceaeActivator.class); |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaFernsFdacImportActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.eflora; |
11 | 10 |
|
12 | 11 |
import java.net.URI; |
... | ... | |
19 | 18 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK; |
20 | 19 |
import eu.etaxonomy.cdm.io.common.events.LoggingIoObserver; |
21 | 20 |
import eu.etaxonomy.cdm.io.dwca.in.DwcaDataImportConfiguratorBase.DatasetUse; |
22 |
import eu.etaxonomy.cdm.io.stream.mapping.IImportMapping.MappingType; |
|
23 | 21 |
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator; |
22 |
import eu.etaxonomy.cdm.io.stream.mapping.IImportMapping.MappingType; |
|
24 | 23 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
25 | 24 |
import eu.etaxonomy.cdm.model.reference.Reference; |
26 | 25 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
... | ... | |
28 | 27 |
/** |
29 | 28 |
* @author a.mueller |
30 | 29 |
* @since 03.04.2012 |
31 |
* @version 1.0 |
|
32 | 30 |
*/ |
33 | 31 |
public class CentralAfricaFernsFdacImportActivator { |
32 |
|
|
34 | 33 |
@SuppressWarnings("unused") |
35 | 34 |
private static final Logger logger = Logger.getLogger(CentralAfricaFernsFdacImportActivator.class); |
36 | 35 |
|
... | ... | |
60 | 59 |
//validate |
61 | 60 |
static boolean validateRankConsistency = true; |
62 | 61 |
|
63 |
|
|
64 | 62 |
//taxa |
65 | 63 |
static final boolean doTaxa = true; |
66 | 64 |
|
67 |
|
|
68 |
|
|
69 | 65 |
static final MappingType mappingType = MappingType.InMemoryMapping; |
70 | 66 |
|
71 | 67 |
private void doImport(ICdmDataSource cdmDestination){ |
... | ... | |
81 | 77 |
config.setSourceReferenceTitle(sourceReferenceTitle); |
82 | 78 |
config.setUseSourceReferenceAsSec(useSourceReferenceAsSec); |
83 | 79 |
|
84 |
CdmDefaultImport myImport = new CdmDefaultImport(); |
|
85 |
|
|
80 |
CdmDefaultImport<DwcaImportConfigurator> myImport = new CdmDefaultImport<>(); |
|
86 | 81 |
|
87 | 82 |
//... |
88 | 83 |
if (true){ |
... | ... | |
91 | 86 |
myImport.invoke(config); |
92 | 87 |
System.out.println("End import from ("+ source.toString() + ")..."); |
93 | 88 |
} |
94 |
|
|
95 |
|
|
96 | 89 |
} |
97 | 90 |
|
98 | 91 |
private Reference getSourceReference(String string) { |
99 | 92 |
Reference result = ReferenceFactory.newGeneric(); |
100 |
result.setTitleCache(string); |
|
93 |
result.setTitleCache(string, true);
|
|
101 | 94 |
return result; |
102 | 95 |
} |
103 | 96 |
|
104 |
|
|
105 | 97 |
//Scratchpads test |
106 | 98 |
public static URI dwca_ferns() { |
107 | 99 |
URI sourceUrl = URI.create("file:////PESIIMPORT3/fdac/dwca/ferns.zip"); |
108 | 100 |
return sourceUrl; |
109 | 101 |
} |
110 | 102 |
|
111 |
|
|
112 |
/** |
|
113 |
* @param args |
|
114 |
*/ |
|
115 | 103 |
public static void main(String[] args) { |
116 | 104 |
CentralAfricaFernsFdacImportActivator me = new CentralAfricaFernsFdacImportActivator(); |
117 | 105 |
me.doImport(cdmDestination); |
118 | 106 |
} |
119 |
|
|
120 |
} |
|
107 |
} |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/EfloraActivatorBase.java | ||
---|---|---|
1 | 1 |
/** |
2 |
* |
|
3 |
*/ |
|
2 |
* Copyright (C) 2009 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 |
*/ |
|
4 | 9 |
package eu.etaxonomy.cdm.app.eflora; |
5 | 10 |
|
6 | 11 |
import java.net.URI; |
... | ... | |
31 | 36 |
|
32 | 37 |
/** |
33 | 38 |
* @author a.mueller |
34 |
* |
|
35 | 39 |
*/ |
36 | 40 |
public class EfloraActivatorBase { |
37 | 41 |
private static final Logger logger = Logger.getLogger(EfloraActivatorBase.class); |
... | ... | |
39 | 43 |
protected MarkupImportConfigurator config; |
40 | 44 |
protected CdmDefaultImport<MarkupImportConfigurator> myImport; |
41 | 45 |
protected IIoObserver observer = new LoggingIoObserver(); |
42 |
protected Set<IIoObserver> observerList = new HashSet<IIoObserver>();
|
|
46 |
protected Set<IIoObserver> observerList = new HashSet<>(); |
|
43 | 47 |
|
44 | 48 |
protected MarkupImportConfigurator doImport(URI source, ICdmDataSource cdmDestination, CHECK check, boolean h2ForCheck){ |
45 | 49 |
observerList.add(observer); |
... | ... | |
94 | 98 |
} |
95 | 99 |
|
96 | 100 |
//save tree |
97 |
app.getFeatureTreeService().saveOrUpdate(tree);
|
|
101 |
app.getTermTreeService().saveOrUpdate(tree);
|
|
98 | 102 |
|
99 | 103 |
System.out.println("End creating automated Feature Tree"); |
100 | 104 |
|
... | ... | |
102 | 106 |
} |
103 | 107 |
|
104 | 108 |
private Map<UUID,Feature> makeUuidMap(Collection<UUID> uuids, ITermService termService){ |
105 |
HashSet<UUID> uuidSet = new HashSet<UUID>();
|
|
109 |
HashSet<UUID> uuidSet = new HashSet<>(); |
|
106 | 110 |
uuidSet.addAll(uuids); |
107 | 111 |
List<Feature> featureSet = (List)termService.find(uuidSet); |
108 | 112 |
|
109 |
Map<UUID,Feature> result = new HashMap<UUID, Feature>();
|
|
113 |
Map<UUID,Feature> result = new HashMap<>(); |
|
110 | 114 |
for (Feature feature : featureSet){ |
111 | 115 |
result.put(feature.getUuid(), feature); |
112 | 116 |
} |
113 | 117 |
return result; |
114 | 118 |
} |
115 | 119 |
|
116 |
|
|
117 |
/** |
|
118 |
* @param markupConfig |
|
119 |
* @param myImport |
|
120 |
*/ |
|
121 | 120 |
protected void executeVolume(URI source, boolean include) { |
122 | 121 |
if (include){ |
123 | 122 |
System.out.println("\nStart import from ("+ source.toString() + ") ..."); |
... | ... | |
126 | 125 |
System.out.println("End import from ("+ source.toString() + ")..."); |
127 | 126 |
} |
128 | 127 |
} |
129 |
}
|
|
128 |
} |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/EfloraSources.java | ||
---|---|---|
15 | 15 |
/** |
16 | 16 |
* @author a.mueller |
17 | 17 |
* @since 09.06.2010 |
18 |
* |
|
19 | 18 |
*/ |
20 | 19 |
public class EfloraSources { |
21 | 20 |
@SuppressWarnings("unused") |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/FloraGuianasActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.eflora; |
11 | 10 |
|
12 | 11 |
import java.net.URI; |
... | ... | |
64 | 63 |
static final URI fotg29 = EfloraSources.fotg_29(); |
65 | 64 |
static final URI fotg30 = EfloraSources.fotg_30(); |
66 | 65 |
|
67 |
|
|
68 | 66 |
private boolean inverseInclude = false; |
69 | 67 |
|
70 | 68 |
private boolean includeFotg1 = false; |
... | ... | |
116 | 114 |
|
117 | 115 |
static final boolean reuseState = true; |
118 | 116 |
|
119 |
|
|
120 |
|
|
121 | 117 |
private boolean replaceStandardKeyTitles = true; |
122 | 118 |
|
123 | 119 |
private boolean useFotGCollectionTypeOnly = true; |
... | ... | |
427 | 423 |
return lastChild; |
428 | 424 |
} |
429 | 425 |
|
430 |
|
|
431 |
|
|
432 |
/** |
|
433 |
* @param args |
|
434 |
*/ |
|
435 | 426 |
public static void main(String[] args) { |
436 | 427 |
FloraGuianasActivator me = new FloraGuianasActivator(); |
437 | 428 |
me.doImport(cdmDestination); |
438 | 429 |
} |
439 |
} |
|
430 |
} |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/FloraMalesianaActivator.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.eflora; |
11 | 10 |
|
12 | 11 |
import java.net.URI; |
... | ... | |
46 | 45 |
//database validation status (create, update, validate ...) |
47 | 46 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE; |
48 | 47 |
|
49 |
|
|
50 |
|
|
51 | 48 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_preview(); |
52 | 49 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_production(); |
53 | 50 |
static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); |
... | ... | |
437 | 434 |
"Chromosomes", |
438 | 435 |
}; |
439 | 436 |
|
440 |
|
|
441 | 437 |
private static String [] habitatEcologyList = new String[]{ |
442 | 438 |
"Habitat", |
443 | 439 |
"Habitat & Ecology" |
444 | 440 |
}; |
445 | 441 |
|
446 |
|
|
447 | 442 |
private static String [] generellDescriptionsUpToAnatomyList = new String[]{ |
448 | 443 |
"Fossils", |
449 | 444 |
"Morphology and anatomy", |
... | ... | |
451 | 446 |
"Vegetative morphology and anatomy", |
452 | 447 |
}; |
453 | 448 |
|
454 |
|
|
455 | 449 |
private static String [] anatomySubfeatureList = new String[]{ |
456 | 450 |
"Leaf anatomy", |
457 | 451 |
"Wood anatomy" |
... | ... | |
471 | 465 |
"Phytochemistry and Chemotaxonomy", |
472 | 466 |
}; |
473 | 467 |
|
474 |
|
|
475 | 468 |
private static String [] phytoChemoSubFeaturesList = new String[]{ |
476 | 469 |
"Alkaloids", |
477 | 470 |
"Iridoid glucosides", |
... | ... | |
481 | 474 |
"Chemotaxonomy", |
482 | 475 |
}; |
483 | 476 |
|
484 |
|
|
485 | 477 |
private static String [] generellDescriptionsFromPhytoChemoList = new String[]{ |
486 | 478 |
"Phytochemistry", |
487 | 479 |
"Taxonomy", |
... | ... | |
490 | 482 |
"Notes" |
491 | 483 |
}; |
492 | 484 |
|
493 |
|
|
494 | 485 |
private static String [] descriptionFeatureList = new String[]{ |
495 | 486 |
"lifeform", |
496 | 487 |
"Bark", |
... | ... | |
577 | 568 |
"figure", |
578 | 569 |
"fig", |
579 | 570 |
"figs", |
580 |
|
|
581 |
|
|
582 |
|
|
583 | 571 |
}; |
584 | 572 |
|
585 | 573 |
public TermNode<Feature> addFeatureNodesByStringList(String[] featureStringList, |
... | ... | |
601 | 589 |
return lastChild; |
602 | 590 |
} |
603 | 591 |
|
604 |
|
|
605 |
|
|
606 |
/** |
|
607 |
* @param args |
|
608 |
*/ |
|
609 | 592 |
public static void main(String[] args) { |
610 | 593 |
FloraMalesianaActivator me = new FloraMalesianaActivator(); |
611 | 594 |
me.doImport(cdmDestination); |
612 | 595 |
System.exit(0); |
613 | 596 |
} |
614 |
|
|
615 |
} |
|
597 |
} |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/FloraMalesianaActivator_OLD.java | ||
---|---|---|
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 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.app.eflora; |
11 | 10 |
|
12 | 11 |
import java.net.URI; |
... | ... | |
35 | 34 |
/** |
36 | 35 |
* @author a.mueller |
37 | 36 |
* @since 20.06.2008 |
38 |
* @version 1.0 |
|
39 | 37 |
*/ |
40 | 38 |
public class FloraMalesianaActivator_OLD { |
41 | 39 |
private static final Logger logger = Logger.getLogger(FloraMalesianaActivator_OLD.class); |
... | ... | |
47 | 45 |
static final URI fmSource13_1 = EfloraSources.fm_13_1_local(); |
48 | 46 |
static final URI fmSource13_2 = EfloraSources.fm_13_2_local(); |
49 | 47 |
|
50 |
|
|
51 | 48 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_andreasM3(); |
52 | 49 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_preview(); |
53 | 50 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_production(); |
54 | 51 |
static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); |
55 | 52 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql(); |
56 | 53 |
|
57 |
|
|
58 | 54 |
//feature tree uuid |
59 | 55 |
public static final UUID featureTreeUuid = UUID.fromString("168df0c6-6429-484c-b26f-ded1f7e44bd9"); |
60 | 56 |
|
... | ... | |
287 | 283 |
"figure", |
288 | 284 |
"fig", |
289 | 285 |
"figs", |
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 | 286 |
}; |
295 | 287 |
|
296 | 288 |
public void addFeatureNodesByStringList(String[] featureStringList, TermNode<Feature> root, IInputTransformer transformer, ITermService termService){ |
297 | 289 |
try { |
298 | 290 |
for (String featureString : featureStringList){ |
299 |
UUID featureUuid; |
|
300 |
featureUuid = transformer.getFeatureUuid(featureString); |
|
301 |
Feature feature = (Feature)termService.find(featureUuid); |
|
302 |
if (feature != null){ |
|
303 |
root.addChild(feature); |
|
304 |
} |
|
305 |
} |
|
291 |
UUID featureUuid;
|
|
292 |
featureUuid = transformer.getFeatureUuid(featureString);
|
|
293 |
Feature feature = (Feature)termService.find(featureUuid);
|
|
294 |
if (feature != null){
|
|
295 |
root.addChild(feature);
|
|
296 |
}
|
|
297 |
}
|
|
306 | 298 |
} catch (UndefinedTransformerMethodException e) { |
307 | 299 |
logger.error("getFeatureUuid is not implemented in transformer. Features could not be added"); |
308 | 300 |
} |
309 | 301 |
} |
310 | 302 |
|
311 |
|
|
312 |
|
|
313 |
/** |
|
314 |
* @param args |
|
315 |
*/ |
|
316 | 303 |
public static void main(String[] args) { |
317 | 304 |
FloraMalesianaActivator_OLD me = new FloraMalesianaActivator_OLD(); |
318 | 305 |
me.doImport(cdmDestination); |
319 | 306 |
} |
320 |
|
Also available in: Unified diff
cleanup