Project

General

Profile

Download (5.01 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
package eu.etaxonomy.cdm.remote.dto.tdwg.voc;
10

    
11
import javax.xml.bind.annotation.XmlAccessType;
12
import javax.xml.bind.annotation.XmlAccessorType;
13
import javax.xml.bind.annotation.XmlElement;
14
import javax.xml.bind.annotation.XmlRootElement;
15
import javax.xml.bind.annotation.XmlType;
16

    
17
import eu.etaxonomy.cdm.remote.dto.tdwg.BaseThing;
18

    
19
@XmlAccessorType(XmlAccessType.FIELD)
20
@XmlType(name = "Relationship", propOrder = {
21
	    "fromTaxon",
22
	    "relationshipCategory",
23
	    "toTaxon"
24
})
25
@XmlRootElement(name = "Relationship",namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
26
public class Relationship extends BaseThing {
27
	
28
	@XmlElement(name = "fromTaxon", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
29
	private FromTaxon fromTaxon;
30
	
31
	@XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
32
	private RelationshipCategory relationshipCategory;
33
	
34
	@XmlElement(name = "toTaxon", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
35
	private ToTaxon toTaxon;
36
	
37
	public TaxonConcept getFromTaxon() {
38
		return fromTaxon != null ? fromTaxon.getTaxonConcept() : null;
39
	}
40

    
41
	public void setFromTaxon(TaxonConcept fromTaxon) {
42
		this.fromTaxon = new FromTaxon(fromTaxon);
43
	}
44

    
45
	public TaxonRelationshipTerm getRelationshipCategory() {
46
		return relationshipCategory != null ? relationshipCategory.getTaxonRelationshipTerm() : null;
47
	}
48

    
49
	public void setRelationshipCategory(TaxonRelationshipTerm relationshipCategory) {
50
		this.relationshipCategory = new RelationshipCategory(relationshipCategory,false);
51
	}
52
	
53
	public TaxonRelationshipTerm getRelationshipCategoryRelation() {
54
		return relationshipCategory != null ? relationshipCategory.getTaxonRelationshipTerm() : null;
55
	}
56

    
57
	public void setRelationshipCategoryRelation(TaxonRelationshipTerm relationshipCategory) {
58
		this.relationshipCategory = new RelationshipCategory(relationshipCategory,true);
59
	}
60

    
61
	public TaxonConcept getToTaxon() {
62
		return toTaxon != null ? toTaxon.getTaxonConcept() : null;
63
	}
64

    
65
	public void setToTaxon(TaxonConcept toTaxon) {
66
		this.toTaxon = new ToTaxon(toTaxon);
67
	}
68

    
69
	@XmlAccessorType(XmlAccessType.FIELD)
70
    @XmlType(name = "FromTaxon", propOrder = {
71
        "taxonConcept"
72
    })
73
	public static class FromTaxon extends LinkType {
74
		
75
		@XmlElement(name = "TaxonConcept", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
76
		private TaxonConcept taxonConcept;
77

    
78
		protected FromTaxon() {}
79
		
80
		protected FromTaxon(TaxonConcept taxonConcept) {
81
	        if(taxonConcept != null && taxonConcept.getIdentifier() != null) {
82
			    //this.setResource(taxonConcept.getIdentifier());
83
	        	this.setTaxonConcept(taxonConcept);
84
	        }
85
		}
86
		
87
		protected TaxonConcept getTaxonConcept() {
88
			return taxonConcept;
89
		}
90

    
91
		protected void setTaxonConcept(TaxonConcept taxonConcept) {
92
			this.taxonConcept = taxonConcept;
93
		}		
94
	}
95
	
96
	@XmlAccessorType(XmlAccessType.FIELD)
97
    @XmlType(name = "ToTaxon", propOrder = {
98
        "taxonConcept"
99
    })
100
	public static class ToTaxon extends LinkType {
101
		
102
		@XmlElement(name = "TaxonConcept", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
103
		private TaxonConcept taxonConcept;
104
		
105
		protected ToTaxon() {}
106
		
107
		protected ToTaxon(TaxonConcept taxonConcept) {
108
			    this.setTaxonConcept(taxonConcept);
109
		}
110

    
111
		protected TaxonConcept getTaxonConcept() {
112
			return taxonConcept;
113
		}
114

    
115
		protected void setTaxonConcept(TaxonConcept taxonConcept) {
116
			this.taxonConcept = taxonConcept;
117
		}
118
		
119
	}
120
	
121
	@XmlAccessorType(XmlAccessType.FIELD)
122
    @XmlType(name = "RelationshipCategory", propOrder = {
123
        "taxonRelationshipTerm"
124
    })
125
	public static class RelationshipCategory extends LinkType {
126
		
127
		@XmlElement(name = "TaxonRelationshipTerm", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
128
		private TaxonRelationshipTerm taxonRelationshipTerm;
129
		
130
		protected RelationshipCategory() {}
131
		
132
		protected RelationshipCategory(TaxonRelationshipTerm taxonRelationshipTerm, boolean useRelation) {
133
			if(useRelation) {
134
			    if(taxonRelationshipTerm != null) {
135
			    	if(taxonRelationshipTerm.getIdentifier() != null)
136
			    	this.setResource(taxonRelationshipTerm.getIdentifier());
137
			    }  else {
138
			    	this.taxonRelationshipTerm = taxonRelationshipTerm;
139
			    }
140
			} else {
141
				this.taxonRelationshipTerm = taxonRelationshipTerm;
142
			}
143
		}
144

    
145
		protected TaxonRelationshipTerm getTaxonRelationshipTerm() {
146
			return taxonRelationshipTerm;
147
		}
148

    
149
		protected void setTaxonRelationshipTerm(TaxonRelationshipTerm taxonRelationshipTerm) {
150
			this.taxonRelationshipTerm = taxonRelationshipTerm;
151
		}
152

    
153
		protected RelationshipCategory(TaxonRelationshipTerm taxonRelationshipTerm) {
154
			this.taxonRelationshipTerm = taxonRelationshipTerm;
155
		}
156
		
157
	}
158
}
(6-6/12)