Project

General

Profile

Download (4.44 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
import java.util.Set;
14

    
15
import org.apache.log4j.Logger;
16

    
17
import eu.etaxonomy.cdm.io.stream.terms.TermUri;
18
import eu.etaxonomy.cdm.model.agent.AgentBase;
19
import eu.etaxonomy.cdm.model.common.Language;
20
import eu.etaxonomy.cdm.model.description.Feature;
21
import eu.etaxonomy.cdm.model.media.Rights;
22

    
23
/**
24
 * @author a.mueller
25
 \* @since 20.04.2011
26
 *
27
 */
28
public class DwcaDescriptionRecord extends DwcaRecordBase {
29
	@SuppressWarnings("unused")
30
	private static final Logger logger = Logger.getLogger(DwcaDescriptionRecord.class);
31

    
32
	private String description;
33
	private Feature type;
34
	private String source;
35
	private Language language;
36
	private AgentBase<?> creator;
37
	private AgentBase<?> contributor;
38
	private String audience;
39
	private Set<Rights> license;
40
	private AgentBase<?> rightsHolder;
41

    
42

    
43
	public DwcaDescriptionRecord(DwcaMetaDataRecord metaDataRecord, DwcaTaxExportConfigurator config){
44
		super(metaDataRecord, config);
45
	}
46

    
47
	@Override
48
    protected void registerKnownFields(){
49
		try {
50
			addKnownField("description", "http://purl.org/dc/terms/description");
51
			addKnownField("type", "http://purl.org/dc/terms/type");
52
			addKnownField("source", "http://purl.org/dc/terms/source");
53
			addKnownField("language", "http://purl.org/dc/terms/language");
54
			addKnownField("creator", "http://purl.org/dc/terms/creator");
55
			addKnownField("contributor", "http://purl.org/dc/terms/contributor");
56
			addKnownField("audience", "http://purl.org/dc/terms/audience");
57
			addKnownField("license", "http://purl.org/dc/terms/license");
58
			addKnownField("rightsHolder", "http://purl.org/dc/terms/rightsHolder");
59

    
60
		} catch (URISyntaxException e) {
61
			throw new RuntimeException(e);
62
		}
63
	}
64

    
65
//	@Override
66
//	public List<String> getHeaderList() {
67
//		String[] result = new String[]{
68
//				"coreid",
69
//				"description",
70
//				"type",
71
//				"source",
72
//				"language",
73
//				"creator",
74
//				"contributor",
75
//				"audience",
76
//				"license",
77
//				"rightsHolder"};
78
//		return Arrays.asList(result);
79
//	}
80

    
81
    @Override
82
    protected void doWrite(DwcaTaxExportState state, PrintWriter writer) {
83

    
84
		printId(getUuid(), writer, IS_FIRST, "coreid");
85
		print(description, writer, IS_NOT_FIRST, TermUri.DC_DESCRIPTION);
86
		print(getFeature(type), writer, IS_NOT_FIRST, TermUri.DC_TYPE);
87
		print(source, writer, IS_NOT_FIRST, TermUri.DC_SOURCE);
88
		print(language, writer, IS_NOT_FIRST, TermUri.DC_LANGUAGE);
89
		print(creator, writer, IS_NOT_FIRST, TermUri.DC_CREATOR);
90
		print(contributor, writer, IS_NOT_FIRST, TermUri.DC_CONTRIBUTOR);
91
		print(audience, writer, IS_NOT_FIRST, TermUri.DC_AUDIENCE);
92
		print(license, writer, IS_NOT_FIRST, TermUri.DC_LICENSE);
93
		print(rightsHolder, writer, IS_NOT_FIRST, TermUri.DC_RIGHTS_HOLDER);
94
		writer.print(config.getLinesTerminatedBy());
95
	}
96

    
97
	public String getSource() {
98
		return source;
99
	}
100
	public void setSource(String source) {
101
		this.source = source;
102
	}
103

    
104
	public String getDescription() {
105
		return description;
106
	}
107

    
108

    
109
	public void setDescription(String description) {
110
		this.description = description;
111
	}
112

    
113

    
114
	public Feature getType() {
115
		return type;
116
	}
117

    
118

    
119
	public void setType(Feature type) {
120
		this.type = type;
121
	}
122

    
123

    
124
	public Language getLanguage() {
125
		return language;
126
	}
127

    
128

    
129
	public void setLanguage(Language language) {
130
		this.language = language;
131
	}
132

    
133

    
134
	public AgentBase<?> getCreator() {
135
		return creator;
136
	}
137

    
138

    
139
	public void setCreator(AgentBase<?> creator) {
140
		this.creator = creator;
141
	}
142

    
143

    
144
	public AgentBase<?> getContributor() {
145
		return contributor;
146
	}
147

    
148

    
149
	public void setContributor(AgentBase<?> contributor) {
150
		this.contributor = contributor;
151
	}
152

    
153

    
154
	public String getAudience() {
155
		return audience;
156
	}
157

    
158

    
159
	public void setAudience(String audience) {
160
		this.audience = audience;
161
	}
162

    
163

    
164
	public Set<Rights> getLicense() {
165
		return license;
166
	}
167

    
168

    
169
	public void setLicense(Set<Rights> license) {
170
		this.license = license;
171
	}
172

    
173

    
174
	public AgentBase<?> getRightsHolder() {
175
		return rightsHolder;
176
	}
177

    
178

    
179
	public void setRightsHolder(AgentBase<?> rightsHolder) {
180
		this.rightsHolder = rightsHolder;
181
	}
182

    
183

    
184

    
185
}
(3-3/33)