Project

General

Profile

Download (7.75 KB) Statistics
| Branch: | Tag: | Revision:
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.io.csv.redlist.out;
11

    
12
import java.io.ByteArrayOutputStream;
13
import java.io.File;
14
import java.util.ArrayList;
15
import java.util.HashSet;
16
import java.util.List;
17
import java.util.Set;
18
import java.util.UUID;
19

    
20
import org.apache.log4j.Logger;
21

    
22
import eu.etaxonomy.cdm.database.ICdmDataSource;
23
import eu.etaxonomy.cdm.io.common.XmlExportConfiguratorBase;
24
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
25
import eu.etaxonomy.cdm.model.description.Feature;
26
import eu.etaxonomy.cdm.model.location.NamedArea;
27

    
28

    
29
/**
30
 * @author a.oppermann
31
 * @created 17.10.2012
32
 */
33
public class CsvTaxExportConfiguratorRedlist extends XmlExportConfiguratorBase<CsvTaxExportStateRedlist> {
34
	@SuppressWarnings("unused")
35
	private static final Logger logger = Logger.getLogger(CsvTaxExportConfiguratorRedlist.class);
36

    
37
	private String encoding = "UTF-8";
38
	private String linesTerminatedBy = "\r\n";
39
	private String fieldsEnclosedBy = "\"";
40
	private boolean hasHeaderLines = true;
41
	private String fieldsTerminatedBy=",";
42
	private boolean doTaxa = true;
43
	private boolean doDistributions = false;
44
	private ByteArrayOutputStream baos;
45
	private boolean isUseIdWherePossible = false;
46
	private boolean includeBasionymsInResourceRelations;
47
	private boolean includeMisappliedNamesInResourceRelations;
48
	private String defaultBibliographicCitation = null;
49
	private List<UUID> featureExclusions = new ArrayList<UUID>();
50
	//filter on the classifications to be exported
51
	private Set<UUID> taxonNodeUuids = new HashSet<UUID>();   
52
	private boolean withHigherClassification = false;
53
	private String setSeparator = ";";
54

    
55
	private List<Feature> features;
56

    
57
	private String classificationTitleCache;
58

    
59
	private List<NamedArea> areas;
60

    
61
	//TODO
62
	private static IExportTransformer defaultTransformer = null;
63

    
64
	public static CsvTaxExportConfiguratorRedlist NewInstance(ICdmDataSource source, File destinationFolder) { 
65
		return new CsvTaxExportConfiguratorRedlist(source, destinationFolder);
66
	}
67

    
68
	@Override
69
	@SuppressWarnings("unchecked")
70
	protected void makeIoClassList() {
71
		ioClassList = new Class[] {
72
				CsvTaxExportRedlist.class
73
		};
74
	}
75

    
76
	/**
77
	 * @param url
78
	 * @param destination
79
	 */
80
	private CsvTaxExportConfiguratorRedlist(ICdmDataSource source, File destination) {
81
		super(destination, source, defaultTransformer);
82
	}
83

    
84
	/* (non-Javadoc)
85
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
86
	 */
87
	@Override
88
	public File getDestination() {
89
		return super.getDestination();
90
	}
91

    
92
	/**
93
	 * @param file
94
	 */
95
	@Override
96
	public void setDestination(File fileName) {
97
		super.setDestination(fileName);
98
	}
99

    
100
	/* (non-Javadoc)
101
	 * @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getDestinationNameString()
102
	 */
103
	@Override
104
	public String getDestinationNameString() {
105
		if (this.getDestination() == null) {
106
			return null;
107
		} else {
108
			return this.getDestination().toString();
109
		}
110
	}
111

    
112
	/* (non-Javadoc)
113
	 * @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
114
	 */
115
	public CsvTaxExportStateRedlist getNewState() {
116
		return new CsvTaxExportStateRedlist(this);
117
	}
118

    
119
	public boolean isDoTaxa() {
120
		return doTaxa;
121
	}
122

    
123
	public void setDoTaxa(boolean doTaxa) {
124
		this.doTaxa = doTaxa;
125
	}
126

    
127

    
128
	public boolean isDoDistributions() {
129
		return doDistributions;
130
	}
131

    
132
	public void setDoDistributions(boolean doDistributions) {
133
		this.doDistributions = doDistributions;
134
	}
135

    
136
	public void setFeatureExclusions(List<UUID> featureExclusions) {
137
		this.featureExclusions = featureExclusions;
138
	}
139

    
140
	public List<UUID> getFeatureExclusions() {
141
		return featureExclusions;
142
	}
143

    
144
	public String getEncoding() {
145
		return encoding;
146
	}
147

    
148
	public void setEncoding(String encoding) {
149
		this.encoding = encoding;
150
	}
151

    
152
	public String getLinesTerminatedBy() {
153
		return linesTerminatedBy;
154
	}
155

    
156
	public void setLinesTerminatedBy(String linesTerminatedBy) {
157
		this.linesTerminatedBy = linesTerminatedBy;
158
	}
159

    
160
	public String getFieldsEnclosedBy() {
161
		return fieldsEnclosedBy;
162
	}
163

    
164
	public void setFieldsEnclosedBy(String fieldsEnclosedBy) {
165
		this.fieldsEnclosedBy = fieldsEnclosedBy;
166
	}
167

    
168
	/**
169
	 * Equals darwin core archive ignoreHeaderLines attribute
170
	 * @return
171
	 */
172
	public boolean isHasHeaderLines() {
173
		return hasHeaderLines;
174
	}
175

    
176
	public void setHasHeaderLines(boolean hasHeaderLines) {
177
		this.hasHeaderLines = hasHeaderLines;
178
	}
179

    
180
	public boolean isIncludeBasionymsInResourceRelations() {
181
		return includeBasionymsInResourceRelations;
182
	}
183

    
184
	public void setIncludeBasionymsInResourceRelations(boolean includeBasionymsInResourceRelations) {
185
		this.includeBasionymsInResourceRelations = includeBasionymsInResourceRelations;
186
	}
187

    
188
	public boolean isIncludeMisappliedNamesInResourceRelations() {
189
		return includeMisappliedNamesInResourceRelations;
190
	}
191

    
192
	public void setIncludeMisappliedNamesInResourceRelations(boolean includeMisappliedNamesInResourceRelations) {
193
		this.includeMisappliedNamesInResourceRelations = includeMisappliedNamesInResourceRelations;
194
	}
195

    
196
	public boolean isUseIdWherePossible() {
197
		return this.isUseIdWherePossible;
198
	}
199

    
200
	public void setUseIdWherePossible(boolean isUseIdWherePossible) {
201
		this.isUseIdWherePossible = isUseIdWherePossible;
202
	}
203

    
204
	public void setDefaultBibliographicCitation(String defaultBibliographicCitation) {
205
		this.defaultBibliographicCitation = defaultBibliographicCitation;
206
	}
207

    
208

    
209
	public String getDefaultBibliographicCitation() {
210
		return defaultBibliographicCitation;
211
	}
212

    
213
	/**
214
	 * The default value for the taxon.source column. This may be a column linking to a url that provides 
215
	 * data about the given taxon. The id is replaced by a placeholder, 
216
	 * e.g. http://wp6-cichorieae.e-taxonomy.eu/portal/?q=cdm_dataportal/taxon/{id}.
217
	 * NOTE: This may be replaced in future versions by concrete CDM server implementations.
218
	 * 
219
	 * @return the taxonSourceDefault
220
	 */
221

    
222
	public boolean isWithHigherClassification() {
223
		return withHigherClassification;
224
	}
225

    
226
	public void setWithHigherClassification(boolean withHigherClassification) {
227
		this.withHigherClassification = withHigherClassification;
228
	}
229

    
230
	/**
231
	 * @return the setSeparator
232
	 */
233
	public String getSetSeparator() {
234
		return setSeparator;
235
	}
236

    
237
	/**
238
	 * @param setSeparator the setSeparator to set
239
	 */
240
	public void setSetSeparator(String setSeparator) {
241
		this.setSeparator = setSeparator;
242
	}
243

    
244
	public void setFieldsTerminatedBy(String fieldsTerminatedBy) {
245
		this.fieldsTerminatedBy = fieldsTerminatedBy;
246
	}
247

    
248
	public String getFieldsTerminatedBy() {
249
		return fieldsTerminatedBy;
250
	}
251

    
252
	public Set<UUID> getTaxonNodeUuids() {
253
		return taxonNodeUuids;
254
	}
255

    
256
	public void setTaxonNodeUuids(Set<UUID> taxonNodeUuids) {
257
		this.taxonNodeUuids = taxonNodeUuids;
258
	}
259

    
260
	public ByteArrayOutputStream getByteArrayOutputStream() {
261
		return baos;
262
	}
263

    
264
	public void setByteArrayOutputStream(ByteArrayOutputStream baos) {
265
		this.baos = baos;
266
	}
267

    
268
	public void setFeatures(List<Feature> features) {
269
		this.features = features;
270
		
271
	}
272
	
273
	public List<Feature>  getFeatures() {
274
		return features;
275
		
276
	}
277

    
278
	public void setClassificationTitleCache(String classificationTitleCache) {
279
		this.classificationTitleCache = classificationTitleCache;
280
	}
281
	
282
	public String getClassificationTitleCache() {
283
		return classificationTitleCache;
284
	}
285

    
286
	/**
287
	 * @param areas
288
	 */
289
	public void setNamedAreas(List<NamedArea> areas) {
290
		// TODO Auto-generated method stub
291
		this.areas = areas;
292
		
293
	}
294
	public List<NamedArea> getNamedAreas(){
295
		return areas;
296
	}
297
	
298
}
(5-5/10)