Project

General

Profile

Download (6.26 KB) Statistics
| Branch: | Tag: | Revision:
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.common.Language;
18
import eu.etaxonomy.cdm.model.location.NamedArea;
19
import eu.etaxonomy.cdm.model.term.DefinedTerm;
20

    
21
/**
22
 * @author a.mueller
23
 * @since 18.04.2011
24
 *
25
 */
26
public class DwcaVernacularRecord extends DwcaRecordBase implements IDwcaAreaRecord{
27
	@SuppressWarnings("unused")
28
	private static final Logger logger = Logger.getLogger(DwcaVernacularRecord.class);
29

    
30
	private String vernacularName;
31
	private String source;
32
	private Language language;
33
	private String temporal;
34
	private DwcaId locationId;
35
	private String locality;
36
	private String countryCode;
37
	private DefinedTerm sex;
38
	private DefinedTerm lifeStage;
39
	private Boolean isPlural;
40
	private Boolean isPreferredName;
41
	private String organismPart;
42
	private String taxonRemarks;
43

    
44
	public DwcaVernacularRecord(DwcaMetaDataRecord metaDataRecord, DwcaTaxExportConfigurator config){
45
		super(metaDataRecord, config);
46
		locationId = new DwcaId(config);
47
	}
48

    
49
	@Override
50
    protected void registerKnownFields(){
51
		try {
52
			addKnownField("vernacularName", "http://rs.tdwg.org/dwc/terms/vernacularName");
53
			addKnownField("source", "http://purl.org/dc/terms/source");
54
			addKnownField("language", "http://purl.org/dc/terms/language");
55
			addKnownField("temporal", "http://purl.org/dc/terms/temporal");
56
			addKnownField("locationID", "http://rs.tdwg.org/dwc/terms/locationID");
57
			addKnownField("countryCode", "http://rs.tdwg.org/dwc/terms/countryCode");
58
			addKnownField("locality", "http://rs.tdwg.org/dwc/terms/locality");
59
			addKnownField("sex", "http://rs.tdwg.org/dwc/terms/sex");
60
			addKnownField("lifeStage", "http://rs.tdwg.org/dwc/terms/lifeStage");
61
			addKnownField("isPlural", "http://rs.gbif.org/terms/1.0/isPlural");
62
			addKnownField("organismPart", "http://rs.gbif.org/terms/1.0/organismPart");
63
			addKnownField("taxonRemarks", "http://rs.tdwg.org/dwc/terms/taxonRemarks");
64
			addKnownField("isPreferredName", "http://rs.gbif.org/terms/1.0/isPreferredName");
65
			addKnownField("verbatimEventDate", "http://rs.tdwg.org/dwc/terms/verbatimEventDate");
66
			addKnownField("verbatimLabel", "http://rs.gbif.org/terms/1.0/verbatimLabel");
67
			addKnownField("verbatimLongitude", "http://rs.tdwg.org/dwc/terms/verbatimLongitude");
68
			addKnownField("verbatimLatitude", "http://rs.tdwg.org/dwc/terms/verbatimLatitude");
69
		} catch (URISyntaxException e) {
70
			throw new RuntimeException(e);
71
		}
72
	}
73

    
74

    
75
//	@Override
76
//	public List<String> getHeaderList() {
77
//		String[] result = new String[]{"coreid",
78
//				"vernacularName",
79
//				"source",
80
//				"language",
81
//				"temporal",
82
//				"locationId",
83
//				"locality",
84
//				"countryCode",
85
//				"sex",
86
//				"lifeStage",
87
//				"locality",
88
//				"sex",
89
//				"isPlural",
90
//				"isPreferredName",
91
//				"organismPart",
92
//				"taxonRemarks"
93
//		};
94
//		return Arrays.asList(result);
95
//	}
96

    
97

    
98
    @Override
99
    protected void doWrite(DwcaTaxExportState state, PrintWriter writer) {
100

    
101
		printId(getUuid(), writer, IS_FIRST, "coreid");
102

    
103
		print(vernacularName, writer, IS_NOT_FIRST, TermUri.DWC_VERNACULAR_NAME);
104
		print(source, writer, IS_NOT_FIRST, TermUri.DC_SOURCE);
105
		print(language, writer, IS_NOT_FIRST, TermUri.DC_LANGUAGE);
106
		print(temporal, writer, IS_NOT_FIRST, TermUri.DC_TEMPORAL);
107
		print(locationId, writer, IS_NOT_FIRST, TermUri.DWC_LOCATION_ID);
108
		print(locality, writer, IS_NOT_FIRST, TermUri.DWC_LOCALITY);
109
		print(countryCode, writer, IS_NOT_FIRST, TermUri.DWC_COUNTRY_CODE);
110
		print(getSex(sex), writer, IS_NOT_FIRST, TermUri.DWC_SEX);
111
		print(getLifeStage(lifeStage), writer, IS_NOT_FIRST, TermUri.DWC_LIFESTAGE);
112
		print(isPlural, writer, IS_NOT_FIRST, TermUri.GBIF_IS_PLURAL);
113
		print(isPreferredName, writer, IS_NOT_FIRST, TermUri.GBIF_IS_PREFERRED_NAME);
114
		print(organismPart, writer, IS_NOT_FIRST, TermUri.GBIF_ORGANISM_PART);
115
		print(taxonRemarks, writer, IS_NOT_FIRST, TermUri.DWC_TAXON_REMARKS);
116
		writer.println();
117
	}
118

    
119
	public String getVernacularName() {
120
		return vernacularName;
121
	}
122
	public void setVernacularName(String vernacularName) {
123
		this.vernacularName = vernacularName;
124
	}
125

    
126
	public String getTaxonRemarks() {
127
		return taxonRemarks;
128
	}
129
	public void setTaxonRemarks(String taxonRemarks) {
130
		this.taxonRemarks = taxonRemarks;
131
	}
132

    
133
	public Language getLanguage() {
134
		return language;
135
	}
136
	public void setLanguage(Language language) {
137
		this.language = language;
138
	}
139

    
140
	public String getSource() {
141
		return source;
142
	}
143
	public void setSource(String source) {
144
		this.source = source;
145
	}
146

    
147
	public String getTemporal() {
148
		return temporal;
149
	}
150
	public void setTemporal(String temporal) {
151
		this.temporal = temporal;
152
	}
153

    
154
	public String getLocality() {
155
		return locality;
156
	}
157
	@Override
158
    public void setLocality(String locality) {
159
		this.locality = locality;
160
	}
161

    
162
	public String getCountryCode() {
163
		return countryCode;
164
	}
165
	@Override
166
    public void setCountryCode(String countryCode) {
167
		this.countryCode = countryCode;
168
	}
169

    
170
	public DefinedTerm getLifeStage() {
171
		return lifeStage;
172
	}
173
	public void setLifeStage(DefinedTerm lifeStage) {
174
		this.lifeStage = lifeStage;
175
	}
176

    
177
	public String getLocationId() {
178
		return this.locationId.getId();
179
	}
180
	@Override
181
    public void setLocationId(NamedArea locationId) {
182
		this.locationId.setId(locationId);
183
	}
184

    
185
	public DefinedTerm getSex() {
186
		return sex;
187
	}
188
	public void setSex(DefinedTerm sex) {
189
		this.sex = sex;
190
	}
191

    
192
	public Boolean getIsPlural() {
193
		return isPlural;
194
	}
195
	public void setIsPlural(Boolean isPlural) {
196
		this.isPlural = isPlural;
197
	}
198

    
199
	public Boolean getIsPreferredName() {
200
		return isPreferredName;
201
	}
202
	public void setIsPreferredName(Boolean isPreferredName) {
203
		this.isPreferredName = isPreferredName;
204
	}
205

    
206
	public String getOrganismPart() {
207
		return organismPart;
208
	}
209
	public void setOrganismPart(String organismPart) {
210
		this.organismPart = organismPart;
211
	}
212

    
213
}
(31-31/33)