1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.io.dwca.out;
|
11
|
|
12
|
import java.io.PrintWriter;
|
13
|
import java.net.URISyntaxException;
|
14
|
import java.util.Set;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import org.apache.log4j.Logger;
|
18
|
|
19
|
import eu.etaxonomy.cdm.io.dwca.TermUri;
|
20
|
import eu.etaxonomy.cdm.model.common.Annotation;
|
21
|
|
22
|
/**
|
23
|
* @author a.mueller
|
24
|
* @date 20.04.2011
|
25
|
*
|
26
|
*/
|
27
|
public class DwcaResourceRelationRecord extends DwcaRecordBase {
|
28
|
@SuppressWarnings("unused")
|
29
|
private static final Logger logger = Logger.getLogger(DwcaResourceRelationRecord.class);
|
30
|
|
31
|
private DwcaId resourceRelationshipId;
|
32
|
private UUID relatedResourceId;
|
33
|
private String relationshipOfResource;
|
34
|
private String relationshipAccordingTo;
|
35
|
private String relationshipEstablishedDate;
|
36
|
private Set<Annotation> relationshipRemarks;
|
37
|
private String scientificName;
|
38
|
|
39
|
|
40
|
public DwcaResourceRelationRecord(DwcaMetaDataRecord metaDataRecord, DwcaTaxExportConfigurator config){
|
41
|
super(metaDataRecord, config);
|
42
|
resourceRelationshipId = new DwcaId(config);
|
43
|
}
|
44
|
|
45
|
/* (non-Javadoc)
|
46
|
* @see eu.etaxonomy.cdm.io.dwca.out.DwcaRecordBase#registerKnownFields()
|
47
|
*/
|
48
|
protected void registerKnownFields(){
|
49
|
try {
|
50
|
addKnownField("resourceRelationshipID", "http://rs.tdwg.org/dwc/terms/resourceRelationshipID");
|
51
|
addKnownField("relatedResourceID", "http://rs.tdwg.org/dwc/terms/relatedResourceID");
|
52
|
addKnownField("relationshipOfResource", "http://rs.tdwg.org/dwc/terms/relationshipOfResource");
|
53
|
addKnownField("relationshipAccordingTo", "http://rs.tdwg.org/dwc/terms/relationshipAccordingTo");
|
54
|
addKnownField("relationshipEstablishedDate", "http://rs.tdwg.org/dwc/terms/relationshipEstablishedDate");
|
55
|
addKnownField("relationshipRemarks", "http://rs.tdwg.org/dwc/terms/relationshipRemarks");
|
56
|
addKnownField("scientificName", "http://rs.tdwg.org/dwc/terms/scientificName");
|
57
|
|
58
|
} catch (URISyntaxException e) {
|
59
|
throw new RuntimeException(e);
|
60
|
}
|
61
|
}
|
62
|
|
63
|
// @Override
|
64
|
// public List<String> getHeaderList() {
|
65
|
// String[] result = new String[]{"coreid",
|
66
|
// "resourceRelationshipId",
|
67
|
// "relatedResourceId",
|
68
|
// "relationshipOfResource",
|
69
|
// "relationshipAccordingTo",
|
70
|
// "relationshipEstablishedDate",
|
71
|
// "relationshipRemarks",
|
72
|
// "scientificName"
|
73
|
// };
|
74
|
// return Arrays.asList(result);
|
75
|
// }
|
76
|
|
77
|
public void write(PrintWriter writer) {
|
78
|
printId(getUuid(), writer, IS_FIRST, "coreid");
|
79
|
print(getResourceRelationshipId(), writer, IS_NOT_FIRST, TermUri.DWC_RESOURCE_RELATIONSHIP_ID);
|
80
|
print(relatedResourceId, writer, IS_NOT_FIRST, TermUri.DWC_RELATED_RESOURCE_ID);
|
81
|
print(relationshipOfResource, writer, IS_NOT_FIRST, TermUri.DWC_RELATIONSHIP_OF_RESOURCE);
|
82
|
print(relationshipAccordingTo, writer, IS_NOT_FIRST, TermUri.DWC_RELATIONSHIP_ACCORDING_TO);
|
83
|
print(relationshipEstablishedDate, writer, IS_NOT_FIRST, TermUri.DWC_RELATIONSHIP_ESTABLISHED_DATE);
|
84
|
printNotes(relationshipRemarks, writer, IS_NOT_FIRST, TermUri.DWC_RELATIONSHIP_REMARKS);
|
85
|
print(scientificName, writer, IS_NOT_FIRST, TermUri.DWC_SCIENTIFIC_NAME);
|
86
|
writer.println();
|
87
|
}
|
88
|
|
89
|
public String getScientificName() {
|
90
|
return scientificName;
|
91
|
}
|
92
|
|
93
|
public void setScientificName(String scientificName) {
|
94
|
this.scientificName = scientificName;
|
95
|
}
|
96
|
|
97
|
public String getResourceRelationshipId() {
|
98
|
return resourceRelationshipId.getId();
|
99
|
}
|
100
|
|
101
|
public void setResourceRelationshipId(Integer resourceRelationshipId) {
|
102
|
this.resourceRelationshipId.setId(resourceRelationshipId);
|
103
|
}
|
104
|
public void setResourceRelationshipId(UUID resourceRelationshipId) {
|
105
|
this.resourceRelationshipId.setId(resourceRelationshipId);
|
106
|
}
|
107
|
|
108
|
public UUID getRelatedResourceId() {
|
109
|
return relatedResourceId;
|
110
|
}
|
111
|
|
112
|
public void setRelatedResourceId(UUID relatedResourceId) {
|
113
|
this.relatedResourceId = relatedResourceId;
|
114
|
}
|
115
|
|
116
|
public String getRelationshipOfResource() {
|
117
|
return relationshipOfResource;
|
118
|
}
|
119
|
|
120
|
public void setRelationshipOfResource(String relationshipOfResource) {
|
121
|
this.relationshipOfResource = relationshipOfResource;
|
122
|
}
|
123
|
|
124
|
public String getRelationshipAccordingTo() {
|
125
|
return relationshipAccordingTo;
|
126
|
}
|
127
|
|
128
|
public void setRelationshipAccordingTo(String relationshipAccordingTo) {
|
129
|
this.relationshipAccordingTo = relationshipAccordingTo;
|
130
|
}
|
131
|
|
132
|
public String getRelatioshipEstablishedDate() {
|
133
|
return relationshipEstablishedDate;
|
134
|
}
|
135
|
|
136
|
public void setRelatioshipEstablishedDate(String relatioshipEstablishedDate) {
|
137
|
this.relationshipEstablishedDate = relatioshipEstablishedDate;
|
138
|
}
|
139
|
|
140
|
public Set<Annotation> getRelationshipRemarks() {
|
141
|
return relationshipRemarks;
|
142
|
}
|
143
|
|
144
|
public void setRelationshipRemarks(Set<Annotation> set) {
|
145
|
this.relationshipRemarks = set;
|
146
|
}
|
147
|
|
148
|
}
|