1
|
/**
|
2
|
* Copyright (C) 2018 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.vaadin.model.name;
|
10
|
|
11
|
import java.io.Serializable;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.common.RelationshipBase.Direction;
|
14
|
import eu.etaxonomy.cdm.model.name.NameRelationship;
|
15
|
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
|
16
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
17
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
18
|
|
19
|
/**
|
20
|
* @author a.kohlbecker
|
21
|
* @since May 3, 2018
|
22
|
*
|
23
|
*/
|
24
|
public class NameRelationshipDTO implements Serializable {
|
25
|
|
26
|
private static final long serialVersionUID = 966322755160849163L;
|
27
|
|
28
|
NameRelationship nameRel;
|
29
|
|
30
|
TaxonName otherName;
|
31
|
NameRelationshipType type;
|
32
|
Direction direction;
|
33
|
Reference citation;
|
34
|
String citationMicroReference;
|
35
|
String ruleConsidered;
|
36
|
|
37
|
/**
|
38
|
* @param entity
|
39
|
*/
|
40
|
public NameRelationshipDTO(Direction direction, NameRelationshipType type) {
|
41
|
this.direction = direction;
|
42
|
this.type = type;
|
43
|
}
|
44
|
|
45
|
public NameRelationshipDTO(Direction direction, NameRelationship nameRel) {
|
46
|
this.direction = direction;
|
47
|
otherName = otherNameFrom(nameRel);
|
48
|
type = nameRel.getType();
|
49
|
citation = nameRel.getCitation();
|
50
|
citationMicroReference = nameRel.getCitationMicroReference();
|
51
|
ruleConsidered = nameRel.getRuleConsidered();
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* @return
|
56
|
*/
|
57
|
protected TaxonName otherNameFrom(NameRelationship nameRel) {
|
58
|
return this.direction.equals(Direction.relatedTo) ? nameRel.getFromName() : nameRel.getToName();
|
59
|
}
|
60
|
|
61
|
protected TaxonName thisNameFrom(NameRelationship nameRel) {
|
62
|
return this.direction.equals(Direction.relatedTo) ? nameRel.getToName() : nameRel.getFromName();
|
63
|
}
|
64
|
|
65
|
/**
|
66
|
* @return the otherName
|
67
|
*/
|
68
|
public TaxonName getOtherName() {
|
69
|
return otherName;
|
70
|
}
|
71
|
|
72
|
/**
|
73
|
* @param otherName the otherName to set
|
74
|
*/
|
75
|
public void setOtherName(TaxonName otherName) {
|
76
|
this.otherName = otherName;
|
77
|
}
|
78
|
|
79
|
/**
|
80
|
* @return the type
|
81
|
*/
|
82
|
public NameRelationshipType getType() {
|
83
|
return type;
|
84
|
}
|
85
|
|
86
|
/**
|
87
|
* @param type the type to set
|
88
|
*/
|
89
|
public void setType(NameRelationshipType type) {
|
90
|
this.type = type;
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* @return the direction
|
95
|
*/
|
96
|
public Direction getDirection() {
|
97
|
return direction;
|
98
|
}
|
99
|
|
100
|
/**
|
101
|
* @param direction the direction to set
|
102
|
*/
|
103
|
public void setDirection(Direction direction) {
|
104
|
this.direction = direction;
|
105
|
}
|
106
|
|
107
|
/**
|
108
|
* @return the citation
|
109
|
*/
|
110
|
public Reference getCitation() {
|
111
|
return citation;
|
112
|
}
|
113
|
|
114
|
/**
|
115
|
* @param citation the citation to set
|
116
|
*/
|
117
|
public void setCitation(Reference citation) {
|
118
|
this.citation = citation;
|
119
|
}
|
120
|
|
121
|
/**
|
122
|
* @return the citationMicroReference
|
123
|
*/
|
124
|
public String getCitationMicroReference() {
|
125
|
return citationMicroReference;
|
126
|
}
|
127
|
|
128
|
/**
|
129
|
* @param citationMicroReference the citationMicroReference to set
|
130
|
*/
|
131
|
public void setCitationMicroReference(String citationMicroReference) {
|
132
|
this.citationMicroReference = citationMicroReference;
|
133
|
}
|
134
|
|
135
|
/**
|
136
|
* @return the ruleConsidered
|
137
|
*/
|
138
|
public String getRuleConsidered() {
|
139
|
return ruleConsidered;
|
140
|
}
|
141
|
|
142
|
/**
|
143
|
* @param ruleConsidered the ruleConsidered to set
|
144
|
*/
|
145
|
public void setRuleConsidered(String ruleConsidered) {
|
146
|
this.ruleConsidered = ruleConsidered;
|
147
|
}
|
148
|
|
149
|
|
150
|
|
151
|
}
|