Project

General

Profile

« Previous | Next » 

Revision 0c9afb80

Added by Andreas Müller over 12 years ago

NormalExplicitActivator update

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/common/CdmDestinations.java
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_productioin_palmae"; 
40
		String cdmDB = "cdm_production_palmae"; 
41
		String cdmUserName = "edit";
42
		return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
43
	}
44
	
45

  
46
	public static ICdmDataSource cdm_test_useSummary(){
47
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
48
		String cdmServer = "localhost";
49
		String cdmDB = "palmae_2011_07_17"; 
41 50
		String cdmUserName = "edit";
42 51
		return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
43 52
	}
app-import/src/main/java/eu/etaxonomy/cdm/app/excelImport/taxa/NormalExplicitActivator.java
15 15
import org.apache.log4j.Logger;
16 16

  
17 17
import eu.etaxonomy.cdm.app.common.CdmDestinations;
18
import eu.etaxonomy.cdm.database.DbSchemaValidation;
18 19
import eu.etaxonomy.cdm.database.ICdmDataSource;
19 20
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
20 21
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
......
26 27
 *
27 28
 */
28 29
public class NormalExplicitActivator {
29

  
30
	private static final String dbName = "cdm_test_jaxb";
30
	private static final Logger logger = Logger.getLogger(NormalExplicitActivator.class);
31
    
31 32
	private static String fileName = 
32 33
		new String("D:\\_Tagungen\\2010-09 TDWG 2010\\Workshop\\data\\NormalExplicit.xls");
33 34
	
35
	private static DbSchemaValidation dbSchemaValidation = DbSchemaValidation.CREATE;
36
	
34 37
	private static final ICdmDataSource destinationDb = CdmDestinations.cdm_test_jaxb();
35
    private static final Logger logger = Logger.getLogger(NormalExplicitActivator.class);
36 38
    
37 39
    public static void main(String[] args) {
38 40

  
......
41 43
		try {
42 44
			uri = new URI(fileName);
43 45
			NormalExplicitImportConfigurator normalExplicitImportConfigurator = 
44
	    		NormalExplicitImportConfigurator.NewInstance(uri, destinationDb, code);
46
	    		NormalExplicitImportConfigurator.NewInstance(uri, destinationDb, code,dbSchemaValidation);
45 47
	
46 48
			CdmDefaultImport<NormalExplicitImportConfigurator> normalExplicitImport = 
47 49
				new CdmDefaultImport<NormalExplicitImportConfigurator>();
app-import/src/main/java/eu/etaxonomy/cdm/app/excelImport/taxa/UseSummaryActivator.java
9 9

  
10 10
package eu.etaxonomy.cdm.app.excelImport.taxa;
11 11

  
12
import java.io.File;
12 13
import java.net.URI;
13 14
import java.net.URISyntaxException;
14 15

  
15 16
import org.apache.log4j.Logger;
16 17

  
17 18
import eu.etaxonomy.cdm.app.common.CdmDestinations;
19
import eu.etaxonomy.cdm.database.DbSchemaValidation;
18 20
import eu.etaxonomy.cdm.database.ICdmDataSource;
19 21
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
20 22
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
......
30 32
public class UseSummaryActivator {
31 33
	private static final Logger logger = Logger.getLogger(UseSummaryActivator.class);
32 34
    
33
	private static String fileName = new String("C:\\temp\\NormalExplicit.xls");
34
	
35
	private static final ICdmDataSource destinationDb = CdmDestinations.cdm_test_alex();
35
	private static String fileName = new String("C:\\tmp\\temp\\UseSummary.xls");
36
	private static DbSchemaValidation dbSchemaValidation = DbSchemaValidation.CREATE;
37

  
38
	private static final ICdmDataSource destinationDb = CdmDestinations.cdm_test_useSummary();
36 39
    
37 40
    public static void main(String[] args) {
38 41

  
39 42
    	NomenclaturalCode code = NomenclaturalCode.ICBN;
40 43
    	URI uri;
41
		try {
42
			uri = new URI(fileName);
44
//		try {
45
			File file = new File(fileName);
46
			uri = file.toURI();
47
//			uri = new URI(fileName);
43 48
			NormalExplicitImportConfigurator normalExplicitImportConfigurator = 
44
	    		NormalExplicitImportConfigurator.NewInstance(uri, destinationDb, code);
49
	    		NormalExplicitImportConfigurator.NewInstance(uri, destinationDb, code, dbSchemaValidation);
45 50
	
46 51
			CdmDefaultImport<NormalExplicitImportConfigurator> normalExplicitImport = 
47 52
				new CdmDefaultImport<NormalExplicitImportConfigurator>();
......
49 54
			// invoke import
50 55
			logger.debug("Invoking Normal Explicit Excel import");
51 56
			normalExplicitImport.invoke(normalExplicitImportConfigurator);
52
		} catch (URISyntaxException e) {
53
			e.printStackTrace();
54
		}
57
//		} catch (URISyntaxException e) {
58
//			e.printStackTrace();
59
//		}
55 60
    	    	
56 61
    }
57 62
}
app-import/src/main/java/eu/etaxonomy/cdm/app/exel/NormalExplicitTestActivator.java
59 59

  
60 60
	
61 61
	public void doImport(ICdmDataSource destination, DbSchemaValidation hbm2dll){
62
		System.out.println("Start import from Tcs("+ mySource.toString() + ") ...");
62
		System.out.println("Start import from Excel("+ mySource.toString() + ") ...");
63 63
		
64
		NormalExplicitImportConfigurator config = NormalExplicitImportConfigurator.NewInstance(mySource,  destination, NomenclaturalCode.ICBN);
64
		NormalExplicitImportConfigurator config = NormalExplicitImportConfigurator.NewInstance(mySource,  destination, NomenclaturalCode.ICBN, null);
65 65
		
66 66
		config.setClassificationUuid(treeUuid);
67 67
		config.setSourceSecId(sourceSecId);

Also available in: Unified diff