Project

General

Profile

« Previous | Next » 

Revision ff03e8df

Added by Andreas Müller about 13 years ago

dwca bugfix for new signature

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/dwca/DwcaExportActivator.java
9 9

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

  
12
import java.io.File;
13
import java.net.URI;
12 14
import java.util.Arrays;
13
import java.util.HashSet;
14 15
import java.util.List;
15
import java.util.Set;
16 16
import java.util.UUID;
17 17

  
18 18
import org.apache.log4j.Logger;
19
import org.joda.time.DateTime;
19 20

  
20 21
import eu.etaxonomy.cdm.app.common.CdmDestinations;
21 22
import eu.etaxonomy.cdm.database.ICdmDataSource;
22 23
import eu.etaxonomy.cdm.io.common.CdmDefaultExport;
23 24
import eu.etaxonomy.cdm.io.common.IExportConfigurator.CHECK;
25
import eu.etaxonomy.cdm.io.dwca.out.DwcaEmlRecord;
24 26
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
27
import eu.etaxonomy.cdm.model.agent.Institution;
28
import eu.etaxonomy.cdm.model.agent.InstitutionalMembership;
29
import eu.etaxonomy.cdm.model.agent.Person;
25 30

  
26 31

  
27 32
/**
......
34 39
	private static final Logger logger = Logger.getLogger(DwcaExportActivator.class);
35 40

  
36 41
	//database validation status (create, update, validate ...)
37
	private static final String fileDestination = "C:\\tmp\\dwcaTmp";
38
//	private static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql();
39
	private static final ICdmDataSource cdmSource = CdmDestinations.cdm_production_cichorieae();
42
	private static final String fileDestination = "C:\\tmp\\dwcaTmp\\";
43
	private static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql();
44
//	private static final ICdmDataSource cdmSource = CdmDestinations.cdm_production_cichorieae();
40 45
	
41 46
	//check - import
42 47
	private static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;
......
49 54
	
50 55
	
51 56
// ****************** ALL *****************************************
52
//	private boolean doTaxa = false;
53
//	private boolean doResourceRelation = true;
54
//	private boolean doTypesAndSpecimen = true;
55
//	private boolean doVernacularNames = true;
56
//	private boolean doReferences = true;
57
//	private boolean doDescription = true;
58
//	private boolean doDistributions = true;
59
//	private boolean doImages = true;
60

  
61

  
62
// ************************ NONE **************************************** //
63
	private boolean doTaxa = false;
64
	private boolean doResourceRelation = false;
65
	private boolean doTypesAndSpecimen = false;
66
	private boolean doVernacularNames = false;
67
	private boolean doReferences = false;
57
	
58
	private boolean doTaxa = true;
59
	private boolean doResourceRelation = true;
60
	private boolean doTypesAndSpecimen = true;
61
	private boolean doVernacularNames = true;
62
	private boolean doReferences = true;
68 63
	private boolean doDescription = true;
69
	private boolean doDistributions = false;
70
	private boolean doImages = false;
64
	private boolean doDistributions = true;
65
	private boolean doImages = true;
66
	private boolean doMetaData = true;
67
	private boolean doEml = true;
71 68

  
69
// ************************ NONE **************************************** //
70
	
71
//	private boolean doTaxa = false;
72
//	private boolean doResourceRelation = false;
73
//	private boolean doTypesAndSpecimen = false;
74
//	private boolean doVernacularNames = false;
75
//	private boolean doReferences = false;
76
//	private boolean doDescription = false;
77
//	private boolean doDistributions = false;
78
//	private boolean doImages = false;
79
//	private boolean doMetaData = false;
80
//	private boolean doEml = false;
72 81
	
73 82
	public boolean 	doExport(ICdmDataSource source){
74 83
		System.out.println("Start export to DWC-A ("+ fileDestination + ") ...");
......
87 96
		
88 97
		//make file destination
89 98
		String destination = fileDestination;
99
		DwcaEmlRecord emlRecord = getEmlRecord();
90 100
		
91
		DwcaTaxExportConfigurator config = DwcaTaxExportConfigurator.NewInstance(source, destination);
101
		DwcaTaxExportConfigurator config = DwcaTaxExportConfigurator.NewInstance(source, new File(destination), emlRecord);
92 102
		
93 103
		config.setDoTaxa(doTaxa);
94 104
		config.setDoResourceRelation(doResourceRelation);
......
98 108
		config.setDoDescription(doDescription);
99 109
		config.setDoDistributions(doDistributions);
100 110
		config.setDoImages(doImages);
111
		config.setDoMetaData(doMetaData);
112
		config.setDoEml(doEml);
101 113
		config.setCheck(check);
102 114
		
103 115
		config.setFeatureExclusions(featureExclusions);
......
110 122
	}
111 123

  
112 124

  
125
	private DwcaEmlRecord getEmlRecord() {
126
		DwcaEmlRecord emlRecord = new DwcaEmlRecord();
127
		emlRecord.setIdentifier("My Identifier");
128
		emlRecord.setTitle("Cich DB");
129
		emlRecord.setPublicationDate(new DateTime());
130
		emlRecord.setExpectedCitation("Expected Citation");
131
		emlRecord.setAbstractInfo("The abstract");
132
		emlRecord.setAdditionalInformation("Add info");
133
		emlRecord.setResourceLanguage(null);
134
		emlRecord.setResourceUrl(URI.create("http://wp6-cichorieae.e-taxonomy.eu/portal/"));
135
		emlRecord.setMetaDataLanguage(null);
136
		emlRecord.setResourceLogoUri(null);
137
		emlRecord.setCreativeCommonsLicensing(null);
138
		emlRecord.setProjectTitle("Projekt tit");
139
		emlRecord.setProjectLead("Proj Lead");
140
		emlRecord.setProjectDescription("Proj Desc");
141
		
142
		Person person = Person.NewInstance();
143
		Institution institution = Institution.NewInstance();
144
		
145
		InstitutionalMembership m = person.addInstitutionalMembership(institution, null, null, null);
146
		emlRecord.setResourceCreator(m);
147
		
148
		return emlRecord;
149
	}
150

  
151

  
113 152
	/**
114 153
	 * @param args
115 154
	 */

Also available in: Unified diff