1 |
91138b6c
|
Andreas Müller
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
861ebadd
|
p.kelbert
|
* European Distributed Institute of Taxonomy
|
4 |
91138b6c
|
Andreas Müller
|
* http://www.e-taxonomy.eu
|
5 |
861ebadd
|
p.kelbert
|
*
|
6 |
91138b6c
|
Andreas Müller
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7 |
|
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
package eu.etaxonomy.cdm.app.abcdImport;
|
11 |
|
|
|
12 |
861ebadd
|
p.kelbert
|
import java.io.File;
|
13 |
|
|
import java.net.URI;
|
14 |
|
|
import java.net.URISyntaxException;
|
15 |
91138b6c
|
Andreas Müller
|
|
16 |
|
|
import org.apache.log4j.Logger;
|
17 |
|
|
|
18 |
|
|
import eu.etaxonomy.cdm.app.common.CdmDestinations;
|
19 |
|
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
20 |
861ebadd
|
p.kelbert
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
21 |
|
|
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
|
22 |
|
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
|
23 |
|
|
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenSynthesysExcelImportConfigurator;
|
24 |
91138b6c
|
Andreas Müller
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
/**
|
29 |
|
|
* @author PK
|
30 |
|
|
* @created 19.09.2008
|
31 |
|
|
* @version 1.0
|
32 |
|
|
*/
|
33 |
|
|
public class SynthesysCacheActivator {
|
34 |
861ebadd
|
p.kelbert
|
@SuppressWarnings("unused")
|
35 |
|
|
private static Logger logger = Logger.getLogger(SynthesysCacheActivator.class);
|
36 |
|
|
|
37 |
|
|
//database validation status (create, update, validate ...)
|
38 |
|
|
|
39 |
|
|
// final static String xmlSource = "/home/pkelbert/workspace/proibiosphere/cdmlib-io/target/test-classes/eu/etaxonomy/cdm/io/specimen/excel/in/ExcelImportConfiguratorTest-input.xls";
|
40 |
|
|
final static String xmlSource = "/home/pkelbert/Documents/Proibiosphere/ChenopodiumQuentin/GBIF data etc.xls";
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
// static final ICdmDataSource cdmDestination = CdmDestinations.mon_cdm();
|
44 |
|
|
// static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
45 |
f3715fb4
|
p.kelbert
|
static final ICdmDataSource cdmDestination = CdmDestinations.proibiosphere_chenopodium_local();
|
46 |
861ebadd
|
p.kelbert
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
|
47 |
|
|
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
|
48 |
|
|
|
49 |
|
|
/**
|
50 |
|
|
* @param args
|
51 |
|
|
*/
|
52 |
|
|
public static void main(String[] args) {
|
53 |
|
|
URI source;
|
54 |
|
|
try {
|
55 |
|
|
URI uri = new File(xmlSource).toURI();
|
56 |
|
|
source = new URI(uri.toString());
|
57 |
|
|
System.out.println(source.toString());
|
58 |
|
|
System.out.println("Start import from Excel Specimen data("+ source.toString() + ") ...");
|
59 |
|
|
|
60 |
|
|
ICdmDataSource destination = cdmDestination;
|
61 |
|
|
SpecimenSynthesysExcelImportConfigurator specimenImportConfigurator = SpecimenSynthesysExcelImportConfigurator.NewInstance(source, destination);
|
62 |
|
|
|
63 |
|
|
specimenImportConfigurator.setSourceSecId("specimen");
|
64 |
|
|
specimenImportConfigurator.setCheck(check);
|
65 |
|
|
specimenImportConfigurator.setDbSchemaValidation(hbm2dll);
|
66 |
|
|
specimenImportConfigurator.setDoAutomaticParsing(true);
|
67 |
|
|
specimenImportConfigurator.setReUseExistingMetadata(true);
|
68 |
|
|
specimenImportConfigurator.setAskForDate(true);
|
69 |
|
|
specimenImportConfigurator.setDefaultAuthor("L.");
|
70 |
|
|
specimenImportConfigurator.setClassificationName("Chenopodium");
|
71 |
|
|
|
72 |
|
|
specimenImportConfigurator.setReUseTaxon(true);
|
73 |
|
|
|
74 |
|
|
specimenImportConfigurator.setSourceReference(null);
|
75 |
|
|
specimenImportConfigurator.setTaxonReference(null);
|
76 |
|
|
|
77 |
|
|
// invoke import
|
78 |
|
|
CdmDefaultImport<SpecimenSynthesysExcelImportConfigurator> specimenImport = new CdmDefaultImport<SpecimenSynthesysExcelImportConfigurator>();
|
79 |
|
|
//new Test().invoke(tcsImportConfigurator);
|
80 |
|
|
specimenImport.invoke(specimenImportConfigurator);
|
81 |
|
|
System.out.println("End import from SpecimenData ("+ source.toString() + ")...");
|
82 |
|
|
} catch (URISyntaxException e) {
|
83 |
|
|
e.printStackTrace();
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
}
|
87 |
91138b6c
|
Andreas Müller
|
|
88 |
|
|
|
89 |
|
|
}
|