Project

General

Profile

« Previous | Next » 

Revision 36fcc0ac

Added by Andreas Müller almost 13 years ago

cyprus specimen

View differences:

.gitattributes
27 27
app-import/src/main/java/eu/etaxonomy/cdm/app/common/ImportUtils.java -text
28 28
app-import/src/main/java/eu/etaxonomy/cdm/app/common/TestActivator.java -text
29 29
app-import/src/main/java/eu/etaxonomy/cdm/app/cyprus/CyprusActivator.java -text
30
app-import/src/main/java/eu/etaxonomy/cdm/app/cyprus/CyprusSpecimenActivator.java -text
30 31
app-import/src/main/java/eu/etaxonomy/cdm/app/dwca/DwcaExportActivator.java -text
31 32
app-import/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaChecklistActivator.java -text
32 33
app-import/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaEricaceaeActivator.java -text
app-import/src/main/java/eu/etaxonomy/cdm/app/cyprus/CyprusActivator.java
15 15

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

  
18
import eu.etaxonomy.cdm.api.application.CdmApplicationController;
19 18
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
20 19
import eu.etaxonomy.cdm.api.service.ITermService;
21 20
import eu.etaxonomy.cdm.app.common.CdmDestinations;
......
48 47
	static final URI source = cyprus_local();
49 48

  
50 49
	
51
//	static final ICdmDataBSource cdmDestination = CdmDestinations.localH2();
50
	static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
52 51
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest();
53
	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
52
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
54 53
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_cyprus_dev();
55 54
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_cyprus_production();
56 55

  
......
65 64
	static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
66 65
	
67 66
	//taxa
68
	static final boolean doTaxa = false;
67
	static final boolean doTaxa = true;
69 68
	static final boolean doDeduplicate = false;
70
	static final boolean doDistribution = true;
69
	static final boolean doDistribution = false;
71 70

  
72 71
	
73 72
	private void doImport(ICdmDataSource cdmDestination){
app-import/src/main/java/eu/etaxonomy/cdm/app/cyprus/CyprusSpecimenActivator.java
1
/**
2
* Copyright (C) 2007 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
*/
9

  
10
package eu.etaxonomy.cdm.app.cyprus;
11

  
12
import java.net.URI;
13
import java.net.URISyntaxException;
14
import java.util.UUID;
15

  
16
import org.apache.log4j.Logger;
17

  
18
import eu.etaxonomy.cdm.api.application.CdmApplicationController;
19
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
20
import eu.etaxonomy.cdm.api.service.ITermService;
21
import eu.etaxonomy.cdm.app.common.CdmDestinations;
22
import eu.etaxonomy.cdm.database.DbSchemaValidation;
23
import eu.etaxonomy.cdm.database.ICdmDataSource;
24
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
25
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
26
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
27
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
28
import eu.etaxonomy.cdm.io.cyprus.CyprusImportConfigurator;
29
import eu.etaxonomy.cdm.io.cyprus.CyprusTransformer;
30
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
31
import eu.etaxonomy.cdm.model.agent.Person;
32
import eu.etaxonomy.cdm.model.description.Feature;
33
import eu.etaxonomy.cdm.model.description.FeatureNode;
34
import eu.etaxonomy.cdm.model.description.FeatureTree;
35
import eu.etaxonomy.cdm.model.reference.Reference;
36
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
37

  
38
/**
39
 * @author a.mueller
40
 * @created 16.12.2010
41
 * @version 1.0
42
 */
43
public class CyprusSpecimenActivator {
44
	private static final Logger logger = Logger.getLogger(CyprusSpecimenActivator.class);
45
	
46
	//database validation status (create, update, validate ...)
47
	static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
48
	static final URI source = cyprus_specimen_local();
49

  
50
	
51
//	static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
52
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
53
	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_cyprus_dev();
54
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_cyprus_production();
55

  
56
	
57
	//check - import
58
	static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
59
	
60
	//taxa
61
//	static final boolean doTaxa = false;
62
//	static final boolean doDeduplicate = false;
63
//	static final boolean doDistribution = true;
64

  
65
	
66
	private void doImport(ICdmDataSource cdmDestination){
67
		
68
		//make Source
69
		SpecimenCdmExcelImportConfigurator config= SpecimenCdmExcelImportConfigurator.NewInstance(source, cdmDestination);
70
		config.setCheck(check);
71
		config.setDbSchemaValidation(hbm2dll);
72
		
73
		CdmDefaultImport myImport = new CdmDefaultImport();
74

  
75
		
76
		//...
77
		if (true){
78
			System.out.println("Start import from ("+ source.toString() + ") ...");
79
			config.setSourceReference(getSourceReference(config.getSourceReferenceTitle()));
80
			myImport.invoke(config);
81

  
82
			System.out.println("End import from ("+ source.toString() + ")...");
83
		}
84
		
85
	}
86

  
87
	private Reference<?> getSourceReference(String string) {
88
		Reference<?> result = ReferenceFactory.newGeneric();
89
		result.setTitleCache(string);
90
		return result;
91
	}
92
	
93
	//Cyprus
94
	public static URI cyprus_specimen_local() {
95
		URI sourceUrl;
96
		try {
97
			sourceUrl = new URI("file:/C:/localCopy/Data/zypern/Cyprus-specimens-import02_AM.xls");
98
			return sourceUrl;
99
		} catch (URISyntaxException e) {
100
			e.printStackTrace();
101
			return null;
102
		}
103
	}
104

  
105
	
106

  
107
	/**
108
	 * @param args
109
	 */
110
	public static void main(String[] args) {
111
		CyprusSpecimenActivator me = new CyprusSpecimenActivator();
112
		me.doImport(cdmDestination);
113
	}
114
	
115
}

Also available in: Unified diff