Project

General

Profile

« Previous | Next » 

Revision cb2b05d0

Added by Andreas Müller over 13 years ago

renamed DwcaExport -> DwcaExportActivator

View differences:

.gitattributes
25 25
app-import/src/main/java/eu/etaxonomy/cdm/app/common/ImportUtils.java -text
26 26
app-import/src/main/java/eu/etaxonomy/cdm/app/common/TestActivator.java -text
27 27
app-import/src/main/java/eu/etaxonomy/cdm/app/cyprus/CyprusActivator.java -text
28
app-import/src/main/java/eu/etaxonomy/cdm/app/dwca/DwcaExportActivator.java -text
28 29
app-import/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaChecklistActivator.java -text
29 30
app-import/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaEricaceaeActivator.java -text
30 31
app-import/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaFernsActivator.java -text
app-import/src/main/java/eu/etaxonomy/cdm/app/dwca/DwcaExportActivator.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.dwca;
11

  
12
import org.apache.log4j.Logger;
13

  
14
import eu.etaxonomy.cdm.app.common.CdmDestinations;
15
import eu.etaxonomy.cdm.common.DefaultProgressMonitor;
16
import eu.etaxonomy.cdm.common.IProgressMonitor;
17
import eu.etaxonomy.cdm.database.ICdmDataSource;
18
import eu.etaxonomy.cdm.database.update.CdmUpdater;
19
import eu.etaxonomy.cdm.io.common.CdmDefaultExport;
20
import eu.etaxonomy.cdm.io.common.IExportConfigurator.CHECK;
21
import eu.etaxonomy.cdm.io.common.IExportConfigurator.DO_REFERENCES;
22
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
23
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
24

  
25

  
26
/**
27
 *
28
 * @author a.mueller
29
 *
30
 */
31
public class DwcaExportActivator {
32
	@SuppressWarnings("unused")
33
	private static final Logger logger = Logger.getLogger(DwcaExportActivator.class);
34

  
35
	//database validation status (create, update, validate ...)
36
	private static final String fileDestination = "C:\\tmp\\dwcaTmp";
37
	private static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql();
38
	
39
	//check - import
40
	private static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;
41

  
42
	//NomeclaturalCode
43
	private static final NomenclaturalCode nomenclaturalCode  = NomenclaturalCode.ICBN;
44

  
45
// ****************** ALL *****************************************
46
	
47
	//authors
48
	static final boolean doAuthors = true;
49
	//references
50
	static final DO_REFERENCES doReferences =  DO_REFERENCES.ALL;
51
	//names
52
	static final boolean doTaxonNames = true;
53
	static final boolean doRelNames = true;
54
	static final boolean doTypes = false;  //Types do not exist in El_Salvador DB
55
	static final boolean doNameFacts = false;  //Name Facts do not exist in El_Salvador DB
56
	
57
	//taxa
58
	static final boolean doTaxa = true;
59
	static final boolean doRelTaxa = true;
60
	static final boolean doFacts = true;
61
	static final boolean doOccurences = false; //occurrences do not exist in Salvador
62

  
63
// ************************ NONE **************************************** //
64
	
65
//	//authors
66
//	static final boolean doAuthors = false;
67
//	static final boolean doAuthorTeams = false;
68
//	//references
69
//	static final DO_REFERENCES doReferences =  DO_REFERENCES.ALL;
70
//	//names
71
//	static final boolean doTaxonNames = true;
72
//	static final boolean doTypes = false;
73
//	static final boolean doNameFacts = false;
74
//	
75
//	//taxa
76
//	static final boolean doTaxa = false;
77
//	static final boolean doRelTaxa = false;
78
//	static final boolean doFacts = false;
79
//	static final boolean doOccurences = false;
80
//	
81
	
82
	public boolean 	doExport(ICdmDataSource source){
83
		System.out.println("Start export to DWC-A ("+ fileDestination + ") ...");
84
		
85
//		CdmUpdater su = CdmUpdater.NewInstance();
86
//		IProgressMonitor monitor = DefaultProgressMonitor.NewInstance();
87
//		
88
//		try {
89
//			su.updateToCurrentVersion(source, monitor);
90
//		} catch (Exception e) {
91
//			e.printStackTrace();
92
//		}
93
//		if (true){
94
//			return true;
95
//		}
96
		
97
		//make file destination
98
		String destination = fileDestination;
99
		
100
		DwcaTaxExportConfigurator config = DwcaTaxExportConfigurator.NewInstance(source, destination);
101
		
102
//		config.setDoAuthors.setSecUuid(secUuid);
103
//		config.setDoAuthors(sourceSecId);
104
//		config.setDoAuthors.setNomenclaturalCode(nomenclaturalCode);
105

  
106
//		config.setDoAuthors(doAuthors);
107
//		config.setDoReferences(doReferences);
108
//		config.setDoTaxonNames(doTaxonNames);
109
//		config.setDoRelNames(doRelNames);
110
//		config.setDoNameFacts(doNameFacts);
111
//		
112
//		config.setDoTaxa(doTaxa);
113
//		config.setDoRelTaxa(doRelTaxa);
114
//		config.setDoFacts(doFacts);
115
//		config.setDoOccurrence(doOccurences);
116
		config.setCheck(check);
117
		
118
		// invoke import
119
		CdmDefaultExport<DwcaTaxExportConfigurator> bmExport = new CdmDefaultExport<DwcaTaxExportConfigurator>();
120
		boolean result = bmExport.invoke(config);
121
		
122
		System.out.println("End export to DWC-A ("+ fileDestination + ")..." + (result? "(successful)":"(with errors)"));
123
		return result;
124
	}
125

  
126
	
127
	
128
	/**
129
	 * @param args
130
	 */
131
	public static void main(String[] args) {
132
		DwcaExportActivator ex = new DwcaExportActivator();
133
		ICdmDataSource source = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmSource;
134

  
135
		ex.doExport(source);
136
	}
137
	
138
	
139
	
140

  
141
}

Also available in: Unified diff