1
|
/**
|
2
|
* Copyright (C) 2009 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
|
package eu.etaxonomy.cdm.io.dwca.out;
|
10
|
|
11
|
import java.io.PrintWriter;
|
12
|
import java.net.URISyntaxException;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
|
16
|
import eu.etaxonomy.cdm.io.stream.terms.TermUri;
|
17
|
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
18
|
import eu.etaxonomy.cdm.model.common.DefinedTerm;
|
19
|
import eu.etaxonomy.cdm.model.common.TimePeriod;
|
20
|
import eu.etaxonomy.cdm.model.name.Rank;
|
21
|
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
|
22
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
23
|
|
24
|
/**
|
25
|
* @author a.mueller
|
26
|
\* @since 20.04.2011
|
27
|
*
|
28
|
*/
|
29
|
public class DwcaTypesRecord extends DwcaRecordBase {
|
30
|
@SuppressWarnings("unused")
|
31
|
private static final Logger logger = Logger.getLogger(DwcaTypesRecord.class);
|
32
|
|
33
|
private String bibliographicCitation;
|
34
|
private TypeDesignationStatusBase<?> typeStatus;
|
35
|
private String typeDesignatedBy;
|
36
|
private String scientificName;
|
37
|
private Rank taxonRank;
|
38
|
private final DwcaId occurrenceId;
|
39
|
private String institutionCode;
|
40
|
private String collectionCode;
|
41
|
private String catalogNumber;
|
42
|
private String locality;
|
43
|
private DefinedTerm sex;
|
44
|
private AgentBase<?> recordedBy;
|
45
|
private String source;
|
46
|
private String descriptionSource;
|
47
|
private TimePeriod eventDate;
|
48
|
private String verbatimLabel;
|
49
|
private String verbatimLongitude;
|
50
|
private String verbatimLatitude;
|
51
|
private String coordinatesPrecision;
|
52
|
|
53
|
private String referenceSystem;
|
54
|
|
55
|
public DwcaTypesRecord(DwcaMetaDataRecord metaDataRecord, DwcaTaxExportConfigurator config){
|
56
|
super(metaDataRecord, config);
|
57
|
occurrenceId = new DwcaId(config);
|
58
|
}
|
59
|
|
60
|
@Override
|
61
|
protected void registerKnownFields(){
|
62
|
try {
|
63
|
addKnownField("bibliographicCitation", "http://purl.org/dc/terms/bibliographicCitation");
|
64
|
addKnownField("typeStatus", "http://rs.tdwg.org/dwc/terms/typeStatus");
|
65
|
addKnownField("typeDesignatedBy", "http://rs.gbif.org/terms/1.0/typeDesignatedBy");
|
66
|
addKnownField("scientificName", "http://rs.tdwg.org/dwc/terms/scientificName");
|
67
|
addKnownField("taxonRank", "http://rs.tdwg.org/dwc/terms/taxonRank");
|
68
|
addKnownField("occurrenceID", "http://rs.tdwg.org/dwc/terms/occurrenceID");
|
69
|
addKnownField("institutionCode", "http://rs.tdwg.org/dwc/terms/institutionCode");
|
70
|
addKnownField("collectionCode", "http://rs.tdwg.org/dwc/terms/collectionCode");
|
71
|
addKnownField("catalogNumber", "http://rs.tdwg.org/dwc/terms/catalogNumber");
|
72
|
addKnownField("locality", "http://rs.tdwg.org/dwc/terms/locality");
|
73
|
addKnownField("sex", "http://rs.tdwg.org/dwc/terms/sex");
|
74
|
addKnownField("recordedBy", "http://rs.tdwg.org/dwc/terms/recordedBy");
|
75
|
addKnownField("source", "http://purl.org/dc/terms/source");
|
76
|
addKnownField("descriptionSource", "http://purl.org/dc/terms/source");
|
77
|
addKnownField("verbatimEventDate", "http://rs.tdwg.org/dwc/terms/verbatimEventDate");
|
78
|
addKnownField("verbatimLabel", "http://rs.gbif.org/terms/1.0/verbatimLabel");
|
79
|
addKnownField("verbatimLongitude", "http://rs.tdwg.org/dwc/terms/verbatimLongitude");
|
80
|
addKnownField("verbatimLatitude", "http://rs.tdwg.org/dwc/terms/verbatimLatitude");
|
81
|
addKnownField("coordinatesPrecision", "http://rs.tdwg.org/dwc/terms/coordinatePrecision");
|
82
|
addKnownField("referenceSystem","http://rs.tdwg.org/dwc/terms/verbatimCoordinateSystem");
|
83
|
|
84
|
} catch (URISyntaxException e) {
|
85
|
throw new RuntimeException(e);
|
86
|
}
|
87
|
}
|
88
|
|
89
|
|
90
|
// @Override
|
91
|
// public List<String> getHeaderList() {
|
92
|
// String[] result = new String[]{
|
93
|
// "coreid",
|
94
|
// "bibliographicCitation",
|
95
|
// "typeStatus",
|
96
|
// "typeDesignatedBy",
|
97
|
// "scientificName",
|
98
|
// "taxonRank",
|
99
|
// "occurrenceId",
|
100
|
// "institutionCode",
|
101
|
// "collectionCode",
|
102
|
// "catalogNumber",
|
103
|
// "locality",
|
104
|
// "sex",
|
105
|
// "recordedBy",
|
106
|
// "source",
|
107
|
// "eventDate",
|
108
|
// "verbatimLabel",
|
109
|
// "verbatimLongitude",
|
110
|
// "verbatimLatitude"
|
111
|
// };
|
112
|
// return Arrays.asList(result);
|
113
|
// }
|
114
|
|
115
|
@Override
|
116
|
protected void doWrite(DwcaTaxExportState state, PrintWriter writer) {
|
117
|
|
118
|
printId(getUuid(), writer, IS_FIRST, "coreid");
|
119
|
print(bibliographicCitation, writer, IS_NOT_FIRST, TermUri.DC_BIBLIOGRAPHIC_CITATION);
|
120
|
print(getDesignationType(typeStatus), writer, IS_NOT_FIRST, TermUri.DWC_TYPE_STATUS);
|
121
|
print(typeDesignatedBy, writer, IS_NOT_FIRST, TermUri.DWC_TYPE_DESIGNATED_BY);
|
122
|
print(scientificName, writer, IS_NOT_FIRST, TermUri.DWC_SCIENTIFIC_NAME);
|
123
|
print(getRank(taxonRank), writer, IS_NOT_FIRST, TermUri.DWC_TAXON_RANK);
|
124
|
print(occurrenceId, writer, IS_NOT_FIRST, TermUri.DWC_OCCURRENCE_ID);
|
125
|
print(institutionCode, writer, IS_NOT_FIRST, TermUri.DWC_INSTITUTION_CODE);
|
126
|
print(collectionCode, writer, IS_NOT_FIRST, TermUri.DWC_COLLECTION_CODE);
|
127
|
print(catalogNumber, writer, IS_NOT_FIRST, TermUri.DWC_CATALOG_NUMBER);
|
128
|
print(locality, writer, IS_NOT_FIRST, TermUri.DWC_LOCALITY);
|
129
|
print(getSex(sex), writer, IS_NOT_FIRST, TermUri.DWC_SEX);
|
130
|
print(recordedBy, writer, IS_NOT_FIRST, TermUri.DWC_RECORDED_BY);
|
131
|
print(source, writer, IS_NOT_FIRST, TermUri.DC_SOURCE);
|
132
|
print(descriptionSource, writer, IS_NOT_FIRST, TermUri.DC_SOURCE);
|
133
|
print(getTimePeriod(eventDate), writer, IS_NOT_FIRST, TermUri.DWC_VERBATIM_EVENT_DATE);
|
134
|
print(verbatimLabel, writer, IS_NOT_FIRST, TermUri.DWC_VERBATIM_LABEL);
|
135
|
print(verbatimLongitude, writer, IS_NOT_FIRST, TermUri.DWC_VERBATIM_LONGITUDE);
|
136
|
print(verbatimLatitude, writer, IS_NOT_FIRST, TermUri.DWC_VERBATIM_LATITUDE);
|
137
|
print(coordinatesPrecision, writer, IS_NOT_FIRST, TermUri.DWC_COORDINATES_PRECISION);
|
138
|
print(referenceSystem,writer,IS_NOT_FIRST,TermUri.DWC_COORDINATES_SYSTEM);
|
139
|
writer.println();
|
140
|
}
|
141
|
|
142
|
public String getSource() {
|
143
|
return source;
|
144
|
}
|
145
|
public void setSource(String source) {
|
146
|
this.source = source;
|
147
|
}
|
148
|
|
149
|
public String getDescriptionSource() {
|
150
|
return descriptionSource;
|
151
|
}
|
152
|
public void setDescriptionSource(String descriptionSource) {
|
153
|
this.descriptionSource = descriptionSource;
|
154
|
}
|
155
|
|
156
|
public String getBibliographicCitation() {
|
157
|
return bibliographicCitation;
|
158
|
}
|
159
|
|
160
|
public void setBibliographicCitation(String bibliographicCitation) {
|
161
|
this.bibliographicCitation = bibliographicCitation;
|
162
|
}
|
163
|
|
164
|
public TypeDesignationStatusBase<?> getTypeStatus() {
|
165
|
return typeStatus;
|
166
|
}
|
167
|
|
168
|
public void setTypeStatus(TypeDesignationStatusBase<?> typeStatus) {
|
169
|
this.typeStatus = typeStatus;
|
170
|
}
|
171
|
|
172
|
public String getTypeDesignatedBy() {
|
173
|
return typeDesignatedBy;
|
174
|
}
|
175
|
|
176
|
public void setTypeDesignatedBy(String typeDesignatedBy) {
|
177
|
this.typeDesignatedBy = typeDesignatedBy;
|
178
|
}
|
179
|
|
180
|
public String getScientificName() {
|
181
|
return scientificName;
|
182
|
}
|
183
|
|
184
|
public void setScientificName(String scientificName) {
|
185
|
this.scientificName = scientificName;
|
186
|
}
|
187
|
|
188
|
public Rank getTaxonRank() {
|
189
|
return taxonRank;
|
190
|
}
|
191
|
|
192
|
public void setTaxonRank(Rank taxonRank) {
|
193
|
this.taxonRank = taxonRank;
|
194
|
}
|
195
|
|
196
|
public String getOccurrenceId() {
|
197
|
return occurrenceId.getId();
|
198
|
}
|
199
|
|
200
|
public void setOccurrenceId(SpecimenOrObservationBase<?> occurrenceId) {
|
201
|
this.occurrenceId.setId(occurrenceId);
|
202
|
}
|
203
|
|
204
|
public String getInstitutionCode() {
|
205
|
return institutionCode;
|
206
|
}
|
207
|
|
208
|
public void setInstitutionCode(String institutionCode) {
|
209
|
this.institutionCode = institutionCode;
|
210
|
}
|
211
|
|
212
|
public String getCollectionCode() {
|
213
|
return collectionCode;
|
214
|
}
|
215
|
|
216
|
public void setCollectionCode(String collectionCode) {
|
217
|
this.collectionCode = collectionCode;
|
218
|
}
|
219
|
|
220
|
public String getCatalogNumber() {
|
221
|
return catalogNumber;
|
222
|
}
|
223
|
|
224
|
public void setCatalogNumber(String catalogNumber) {
|
225
|
this.catalogNumber = catalogNumber;
|
226
|
}
|
227
|
|
228
|
public String getLocality() {
|
229
|
return locality;
|
230
|
}
|
231
|
|
232
|
public void setLocality(String locality) {
|
233
|
this.locality = locality;
|
234
|
}
|
235
|
|
236
|
public DefinedTerm getSex() {
|
237
|
return sex;
|
238
|
}
|
239
|
|
240
|
public void setSex(DefinedTerm sex) {
|
241
|
this.sex = sex;
|
242
|
}
|
243
|
|
244
|
public AgentBase<?> getRecordedBy() {
|
245
|
return recordedBy;
|
246
|
}
|
247
|
|
248
|
public void setRecordedBy(AgentBase<?> recordedBy) {
|
249
|
this.recordedBy = recordedBy;
|
250
|
}
|
251
|
|
252
|
public TimePeriod getEventDate() {
|
253
|
return eventDate;
|
254
|
}
|
255
|
|
256
|
public void setEventDate(TimePeriod eventDate) {
|
257
|
this.eventDate = eventDate;
|
258
|
}
|
259
|
|
260
|
public String getVerbatimLabel() {
|
261
|
return verbatimLabel;
|
262
|
}
|
263
|
|
264
|
public void setVerbatimLabel(String verbatimLabel) {
|
265
|
this.verbatimLabel = verbatimLabel;
|
266
|
}
|
267
|
|
268
|
public String getVerbatimLongitude() {
|
269
|
return verbatimLongitude;
|
270
|
}
|
271
|
|
272
|
public void setVerbatimLongitude(String verbatimLongitude) {
|
273
|
this.verbatimLongitude = verbatimLongitude;
|
274
|
}
|
275
|
|
276
|
public String getVerbatimLatitude() {
|
277
|
return verbatimLatitude;
|
278
|
}
|
279
|
|
280
|
public void setVerbatimLatitude(String verbatimLatitude) {
|
281
|
this.verbatimLatitude = verbatimLatitude;
|
282
|
}
|
283
|
|
284
|
/**
|
285
|
* @param string
|
286
|
*/
|
287
|
public void setCoordinatesPrecisionOrError(String coordinatesPrecision) {
|
288
|
this.coordinatesPrecision=coordinatesPrecision;
|
289
|
|
290
|
}
|
291
|
|
292
|
/**
|
293
|
* @param string
|
294
|
*/
|
295
|
public void setCoordinatesSystem(String referenceSystem) {
|
296
|
this.referenceSystem=referenceSystem;
|
297
|
|
298
|
}
|
299
|
|
300
|
}
|