Revision 0a7c1eec
Added by Patrick Plitzner almost 7 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/out/CsvExportBaseRedlist.java | ||
---|---|---|
16 | 16 |
import java.io.OutputStreamWriter; |
17 | 17 |
import java.io.PrintWriter; |
18 | 18 |
import java.io.UnsupportedEncodingException; |
19 |
import java.util.ArrayList; |
|
20 | 19 |
import java.util.HashSet; |
21 | 20 |
import java.util.List; |
22 | 21 |
import java.util.Set; |
... | ... | |
33 | 32 |
import eu.etaxonomy.cdm.io.common.CdmExportBase; |
34 | 33 |
import eu.etaxonomy.cdm.io.common.ICdmExport; |
35 | 34 |
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer; |
36 |
import eu.etaxonomy.cdm.io.csv.redlist.out.CsvTaxExportConfiguratorRedlist; |
|
37 |
import eu.etaxonomy.cdm.io.csv.redlist.out.CsvTaxExportStateRedlist; |
|
38 | 35 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
39 | 36 |
import eu.etaxonomy.cdm.model.common.IOriginalSource; |
40 | 37 |
import eu.etaxonomy.cdm.model.common.ISourceable; |
41 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
|
42 | 38 |
import eu.etaxonomy.cdm.model.location.Country; |
43 |
import eu.etaxonomy.cdm.model.taxon.Classification;
|
|
39 |
import eu.etaxonomy.cdm.model.location.NamedArea;
|
|
44 | 40 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
45 | 41 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
46 | 42 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
... | ... | |
73 | 69 |
|
74 | 70 |
|
75 | 71 |
/** |
76 |
* Returns the list of {@link TaxonNode taxon nodes} that are part in one of the given {@link Classification classifications} |
|
77 |
* and do have a {@link Taxon} attached (empty taxon nodes should not but do exist in CDM databases). |
|
78 |
* If <code>classificationList</code> is <code>null</code> or empty then all {@link TaxonNode taxon nodes} of all |
|
79 |
* {@link Classification classifications} are returned.<BR> |
|
80 |
* Preliminary implementation. Better implement API method for this. |
|
72 |
* Returns all children of the given taxon node and the node itself if the node has |
|
73 |
* a {@link Taxon} attached (empty taxon nodes should not but do exist in CDM databases). |
|
81 | 74 |
* @return |
82 | 75 |
*/ |
83 |
protected List<TaxonNode> getAllNodes(Set<Classification> classificationList) {
|
|
76 |
protected Set<TaxonNode> getAllNodes(Set<TaxonNode> taxonNodes) {
|
|
84 | 77 |
//handle empty list as no filter defined |
85 |
if (classificationList != null && classificationList.isEmpty()){
|
|
86 |
classificationList = null;
|
|
78 |
if (taxonNodes != null && taxonNodes.isEmpty()){
|
|
79 |
taxonNodes = null;
|
|
87 | 80 |
} |
88 | 81 |
|
89 | 82 |
List<TaxonNode> allNodes = getClassificationService().getAllNodes(); |
90 |
List<TaxonNode> result = new ArrayList<TaxonNode>();
|
|
83 |
Set<TaxonNode> result = new HashSet<TaxonNode>();
|
|
91 | 84 |
for (TaxonNode node : allNodes){ |
92 | 85 |
if (node.getClassification() == null ){ |
93 | 86 |
continue; |
94 |
}else if (classificationList != null && ! classificationList.contains(node.getClassification())){
|
|
87 |
}else if (taxonNodes != null && ! taxonNodes.contains(node.getClassification())){
|
|
95 | 88 |
continue; |
96 | 89 |
}else{ |
97 | 90 |
Taxon taxon = CdmBase.deproxy(node.getTaxon(), Taxon.class); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/out/CsvTaxExportConfiguratorRedlist.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.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> classificationUuids = 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 classificationUuids; |
|
254 |
} |
|
255 |
|
|
256 |
public void setTaxonNodeUuids(Set<UUID> classificationUuids) { |
|
257 |
this.classificationUuids = classificationUuids; |
|
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 |
|
|
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> classificationUuids = 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 classificationUuids;
|
|
254 |
}
|
|
255 |
|
|
256 |
public void setTaxonNodeUuids(Set<UUID> classificationUuids) {
|
|
257 |
this.classificationUuids = classificationUuids;
|
|
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 | 298 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/out/CsvTaxExportRedlist.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.io.csv.redlist.out; |
|
11 |
|
|
12 |
import java.io.ByteArrayOutputStream; |
|
13 |
import java.io.PrintWriter; |
|
14 |
import java.util.ArrayList; |
|
15 |
import java.util.Collections; |
|
16 |
import java.util.Comparator; |
|
17 |
import java.util.HashSet; |
|
18 |
import java.util.List; |
|
19 |
import java.util.Set; |
|
20 |
import java.util.UUID; |
|
21 |
|
|
22 |
import org.apache.log4j.Logger; |
|
23 |
import org.springframework.stereotype.Component; |
|
24 |
import org.springframework.transaction.TransactionStatus; |
|
25 |
|
|
26 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
27 |
import eu.etaxonomy.cdm.model.common.Language; |
|
28 |
import eu.etaxonomy.cdm.model.common.RelationshipTermBase; |
|
29 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
|
30 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
31 |
import eu.etaxonomy.cdm.model.description.Distribution; |
|
32 |
import eu.etaxonomy.cdm.model.description.Feature; |
|
33 |
import eu.etaxonomy.cdm.model.description.State; |
|
34 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
35 |
import eu.etaxonomy.cdm.model.description.TextData; |
|
36 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
|
37 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
38 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
39 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
40 |
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship; |
|
41 |
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType; |
|
42 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
43 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
44 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
45 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
46 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
47 |
|
|
48 |
|
|
49 |
/** |
|
50 |
* @author a.oppermann |
|
51 |
* @created 18.10.2012 |
|
52 |
*/ |
|
53 |
|
|
54 |
@Component |
|
55 |
public class CsvTaxExportRedlist extends CsvExportBaseRedlist { |
|
56 |
private static final Logger logger = Logger.getLogger(CsvTaxExportRedlist.class); |
|
57 |
|
|
58 |
private static final String ROW_TYPE = "http://rs.tdwg.org/dwc/terms/Taxon"; |
|
59 |
private static final String fileName = "RedlistCoreTax.csv"; |
|
60 |
|
|
61 |
public CsvTaxExportRedlist() { |
|
62 |
super(); |
|
63 |
this.ioName = this.getClass().getSimpleName(); |
|
64 |
} |
|
65 |
|
|
66 |
|
|
67 |
/** Retrieves data from a CDM DB and serializes them CDM to CSV. |
|
68 |
* Starts with root taxa and traverses the classification to retrieve |
|
69 |
* children taxa, synonyms, relationships, descriptive data, red list |
|
70 |
* status (features). |
|
71 |
* Taxa that are not part of the classification are not found. |
|
72 |
* |
|
73 |
* @param exImpConfig |
|
74 |
* @param dbname |
|
75 |
* @param filename |
|
76 |
*/ |
|
77 |
@Override |
|
78 |
protected void doInvoke(CsvTaxExportStateRedlist state){ |
|
79 |
CsvTaxExportConfiguratorRedlist config = state.getConfig(); |
|
80 |
TransactionStatus txStatus = startTransaction(true); |
|
81 |
List<NamedArea> selectedAreas = config.getNamedAreas(); |
|
82 |
Set<Classification> classificationSet = assembleClassificationSet(config); |
|
83 |
|
|
84 |
PrintWriter writer = null; |
|
85 |
ByteArrayOutputStream byteArrayOutputStream; |
|
86 |
try { |
|
87 |
byteArrayOutputStream = config.getByteArrayOutputStream(); |
|
88 |
writer = new PrintWriter(byteArrayOutputStream); |
|
89 |
//geographical Filter |
|
90 |
List<TaxonNode> filteredNodes = handleGeographicalFilter(selectedAreas, classificationSet); |
|
91 |
|
|
92 |
//sorting List |
|
93 |
Collections.sort(filteredNodes, new Comparator<TaxonNode>() { |
|
94 |
|
|
95 |
@Override |
|
96 |
public int compare(TaxonNode tn1, TaxonNode tn2) { |
|
97 |
Taxon taxon1 = tn1.getTaxon(); |
|
98 |
Taxon taxon2 = tn2.getTaxon(); |
|
99 |
if(taxon1 != null && taxon2 != null){ |
|
100 |
return taxon1.getTitleCache().compareTo(taxon2.getTitleCache()); |
|
101 |
} |
|
102 |
else{ |
|
103 |
return 0; |
|
104 |
} |
|
105 |
} |
|
106 |
}); |
|
107 |
for (TaxonNode node : filteredNodes){ |
|
108 |
Taxon taxon = CdmBase.deproxy(node.getTaxon(), Taxon.class); |
|
109 |
CsvTaxRecordRedlist record = assembleRecord(state); |
|
110 |
NonViralName<?> name = CdmBase.deproxy(taxon.getName(), NonViralName.class); |
|
111 |
Classification classification = node.getClassification(); |
|
112 |
config.setClassificationTitleCache(classification.getTitleCache()); |
|
113 |
if (! this.recordExists(taxon)){ |
|
114 |
handleTaxonBase(record, taxon, name, taxon, classification, null, false, false, config); |
|
115 |
record.write(writer); |
|
116 |
this.addExistingRecord(taxon); |
|
117 |
} |
|
118 |
//misapplied names |
|
119 |
handleMisapplication(taxon, writer, classification, record, config); |
|
120 |
writer.flush(); |
|
121 |
} |
|
122 |
} catch (ClassCastException e) { |
|
123 |
e.printStackTrace(); |
|
124 |
} |
|
125 |
finally{ |
|
126 |
writer.close(); |
|
127 |
this.clearExistingRecordIds(); |
|
128 |
} |
|
129 |
commitTransaction(txStatus); |
|
130 |
return; |
|
131 |
|
|
132 |
} |
|
133 |
|
|
134 |
|
|
135 |
//TODO: Exception handling |
|
136 |
protected Set<Classification> assembleClassificationSet(CsvTaxExportConfiguratorRedlist config){ |
|
137 |
if(config != null){ |
|
138 |
Set<UUID> taxonNodeUuidSet = config.getTaxonNodeUuids(); |
|
139 |
List<Classification> classificationList = getClassificationService().find(taxonNodeUuidSet); |
|
140 |
Set<Classification> classificationSet = new HashSet<Classification>(); |
|
141 |
classificationSet.addAll(classificationList); |
|
142 |
return classificationSet; |
|
143 |
} |
|
144 |
return null; |
|
145 |
} |
|
146 |
|
|
147 |
//TODO: Exception handling |
|
148 |
private CsvTaxRecordRedlist assembleRecord(CsvTaxExportStateRedlist state) { |
|
149 |
if(state!=null){ |
|
150 |
CsvTaxExportConfiguratorRedlist config = state.getConfig(); |
|
151 |
CsvMetaDataRecordRedlist metaRecord = new CsvMetaDataRecordRedlist(true, fileName, ROW_TYPE); |
|
152 |
state.addMetaRecord(metaRecord); |
|
153 |
CsvTaxRecordRedlist record = new CsvTaxRecordRedlist(metaRecord, config); |
|
154 |
return record; |
|
155 |
} |
|
156 |
return null; |
|
157 |
} |
|
158 |
|
|
159 |
/** |
|
160 |
* Takes positive List of areas and iterates over a given classification |
|
161 |
* and their {@link Taxon} to return all {@link Taxon} with the desired |
|
162 |
* geographical attribute. |
|
163 |
* |
|
164 |
* <p><p> |
|
165 |
* |
|
166 |
* If selectedAreas is null all {@link TaxonNode}s of the given {@link Classification} will be returned. |
|
167 |
* |
|
168 |
* @param selectedAreas |
|
169 |
* @param classificationSet |
|
170 |
* @return |
|
171 |
*/ |
|
172 |
protected List<TaxonNode> handleGeographicalFilter(List<NamedArea> selectedAreas, |
|
173 |
Set<Classification> classificationSet) { |
|
174 |
List<TaxonNode> filteredNodes = new ArrayList<TaxonNode>(); |
|
175 |
List<TaxonNode> allNodes = getAllNodes(classificationSet); |
|
176 |
//Geographical filter |
|
177 |
logger.info(selectedAreas.size()); |
|
178 |
if(selectedAreas != null && !selectedAreas.isEmpty() && selectedAreas.size() < 16){ |
|
179 |
// if(selectedAreas.size() == 16){ |
|
180 |
// //Germany TDWG Level 3 |
|
181 |
// String germany="uu7b7c2db5-aa44-4302-bdec-6556fd74b0b9id"; |
|
182 |
// selectedAreas.add((NamedArea) getTermService().find(UUID.fromString(germany))); |
|
183 |
// } |
|
184 |
for (TaxonNode node : allNodes){ |
|
185 |
Taxon taxon = CdmBase.deproxy(node.getTaxon(), Taxon.class); |
|
186 |
Set<TaxonDescription> descriptions = taxon.getDescriptions(); |
|
187 |
for (TaxonDescription description : descriptions){ |
|
188 |
for (DescriptionElementBase el : description.getElements()){ |
|
189 |
if (el.isInstanceOf(Distribution.class) ){ |
|
190 |
Distribution distribution = CdmBase.deproxy(el, Distribution.class); |
|
191 |
NamedArea area = distribution.getArea(); |
|
192 |
for(NamedArea selectedArea:selectedAreas){ |
|
193 |
if(selectedArea.getUuid().equals(area.getUuid())){ |
|
194 |
filteredNodes.add(node); |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
} |
|
200 |
} |
|
201 |
}else{ |
|
202 |
filteredNodes = allNodes; |
|
203 |
} |
|
204 |
return filteredNodes; |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* handles misapplied {@link Taxon} |
|
209 |
* @param taxon |
|
210 |
* @param writer |
|
211 |
* @param classification |
|
212 |
* @param metaRecord |
|
213 |
* @param config |
|
214 |
*/ |
|
215 |
private void handleMisapplication(Taxon taxon, PrintWriter writer, Classification classification, CsvTaxRecordRedlist record, CsvTaxExportConfiguratorRedlist config) { |
|
216 |
Set<Taxon> misappliedNames = taxon.getMisappliedNames(); |
|
217 |
for (Taxon misappliedName : misappliedNames ){ |
|
218 |
// CsvTaxRecordRedlist record = new CsvTaxRecordRedlist(metaRecord, config); |
|
219 |
TaxonRelationshipType relType = TaxonRelationshipType.MISAPPLIED_NAME_FOR(); |
|
220 |
NonViralName<?> name = CdmBase.deproxy(misappliedName.getName(), NonViralName.class); |
|
221 |
|
|
222 |
if (! this.recordExists(misappliedName)){ |
|
223 |
handleTaxonBase(record, misappliedName, name, taxon, classification, relType, false, false, config); |
|
224 |
record.write(writer); |
|
225 |
this.addExistingRecord(misappliedName); |
|
226 |
} |
|
227 |
} |
|
228 |
} |
|
229 |
|
|
230 |
/** |
|
231 |
* handles the information record for the actual {@link Taxon} including {@link Classification classification}, Taxon Name, Taxon ID, |
|
232 |
* Taxon Status, Synonyms, {@link Feature features} data |
|
233 |
* @param record the concrete information record |
|
234 |
* @param taxonBase {@link Taxon} |
|
235 |
* @param name |
|
236 |
* @param acceptedTaxon |
|
237 |
* @param parent |
|
238 |
* @param basionym |
|
239 |
* @param isPartial |
|
240 |
* @param isProParte |
|
241 |
* @param config |
|
242 |
* @param type |
|
243 |
*/ |
|
244 |
private void handleTaxonBase(CsvTaxRecordRedlist record,TaxonBase<?> taxonBase, |
|
245 |
NonViralName<?> name, Taxon acceptedTaxon, Classification classification, |
|
246 |
RelationshipTermBase<?> relType, boolean isProParte, boolean isPartial, |
|
247 |
CsvTaxExportConfiguratorRedlist config) { |
|
248 |
|
|
249 |
List<Feature> features = config.getFeatures(); |
|
250 |
record.setHeadLinePrinted(config.isHasHeaderLines()); |
|
251 |
if(features != null)record.setPrintFeatures(features); |
|
252 |
config.setHasHeaderLines(false); |
|
253 |
|
|
254 |
record.setDatasetName(classification.getTitleCache()); |
|
255 |
record.setScientificName(name.getTitleCache()); |
|
256 |
record.setScientificNameId(name.getUuid().toString()); |
|
257 |
handleTaxonomicStatus(record, name, relType, isProParte, isPartial); |
|
258 |
//synonyms |
|
259 |
handleSynonyms(record,(Taxon) taxonBase); |
|
260 |
//distribution |
|
261 |
handleDiscriptionData(record, (Taxon) taxonBase); |
|
262 |
if(features!= null) { |
|
263 |
|
|
264 |
List<List<String>> featureCells = new ArrayList<List<String>>(features.size()); |
|
265 |
for(int i = 0; i < features.size(); i++) { |
|
266 |
featureCells.add(new ArrayList<String>()); |
|
267 |
} |
|
268 |
handleRelatedRedlistStatus(record, (Taxon)taxonBase, false, featureCells, features); |
|
269 |
handleRelatedRedlistStatus(record, (Taxon)taxonBase, true, featureCells, features); |
|
270 |
|
|
271 |
} |
|
272 |
return; |
|
273 |
} |
|
274 |
|
|
275 |
private void handleTaxonomicStatus( |
|
276 |
CsvTaxRecordRedlist record, |
|
277 |
NonViralName<?> name, |
|
278 |
RelationshipTermBase<?> type, |
|
279 |
boolean isProParte, |
|
280 |
boolean isPartial) { |
|
281 |
if (type == null){ |
|
282 |
record.setTaxonomicStatus(name.getNomenclaturalCode().acceptedTaxonStatusLabel()); |
|
283 |
}else{ |
|
284 |
String status = name.getNomenclaturalCode().synonymStatusLabel(); |
|
285 |
if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())){ |
|
286 |
status = "heterotypicSynonym"; |
|
287 |
}else if(type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())){ |
|
288 |
status = "homotypicSynonym"; |
|
289 |
}else if(type.equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){ |
|
290 |
status = "misapplied"; |
|
291 |
} |
|
292 |
if (isProParte){ |
|
293 |
status = "proParteSynonym"; |
|
294 |
}else if (isPartial){ |
|
295 |
String message = "Partial synonym is not part of the gbif toxonomic status vocabulary"; |
|
296 |
logger.warn(message); |
|
297 |
status = "partialSynonym"; |
|
298 |
} |
|
299 |
|
|
300 |
record.setTaxonomicStatus(status); |
|
301 |
} |
|
302 |
} |
|
303 |
|
|
304 |
private void handleSynonyms(CsvTaxRecordRedlist record, Taxon taxon) { |
|
305 |
|
|
306 |
Set<SynonymRelationship> synRels = taxon.getSynonymRelations(); |
|
307 |
ArrayList<String> synonyms = new ArrayList<String>(); |
|
308 |
for (SynonymRelationship synRel :synRels ){ |
|
309 |
Synonym synonym = synRel.getSynonym(); |
|
310 |
SynonymRelationshipType type = synRel.getType(); |
|
311 |
if (type == null){ // should not happen |
|
312 |
type = SynonymRelationshipType.SYNONYM_OF(); |
|
313 |
} |
|
314 |
NonViralName<?> name = CdmBase.deproxy(synonym.getName(), NonViralName.class); |
|
315 |
synonyms.add(name.getTitleCache()); |
|
316 |
} |
|
317 |
record.setSynonyms(synonyms); |
|
318 |
} |
|
319 |
|
|
320 |
private void handleDiscriptionData(CsvTaxRecordRedlist record, Taxon taxon) { |
|
321 |
|
|
322 |
Set<TaxonDescription> descriptions = taxon.getDescriptions(); |
|
323 |
ArrayList<String> distributions = new ArrayList<String>(); |
|
324 |
for (TaxonDescription description : descriptions){ |
|
325 |
for (DescriptionElementBase el : description.getElements()){ |
|
326 |
if (el.isInstanceOf(Distribution.class) ){ |
|
327 |
Distribution distribution = CdmBase.deproxy(el, Distribution.class); |
|
328 |
NamedArea area = distribution.getArea(); |
|
329 |
distributions.add(area.getTitleCache()); |
|
330 |
} |
|
331 |
|
|
332 |
} |
|
333 |
} |
|
334 |
record.setCountryCode(distributions); |
|
335 |
} |
|
336 |
|
|
337 |
private void handleRedlistStatus(CsvTaxRecordRedlist record, Taxon taxon, List<List<String>> featureCells, List<Feature> features){ |
|
338 |
Set<TaxonDescription> descriptions = taxon.getDescriptions(); |
|
339 |
|
|
340 |
for (TaxonDescription description : descriptions){ |
|
341 |
for (DescriptionElementBase el : description.getElements()){ |
|
342 |
if(el.isInstanceOf(CategoricalData.class)){ |
|
343 |
CategoricalData categoricalData = CdmBase.deproxy(el, CategoricalData.class); |
|
344 |
for(State state:categoricalData.getStatesOnly()){ |
|
345 |
Feature stateFeature = categoricalData.getFeature(); |
|
346 |
// find matching feature and put data into according cell |
|
347 |
for(int i = 0; i < features.size(); i++) { |
|
348 |
if(features.get(i).equals(stateFeature)){ |
|
349 |
List<String> cell = featureCells.get(i); |
|
350 |
cell.add(state.toString()); |
|
351 |
} |
|
352 |
} |
|
353 |
} |
|
354 |
}else if(el.isInstanceOf(TextData.class)){ |
|
355 |
TextData textData = CdmBase.deproxy(el, TextData.class); |
|
356 |
Feature textFeature = textData.getFeature(); |
|
357 |
// find matching feature and put data into according cell |
|
358 |
for(int i = 0; i < features.size(); i++) { |
|
359 |
if(features.get(i).equals(textFeature)){ |
|
360 |
List<String> cell = featureCells.get(i); |
|
361 |
String text = textData.getText(Language.GERMAN()); |
|
362 |
text = text.replaceAll(System.getProperty("line.separator"), ""); |
|
363 |
text = text.replaceAll(" ", " "); |
|
364 |
cell.add(text); |
|
365 |
|
|
366 |
} |
|
367 |
} |
|
368 |
} |
|
369 |
} |
|
370 |
} |
|
371 |
record.setFeatures(featureCells); |
|
372 |
} |
|
373 |
|
|
374 |
|
|
375 |
private void handleRelatedRedlistStatus(CsvTaxRecordRedlist record, Taxon taxon, boolean relationFrom, List<List<String>> featureCells, List<Feature> features) { |
|
376 |
|
|
377 |
if (relationFrom)handleRedlistStatus(record, taxon, featureCells, features); |
|
378 |
|
|
379 |
|
|
380 |
Set<TaxonRelationship> taxRels; |
|
381 |
if(relationFrom){ |
|
382 |
taxRels = taxon.getRelationsFromThisTaxon(); |
|
383 |
}else{ |
|
384 |
taxRels = taxon.getRelationsToThisTaxon(); |
|
385 |
} |
|
386 |
for (TaxonRelationship taxRel:taxRels){ |
|
387 |
if(taxRel.getType().equals(TaxonRelationshipType.CONGRUENT_TO())){ |
|
388 |
Taxon relatedTaxon; |
|
389 |
if(relationFrom){ |
|
390 |
relatedTaxon = taxRel.getToTaxon(); |
|
391 |
}else{ |
|
392 |
relatedTaxon = taxRel.getFromTaxon(); |
|
393 |
} |
|
394 |
handleRedlistStatus(record, relatedTaxon, featureCells, features); |
|
395 |
} |
|
396 |
} |
|
397 |
} |
|
398 |
|
|
399 |
@Override |
|
400 |
protected boolean doCheck(CsvTaxExportStateRedlist state) { |
|
401 |
boolean result = true; |
|
402 |
logger.warn("No check implemented for " + this.ioName); |
|
403 |
return result; |
|
404 |
} |
|
405 |
|
|
406 |
@Override |
|
407 |
protected boolean isIgnore(CsvTaxExportStateRedlist state) { |
|
408 |
return ! state.getConfig().isDoTaxa(); |
|
409 |
} |
|
410 |
|
|
411 |
} |
|
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.PrintWriter; |
|
14 |
import java.util.ArrayList; |
|
15 |
import java.util.Collections; |
|
16 |
import java.util.Comparator; |
|
17 |
import java.util.HashSet; |
|
18 |
import java.util.List; |
|
19 |
import java.util.Set; |
|
20 |
import java.util.UUID; |
|
21 |
|
|
22 |
import org.apache.log4j.Logger; |
|
23 |
import org.springframework.stereotype.Component; |
|
24 |
import org.springframework.transaction.TransactionStatus; |
|
25 |
|
|
26 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
27 |
import eu.etaxonomy.cdm.model.common.Language; |
|
28 |
import eu.etaxonomy.cdm.model.common.RelationshipTermBase; |
|
29 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
|
30 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
31 |
import eu.etaxonomy.cdm.model.description.Distribution; |
|
32 |
import eu.etaxonomy.cdm.model.description.Feature; |
|
33 |
import eu.etaxonomy.cdm.model.description.State; |
|
34 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
35 |
import eu.etaxonomy.cdm.model.description.TextData; |
|
36 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
|
37 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
38 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
39 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
40 |
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship; |
|
41 |
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType; |
|
42 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
43 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
44 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
45 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
46 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
47 |
|
|
48 |
|
|
49 |
/** |
|
50 |
* @author a.oppermann |
|
51 |
* @created 18.10.2012 |
|
52 |
*/ |
|
53 |
|
|
54 |
@Component |
|
55 |
public class CsvTaxExportRedlist extends CsvExportBaseRedlist { |
|
56 |
private static final Logger logger = Logger.getLogger(CsvTaxExportRedlist.class); |
|
57 |
|
|
58 |
private static final String ROW_TYPE = "http://rs.tdwg.org/dwc/terms/Taxon"; |
|
59 |
private static final String fileName = "RedlistCoreTax.csv"; |
|
60 |
|
|
61 |
public CsvTaxExportRedlist() { |
|
62 |
super(); |
|
63 |
this.ioName = this.getClass().getSimpleName(); |
|
64 |
} |
|
65 |
|
|
66 |
|
|
67 |
/** Retrieves data from a CDM DB and serializes them CDM to CSV. |
|
68 |
* Starts with root taxa and traverses the classification to retrieve |
|
69 |
* children taxa, synonyms, relationships, descriptive data, red list |
|
70 |
* status (features). |
|
71 |
* Taxa that are not part of the classification are not found. |
|
72 |
* |
|
73 |
* @param exImpConfig |
|
74 |
* @param dbname |
|
75 |
* @param filename |
|
76 |
*/ |
|
77 |
@Override |
|
78 |
protected void doInvoke(CsvTaxExportStateRedlist state){ |
|
79 |
CsvTaxExportConfiguratorRedlist config = state.getConfig(); |
|
80 |
TransactionStatus txStatus = startTransaction(true); |
|
81 |
List<NamedArea> selectedAreas = config.getNamedAreas(); |
|
82 |
Set<TaxonNode> taxonNodes = assembleTaxonNodeSet(config); |
|
83 |
|
|
84 |
PrintWriter writer = null; |
|
85 |
ByteArrayOutputStream byteArrayOutputStream; |
|
86 |
try { |
|
87 |
byteArrayOutputStream = config.getByteArrayOutputStream(); |
|
88 |
writer = new PrintWriter(byteArrayOutputStream); |
|
89 |
//geographical Filter |
|
90 |
List<TaxonNode> filteredNodes = handleGeographicalFilter(selectedAreas, taxonNodes); |
|
91 |
|
|
92 |
//sorting List |
|
93 |
Collections.sort(filteredNodes, new Comparator<TaxonNode>() { |
|
94 |
|
|
95 |
@Override |
|
96 |
public int compare(TaxonNode tn1, TaxonNode tn2) { |
|
97 |
Taxon taxon1 = tn1.getTaxon(); |
|
98 |
Taxon taxon2 = tn2.getTaxon(); |
|
99 |
if(taxon1 != null && taxon2 != null){ |
|
100 |
return taxon1.getTitleCache().compareTo(taxon2.getTitleCache()); |
|
101 |
} |
|
102 |
else{ |
|
103 |
return 0; |
|
104 |
} |
|
105 |
} |
|
106 |
}); |
|
107 |
for (TaxonNode node : filteredNodes){ |
|
108 |
Taxon taxon = CdmBase.deproxy(node.getTaxon(), Taxon.class); |
|
109 |
CsvTaxRecordRedlist record = assembleRecord(state); |
|
110 |
NonViralName<?> name = CdmBase.deproxy(taxon.getName(), NonViralName.class); |
|
111 |
Classification classification = node.getClassification(); |
|
112 |
config.setClassificationTitleCache(classification.getTitleCache()); |
|
113 |
if (! this.recordExists(taxon)){ |
|
114 |
handleTaxonBase(record, taxon, name, taxon, classification, null, false, false, config); |
|
115 |
record.write(writer); |
|
116 |
this.addExistingRecord(taxon); |
|
117 |
} |
|
118 |
//misapplied names |
|
119 |
handleMisapplication(taxon, writer, classification, record, config); |
|
120 |
writer.flush(); |
|
121 |
} |
|
122 |
} catch (ClassCastException e) { |
|
123 |
e.printStackTrace(); |
|
124 |
} |
|
125 |
finally{ |
|
126 |
writer.close(); |
|
127 |
this.clearExistingRecordIds(); |
|
128 |
} |
|
129 |
commitTransaction(txStatus); |
|
130 |
return; |
|
131 |
|
|
132 |
} |
|
133 |
|
|
134 |
|
|
135 |
//TODO: Exception handling |
|
136 |
protected Set<TaxonNode> assembleTaxonNodeSet(CsvTaxExportConfiguratorRedlist config){ |
|
137 |
Set<TaxonNode> taxonNodes = new HashSet<>(); |
|
138 |
if(config != null){ |
|
139 |
Set<UUID> taxonNodeUuidSet = config.getTaxonNodeUuids(); |
|
140 |
taxonNodes.addAll(getTaxonNodeService().find(taxonNodeUuidSet)); |
|
141 |
} |
|
142 |
return taxonNodes; |
|
143 |
} |
|
144 |
|
|
145 |
//TODO: Exception handling |
|
146 |
private CsvTaxRecordRedlist assembleRecord(CsvTaxExportStateRedlist state) { |
|
147 |
if(state!=null){ |
|
148 |
CsvTaxExportConfiguratorRedlist config = state.getConfig(); |
|
149 |
CsvMetaDataRecordRedlist metaRecord = new CsvMetaDataRecordRedlist(true, fileName, ROW_TYPE); |
|
150 |
state.addMetaRecord(metaRecord); |
|
151 |
CsvTaxRecordRedlist record = new CsvTaxRecordRedlist(metaRecord, config); |
|
152 |
return record; |
|
153 |
} |
|
154 |
return null; |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* Takes positive List of areas and iterates over a given taxon node |
|
159 |
* and their {@link Taxon} to return all {@link Taxon} with the desired |
|
160 |
* geographical attribute. |
|
161 |
* |
|
162 |
* <p><p> |
|
163 |
* |
|
164 |
* If selectedAreas is null all child {@link TaxonNode}s of the given taxon node will be returned. |
|
165 |
* |
|
166 |
* @param selectedAreas |
|
167 |
* @param taxonNodes |
|
168 |
* @return |
|
169 |
*/ |
|
170 |
protected List<TaxonNode> handleGeographicalFilter(List<NamedArea> selectedAreas, |
|
171 |
Set<TaxonNode> taxonNodes) { |
|
172 |
List<TaxonNode> filteredNodes = new ArrayList<TaxonNode>(); |
|
173 |
List<TaxonNode> allNodes = new ArrayList(getAllNodes(taxonNodes)); |
|
174 |
//Geographical filter |
|
175 |
logger.info(selectedAreas.size()); |
|
176 |
if(selectedAreas != null && !selectedAreas.isEmpty() && selectedAreas.size() < 16){ |
|
177 |
// if(selectedAreas.size() == 16){ |
|
178 |
// //Germany TDWG Level 3 |
|
179 |
// String germany="uu7b7c2db5-aa44-4302-bdec-6556fd74b0b9id"; |
|
180 |
// selectedAreas.add((NamedArea) getTermService().find(UUID.fromString(germany))); |
|
181 |
// } |
|
182 |
for (TaxonNode node : allNodes){ |
|
183 |
Taxon taxon = CdmBase.deproxy(node.getTaxon(), Taxon.class); |
|
184 |
Set<TaxonDescription> descriptions = taxon.getDescriptions(); |
|
185 |
for (TaxonDescription description : descriptions){ |
|
186 |
for (DescriptionElementBase el : description.getElements()){ |
|
187 |
if (el.isInstanceOf(Distribution.class) ){ |
|
188 |
Distribution distribution = CdmBase.deproxy(el, Distribution.class); |
|
189 |
NamedArea area = distribution.getArea(); |
|
190 |
for(NamedArea selectedArea:selectedAreas){ |
|
191 |
if(selectedArea.getUuid().equals(area.getUuid())){ |
|
192 |
filteredNodes.add(node); |
|
193 |
} |
|
194 |
} |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
}else{ |
|
200 |
filteredNodes = allNodes; |
|
201 |
} |
|
202 |
return filteredNodes; |
|
203 |
} |
|
204 |
|
|
205 |
/** |
|
206 |
* handles misapplied {@link Taxon} |
|
207 |
* @param taxon |
|
208 |
* @param writer |
|
209 |
* @param classification |
|
210 |
* @param metaRecord |
|
211 |
* @param config |
|
212 |
*/ |
|
213 |
private void handleMisapplication(Taxon taxon, PrintWriter writer, Classification classification, CsvTaxRecordRedlist record, CsvTaxExportConfiguratorRedlist config) { |
|
214 |
Set<Taxon> misappliedNames = taxon.getMisappliedNames(); |
|
215 |
for (Taxon misappliedName : misappliedNames ){ |
|
216 |
// CsvTaxRecordRedlist record = new CsvTaxRecordRedlist(metaRecord, config); |
|
217 |
TaxonRelationshipType relType = TaxonRelationshipType.MISAPPLIED_NAME_FOR(); |
|
218 |
NonViralName<?> name = CdmBase.deproxy(misappliedName.getName(), NonViralName.class); |
|
219 |
|
|
220 |
if (! this.recordExists(misappliedName)){ |
|
221 |
handleTaxonBase(record, misappliedName, name, taxon, classification, relType, false, false, config); |
|
222 |
record.write(writer); |
|
223 |
this.addExistingRecord(misappliedName); |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
227 |
|
|
228 |
/** |
|
229 |
* handles the information record for the actual {@link Taxon} including {@link Classification classification}, Taxon Name, Taxon ID, |
|
230 |
* Taxon Status, Synonyms, {@link Feature features} data |
|
231 |
* @param record the concrete information record |
|
232 |
* @param taxonBase {@link Taxon} |
|
233 |
* @param name |
|
234 |
* @param acceptedTaxon |
|
235 |
* @param parent |
|
236 |
* @param basionym |
|
237 |
* @param isPartial |
|
238 |
* @param isProParte |
|
239 |
* @param config |
|
240 |
* @param type |
|
241 |
*/ |
|
242 |
private void handleTaxonBase(CsvTaxRecordRedlist record,TaxonBase<?> taxonBase, |
|
243 |
NonViralName<?> name, Taxon acceptedTaxon, Classification classification, |
|
244 |
RelationshipTermBase<?> relType, boolean isProParte, boolean isPartial, |
|
245 |
CsvTaxExportConfiguratorRedlist config) { |
|
246 |
|
|
247 |
List<Feature> features = config.getFeatures(); |
|
248 |
record.setHeadLinePrinted(config.isHasHeaderLines()); |
|
249 |
if(features != null)record.setPrintFeatures(features); |
|
250 |
config.setHasHeaderLines(false); |
|
251 |
|
|
252 |
record.setDatasetName(classification.getTitleCache()); |
|
253 |
record.setScientificName(name.getTitleCache()); |
|
254 |
record.setScientificNameId(name.getUuid().toString()); |
|
255 |
handleTaxonomicStatus(record, name, relType, isProParte, isPartial); |
|
256 |
//synonyms |
|
257 |
handleSynonyms(record,(Taxon) taxonBase); |
|
258 |
//distribution |
|
259 |
handleDiscriptionData(record, (Taxon) taxonBase); |
|
260 |
if(features!= null) { |
|
261 |
|
|
262 |
List<List<String>> featureCells = new ArrayList<List<String>>(features.size()); |
|
263 |
for(int i = 0; i < features.size(); i++) { |
|
264 |
featureCells.add(new ArrayList<String>()); |
|
265 |
} |
|
266 |
handleRelatedRedlistStatus(record, (Taxon)taxonBase, false, featureCells, features); |
|
267 |
handleRelatedRedlistStatus(record, (Taxon)taxonBase, true, featureCells, features); |
|
268 |
|
|
269 |
} |
|
270 |
return; |
|
271 |
} |
|
272 |
|
|
273 |
private void handleTaxonomicStatus( |
|
274 |
CsvTaxRecordRedlist record, |
|
275 |
NonViralName<?> name, |
|
276 |
RelationshipTermBase<?> type, |
|
277 |
boolean isProParte, |
|
278 |
boolean isPartial) { |
|
279 |
if (type == null){ |
|
280 |
record.setTaxonomicStatus(name.getNomenclaturalCode().acceptedTaxonStatusLabel()); |
|
281 |
}else{ |
|
282 |
String status = name.getNomenclaturalCode().synonymStatusLabel(); |
|
283 |
if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())){ |
|
284 |
status = "heterotypicSynonym"; |
|
285 |
}else if(type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())){ |
|
286 |
status = "homotypicSynonym"; |
|
287 |
}else if(type.equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){ |
|
288 |
status = "misapplied"; |
|
289 |
} |
|
290 |
if (isProParte){ |
|
291 |
status = "proParteSynonym"; |
|
292 |
}else if (isPartial){ |
|
293 |
String message = "Partial synonym is not part of the gbif toxonomic status vocabulary"; |
|
294 |
logger.warn(message); |
|
295 |
status = "partialSynonym"; |
|
296 |
} |
|
297 |
|
|
298 |
record.setTaxonomicStatus(status); |
|
299 |
} |
|
300 |
} |
|
301 |
|
|
302 |
private void handleSynonyms(CsvTaxRecordRedlist record, Taxon taxon) { |
|
303 |
|
|
304 |
Set<SynonymRelationship> synRels = taxon.getSynonymRelations(); |
|
305 |
ArrayList<String> synonyms = new ArrayList<String>(); |
|
306 |
for (SynonymRelationship synRel :synRels ){ |
|
307 |
Synonym synonym = synRel.getSynonym(); |
|
308 |
SynonymRelationshipType type = synRel.getType(); |
|
309 |
if (type == null){ // should not happen |
|
310 |
type = SynonymRelationshipType.SYNONYM_OF(); |
|
311 |
} |
|
312 |
NonViralName<?> name = CdmBase.deproxy(synonym.getName(), NonViralName.class); |
|
313 |
synonyms.add(name.getTitleCache()); |
|
314 |
} |
|
315 |
record.setSynonyms(synonyms); |
|
316 |
} |
|
317 |
|
|
318 |
private void handleDiscriptionData(CsvTaxRecordRedlist record, Taxon taxon) { |
|
319 |
|
|
320 |
Set<TaxonDescription> descriptions = taxon.getDescriptions(); |
|
321 |
ArrayList<String> distributions = new ArrayList<String>(); |
|
322 |
for (TaxonDescription description : descriptions){ |
|
323 |
for (DescriptionElementBase el : description.getElements()){ |
|
324 |
if (el.isInstanceOf(Distribution.class) ){ |
|
325 |
Distribution distribution = CdmBase.deproxy(el, Distribution.class); |
|
326 |
NamedArea area = distribution.getArea(); |
|
327 |
distributions.add(area.getTitleCache()); |
|
328 |
} |
|
329 |
|
|
330 |
} |
|
331 |
} |
|
332 |
record.setCountryCode(distributions); |
|
333 |
} |
|
334 |
|
|
335 |
private void handleRedlistStatus(CsvTaxRecordRedlist record, Taxon taxon, List<List<String>> featureCells, List<Feature> features){ |
|
336 |
Set<TaxonDescription> descriptions = taxon.getDescriptions(); |
|
337 |
|
|
338 |
for (TaxonDescription description : descriptions){ |
|
339 |
for (DescriptionElementBase el : description.getElements()){ |
|
340 |
if(el.isInstanceOf(CategoricalData.class)){ |
|
341 |
CategoricalData categoricalData = CdmBase.deproxy(el, CategoricalData.class); |
|
342 |
for(State state:categoricalData.getStatesOnly()){ |
|
343 |
Feature stateFeature = categoricalData.getFeature(); |
|
344 |
// find matching feature and put data into according cell |
|
345 |
for(int i = 0; i < features.size(); i++) { |
|
346 |
if(features.get(i).equals(stateFeature)){ |
|
347 |
List<String> cell = featureCells.get(i); |
|
348 |
cell.add(state.toString()); |
|
349 |
} |
|
350 |
} |
|
351 |
} |
|
352 |
}else if(el.isInstanceOf(TextData.class)){ |
|
353 |
TextData textData = CdmBase.deproxy(el, TextData.class); |
|
354 |
Feature textFeature = textData.getFeature(); |
|
355 |
// find matching feature and put data into according cell |
|
356 |
for(int i = 0; i < features.size(); i++) { |
|
357 |
if(features.get(i).equals(textFeature)){ |
|
358 |
List<String> cell = featureCells.get(i); |
|
359 |
String text = textData.getText(Language.GERMAN()); |
|
360 |
text = text.replaceAll(System.getProperty("line.separator"), ""); |
|
361 |
text = text.replaceAll(" ", " "); |
|
362 |
cell.add(text); |
|
363 |
|
|
364 |
} |
|
365 |
} |
|
366 |
} |
|
367 |
} |
|
368 |
} |
|
369 |
record.setFeatures(featureCells); |
|
370 |
} |
|
371 |
|
|
372 |
|
|
373 |
private void handleRelatedRedlistStatus(CsvTaxRecordRedlist record, Taxon taxon, boolean relationFrom, List<List<String>> featureCells, List<Feature> features) { |
|
374 |
|
|
375 |
if (relationFrom)handleRedlistStatus(record, taxon, featureCells, features); |
|
376 |
|
|
377 |
|
|
378 |
Set<TaxonRelationship> taxRels; |
|
379 |
if(relationFrom){ |
|
380 |
taxRels = taxon.getRelationsFromThisTaxon(); |
|
381 |
}else{ |
|
382 |
taxRels = taxon.getRelationsToThisTaxon(); |
|
383 |
} |
|
384 |
for (TaxonRelationship taxRel:taxRels){ |
|
385 |
if(taxRel.getType().equals(TaxonRelationshipType.CONGRUENT_TO())){ |
|
386 |
Taxon relatedTaxon; |
|
387 |
if(relationFrom){ |
|
388 |
relatedTaxon = taxRel.getToTaxon(); |
|
389 |
}else{ |
|
390 |
relatedTaxon = taxRel.getFromTaxon(); |
|
391 |
} |
|
392 |
handleRedlistStatus(record, relatedTaxon, featureCells, features); |
|
393 |
} |
|
394 |
} |
|
395 |
} |
|
396 |
|
|
397 |
@Override |
|
398 |
protected boolean doCheck(CsvTaxExportStateRedlist state) { |
|
399 |
boolean result = true; |
|
400 |
logger.warn("No check implemented for " + this.ioName); |
|
401 |
return result; |
|
402 |
} |
|
403 |
|
|
404 |
@Override |
|
405 |
protected boolean isIgnore(CsvTaxExportStateRedlist state) { |
|
406 |
return ! state.getConfig().isDoTaxa(); |
|
407 |
} |
|
408 |
|
|
409 |
} |
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/checklist/CsvExportController.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2009 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
Also available in: Unified diff
classifications