Project

General

Profile

Download (4.48 KB) Statistics
| Branch: | Tag: | Revision:
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.remote.dto.cdm;
11

    
12
import java.net.URI;
13
import java.net.URISyntaxException;
14
import java.util.HashSet;
15
import java.util.Iterator;
16
import java.util.List;
17
import java.util.Set;
18

    
19
import javax.xml.bind.annotation.XmlAccessType;
20
import javax.xml.bind.annotation.XmlAccessorType;
21
import javax.xml.bind.annotation.XmlElement;
22
import javax.xml.bind.annotation.XmlRootElement;
23
import javax.xml.bind.annotation.XmlTransient;
24
import javax.xml.bind.annotation.XmlType;
25

    
26
import eu.etaxonomy.cdm.remote.dto.tdwg.BaseThing;
27
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.Relationship;
28
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonConcept;
29
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonConcept.HasRelationship;
30

    
31
/**
32
 * This class is an RDF representation of the {@link eu.etaxonomy.cdm.remote.dto.namecatalogue.NameInformation NameInformation}
33
 *
34
 * @author c.mathew
35
 * @version 1.1.0
36
 * @since 25-Nov-2012
37
 */
38

    
39
@XmlAccessorType(XmlAccessType.FIELD)
40
@XmlType(name = "NameInformation", propOrder = {
41
		"scientificNameID",
42
		"nameComplete",
43
		"title",
44
		"rankString",
45
		"references",
46
		"typeStatus",
47
		"hasRelationships"
48
})
49
@XmlRootElement(name = "NameInformation", namespace = "http://cybertaxonomy.eu/cdm/ontology/voc/NameInformation#")
50
public class NameInformationRdf extends BaseThing {
51
	
52
	@XmlElement(namespace = "http://rs.tdwg.org/dwc/terms/")
53
	private String scientificNameID;
54
	
55
	@XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonName#")
56
	private String nameComplete;
57
	
58
	@XmlElement(namespace = "http://purl.org/dc/elements/1.1/")
59
	private String title;
60
	
61
	@XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonName#")
62
	private String rankString;	
63
	
64
	@XmlElement(namespace = "http://purl.org/dc/terms/")
65
	private String references;
66

    
67
	@XmlElement(namespace = "http://rs.tdwg.org/dwc/terms/")
68
	private List<String> typeStatus;
69
	
70

    
71
	@XmlElement(name = "hasRelationship", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
72
	private Set<HasRelationship> hasRelationships = null;
73
	
74
	@XmlTransient
75
	private Set<String> taxonUuids;
76
	
77
	
78
	public Set<String> getTaxonUuids() {
79
		return taxonUuids;
80
	}
81

    
82
	public void setTaxonUuids(Set<String> taxonUuids) {
83
		this.taxonUuids = taxonUuids;
84
		Set<Relationship> relationships = new HashSet<Relationship>();
85
		Iterator<String> itr = taxonUuids.iterator();
86
		while(itr.hasNext()) {
87
			String uuid = itr.next();			
88
			try {
89
				TaxonConcept tc = new TaxonConcept();
90
				tc.setIdentifier(new URI("urn:uuid:" + uuid));
91
				Relationship rel = new Relationship();
92
				rel.setToTaxon(tc);
93
				relationships.add(rel);
94
				
95
			} catch (URISyntaxException e) {
96
				// TODO Auto-generated catch block
97
				//e.printStackTrace();
98
			}
99
		}
100
		if(!relationships.isEmpty()) {
101
			setHasRelationship(relationships);
102
		}
103
	}
104

    
105
	public String getScientificNameID() {
106
		return scientificNameID;
107
	}
108
	
109
	public void setScientificNameID(String scientificNameID) {
110
		this.scientificNameID = scientificNameID;
111
	}
112
	
113
	public String getNameComplete() {
114
		return nameComplete;
115
	}
116

    
117
	public void setNameComplete(String nameComplete) {
118
		this.nameComplete = nameComplete;
119
	}
120

    
121
	public String getTitle() {
122
		return title;
123
	}
124

    
125
	public void setTitle(String title) {
126
		this.title = title;
127
	}
128

    
129
	public String getRankString() {
130
		return rankString;
131
	}
132

    
133
	public void setRankString(String rankString) {
134
		this.rankString = rankString;
135
	}
136
	
137
	public String getReferences() {
138
		return references;
139
	}
140

    
141
	public void setReferences(String references) {
142
		this.references = references;
143
	}
144
	
145
	public List<String> getTypeStatus() {
146
		return typeStatus;
147
	}
148

    
149
	public void setTypeStatus(List<String> typeStatus) {
150
		this.typeStatus = typeStatus;
151
	}
152

    
153
	public Set<Relationship> getHasRelationship() {
154
		if(hasRelationships != null) {
155
			Set<Relationship> relationships = new HashSet<Relationship>();
156
			for(HasRelationship hasRelationship : hasRelationships) {
157
				relationships.add(hasRelationship.getRelationship());
158
			}
159
			return relationships;
160
		} else {
161
			return null;
162
		}
163
	}
164

    
165
	public void setHasRelationship(Set<Relationship> relationships) {
166
		if(relationships != null) {
167
		  this.hasRelationships = new HashSet<HasRelationship>();
168
		  for(Relationship relationship : relationships) {
169
			hasRelationships.add( new HasRelationship(relationship));
170
		  }
171
		} else {
172
			hasRelationships = null;
173
		}
174
	}
175
}
    (1-1/1)