2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.app
.caryophyllales
;
12 import java
.io
.FileReader
;
13 import java
.io
.IOException
;
14 import java
.io
.InputStreamReader
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.app
.common
.CdmDestinations
;
19 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
20 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
21 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
22 import eu
.etaxonomy
.cdm
.io
.common
.CdmDefaultImport
;
23 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
.CHECK
;
24 import eu
.etaxonomy
.cdm
.io
.identifier
.IdentifierImportConfigurator
;
25 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTerm
;
26 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
33 public class NepenthesIdentifierActivator
{
35 @SuppressWarnings("unused")
36 private static final Logger logger
= Logger
.getLogger(NepenthesIdentifierActivator
.class);
38 //database validation status (create, update, validate ...)
39 static DbSchemaValidation dbSchemaValidation
= DbSchemaValidation
.VALIDATE
;
41 // static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
42 static final ICdmDataSource cdmDestination
= CdmDestinations
.cdm_production_caryophyllales_nepenthaceae();
45 static CHECK check
= CHECK
.IMPORT_WITHOUT_CHECK
;
47 private void doImport(ICdmDataSource cdmDestination
){
49 InputStreamReader source
= getNepenthesIdentifier();
50 IdentifierImportConfigurator config
= IdentifierImportConfigurator
.NewInstance(source
, cdmDestination
);
51 config
.setDbSchemaValidation(dbSchemaValidation
);
52 config
.setIdentifierTypeUuid(DefinedTerm
.uuidWfoNameIdentifier
);
53 config
.setCdmClass(TaxonName
.class);
54 config
.setCheck(check
);
56 CdmDefaultImport
<IdentifierImportConfigurator
> myImport
= new CdmDefaultImport
<>();
57 myImport
.invoke(config
);
61 private InputStreamReader
getNepenthesIdentifier() {
62 String filename
= "WfoIds.csv";
64 // URI.create("file:////BGBM-PESIHPC/FloraMalesianaXml/fmvol14_final2.xml")
65 String path
= "C://opt//data//Caryophyllales";
66 File file
= new File(path
+ CdmUtils
.getFolderSeperator() + filename
);
72 InputStreamReader input
= new FileReader(file
);
74 } catch (IOException e
) {
85 public static void main(String
[] args
) {
86 NepenthesIdentifierActivator me
= new NepenthesIdentifierActivator();
87 me
.doImport(cdmDestination
);