Revision 9dc896c9
Added by Andreas Müller almost 7 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NameRelationship.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.validation.annotation.NamesWithHomotypicRelationshipsMustBelongToSameGroup; |
33 | 33 |
|
34 | 34 |
/** |
35 |
* The class representing a relationship between two {@link TaxonNameBase taxon names} according
|
|
35 |
* The class representing a relationship between two {@link TaxonName taxon names} according |
|
36 | 36 |
* to the {@link NomenclaturalCode nomenclatural code} which governs both of them. |
37 | 37 |
* This includes a {@link NameRelationshipType name relationship type} (for instance "later homonym" or |
38 | 38 |
* "orthographic variant") and the article of the corresponding nomenclatural |
... | ... | |
59 | 59 |
@NamesWithHomotypicRelationshipsMustBelongToSameGroup(groups = Level3.class) |
60 | 60 |
@BasionymsMustShareEpithetsAndAuthors(groups = Level3.class) |
61 | 61 |
public class NameRelationship |
62 |
extends RelationshipBase<TaxonNameBase, TaxonNameBase, NameRelationshipType>
|
|
62 |
extends RelationshipBase<TaxonName, TaxonName, NameRelationshipType>
|
|
63 | 63 |
implements Cloneable{ |
64 | 64 |
private static final long serialVersionUID = -615987333520172043L; |
65 | 65 |
private static final Logger logger = Logger.getLogger(NameRelationship.class); |
... | ... | |
74 | 74 |
@XmlSchemaType(name = "IDREF") |
75 | 75 |
@ManyToOne(fetch=FetchType.LAZY) |
76 | 76 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
77 |
private TaxonNameBase relatedFrom;
|
|
77 |
private TaxonName relatedFrom; |
|
78 | 78 |
|
79 | 79 |
@XmlElement(name = "RelatedTo") |
80 | 80 |
@XmlIDREF |
81 | 81 |
@XmlSchemaType(name = "IDREF") |
82 | 82 |
@ManyToOne(fetch=FetchType.LAZY) |
83 | 83 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
84 |
private TaxonNameBase relatedTo;
|
|
84 |
private TaxonName relatedTo; |
|
85 | 85 |
|
86 | 86 |
@XmlElement(name = "Type") |
87 | 87 |
@XmlIDREF |
... | ... | |
102 | 102 |
/** |
103 | 103 |
* Class constructor: creates a new name relationship instance with no |
104 | 104 |
* reference and adds it to the respective |
105 |
* {@link TaxonNameBase#getNameRelations() taxon name relation sets} of both involved names.
|
|
105 |
* {@link TaxonName#getNameRelations() taxon name relation sets} of both involved names. |
|
106 | 106 |
* |
107 | 107 |
* @param toName the taxon name to be set as target for the new name relationship |
108 | 108 |
* @param fromName the taxon name to be set as source for the new name relationship |
109 | 109 |
* @param type the relationship type to be assigned to the new name relationship |
110 | 110 |
* @param ruleConsidered the string indicating the article of the nomenclatural code for the new name relationship |
111 |
* @see #NameRelationship(TaxonNameBase, TaxonNameBase, NameRelationshipType, Reference, String, String)
|
|
112 |
* @see TaxonNameBase#addNameRelationship(NameRelationship)
|
|
113 |
* @see TaxonNameBase#addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
|
|
114 |
* @see TaxonNameBase#addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
|
|
111 |
* @see #NameRelationship(TaxonName, TaxonName, NameRelationshipType, Reference, String, String)
|
|
112 |
* @see TaxonName#addNameRelationship(NameRelationship) |
|
113 |
* @see TaxonName#addRelationshipFromName(TaxonName, NameRelationshipType, String)
|
|
114 |
* @see TaxonName#addRelationshipToName(TaxonName, NameRelationshipType, String)
|
|
115 | 115 |
*/ |
116 |
protected NameRelationship(TaxonNameBase toName, TaxonNameBase fromName, NameRelationshipType type, String ruleConsidered) {
|
|
116 |
protected NameRelationship(TaxonName toName, TaxonName fromName, NameRelationshipType type, String ruleConsidered) {
|
|
117 | 117 |
this(toName, fromName, type, null, null, ruleConsidered); |
118 | 118 |
} |
119 | 119 |
|
120 | 120 |
/** |
121 | 121 |
* Class constructor: creates a new name relationship instance including |
122 | 122 |
* its {@link eu.etaxonomy.cdm.model.reference.Reference reference source} and adds it to the respective |
123 |
*{@link TaxonNameBase#getNameRelations() taxon name relation sets} of both involved names.
|
|
123 |
*{@link TaxonName#getNameRelations() taxon name relation sets} of both involved names. |
|
124 | 124 |
* |
125 | 125 |
* @param toName the taxon name to be set as target for the new name relationship |
126 | 126 |
* @param fromName the taxon name to be set as source for the new name relationship |
... | ... | |
128 | 128 |
* @param citation the reference source for the new name relationship |
129 | 129 |
* @param citationMicroReference the string with the details describing the exact localisation within the reference |
130 | 130 |
* @param ruleConsidered the string indicating the article of the nomenclatural code justifying the new name relationship |
131 |
* @see #NameRelationship(TaxonNameBase, TaxonNameBase, NameRelationshipType, String)
|
|
132 |
* @see TaxonNameBase#addNameRelationship(NameRelationship)
|
|
133 |
* @see TaxonNameBase#addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
|
|
134 |
* @see TaxonNameBase#addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
|
|
131 |
* @see #NameRelationship(TaxonName, TaxonName, NameRelationshipType, String)
|
|
132 |
* @see TaxonName#addNameRelationship(NameRelationship) |
|
133 |
* @see TaxonName#addRelationshipFromName(TaxonName, NameRelationshipType, String)
|
|
134 |
* @see TaxonName#addRelationshipToName(TaxonName, NameRelationshipType, String)
|
|
135 | 135 |
*/ |
136 |
protected NameRelationship(TaxonNameBase toName, TaxonNameBase fromName, NameRelationshipType type, Reference citation, String citationMicroReference, String ruleConsidered) {
|
|
136 |
protected NameRelationship(TaxonName toName, TaxonName fromName, NameRelationshipType type, Reference citation, String citationMicroReference, String ruleConsidered) {
|
|
137 | 137 |
super(fromName, toName, type, citation, citationMicroReference); |
138 | 138 |
this.setRuleConsidered(ruleConsidered); |
139 | 139 |
} |
... | ... | |
141 | 141 |
//********* METHODS **************************************/ |
142 | 142 |
|
143 | 143 |
/** |
144 |
* Returns the {@link TaxonNameBase taxon name} that plays the source role
|
|
144 |
* Returns the {@link TaxonName taxon name} that plays the source role |
|
145 | 145 |
* in <i>this</i> taxon name relationship. |
146 | 146 |
* |
147 | 147 |
* @see #getToName() |
148 | 148 |
* @see eu.etaxonomy.cdm.model.common.RelationshipBase#getRelatedFrom() |
149 | 149 |
*/ |
150 | 150 |
@Transient |
151 |
public TaxonNameBase getFromName(){
|
|
151 |
public TaxonName getFromName(){ |
|
152 | 152 |
return this.getRelatedFrom(); |
153 | 153 |
} |
154 | 154 |
|
155 | 155 |
/** |
156 | 156 |
* @see #getFromName() |
157 | 157 |
*/ |
158 |
void setFromName(TaxonNameBase fromName){
|
|
158 |
void setFromName(TaxonName fromName){ |
|
159 | 159 |
this.setRelatedFrom(fromName); |
160 | 160 |
} |
161 | 161 |
|
162 | 162 |
/** |
163 |
* Returns the {@link TaxonNameBase taxon name} that plays the target role
|
|
163 |
* Returns the {@link TaxonName taxon name} that plays the target role |
|
164 | 164 |
* in <i>this</i> taxon name relationship. |
165 | 165 |
* |
166 | 166 |
* @see #getFromName() |
167 | 167 |
* @see eu.etaxonomy.cdm.model.common.RelationshipBase#getRelatedTo() |
168 | 168 |
*/ |
169 | 169 |
@Transient |
170 |
public TaxonNameBase getToName(){
|
|
170 |
public TaxonName getToName(){ |
|
171 | 171 |
return this.getRelatedTo(); |
172 | 172 |
} |
173 | 173 |
|
174 | 174 |
/** |
175 | 175 |
* @see #getToName() |
176 | 176 |
*/ |
177 |
void setToName(TaxonNameBase toName){
|
|
177 |
void setToName(TaxonName toName){ |
|
178 | 178 |
this.setRelatedTo(toName); |
179 | 179 |
} |
180 | 180 |
|
... | ... | |
184 | 184 |
* the taxon name(s) of this nomenclatural status). |
185 | 185 |
* The considered rule gives the reason why the |
186 | 186 |
* {@link NomenclaturalStatusType nomenclatural status type} has been |
187 |
* assigned to the {@link TaxonNameBase taxon name(s)}.
|
|
187 |
* assigned to the {@link TaxonName taxon name(s)}. |
|
188 | 188 |
*/ |
189 | 189 |
public String getRuleConsidered(){ |
190 | 190 |
return this.ruleConsidered; |
... | ... | |
199 | 199 |
|
200 | 200 |
// for extra-package access to relatedFrom use getFromName instead |
201 | 201 |
@Override |
202 |
protected TaxonNameBase getRelatedFrom() {
|
|
202 |
protected TaxonName getRelatedFrom() { |
|
203 | 203 |
return relatedFrom; |
204 | 204 |
} |
205 | 205 |
|
206 | 206 |
// for extra-package access to relatedFrom use getToName instead |
207 | 207 |
@Override |
208 |
protected TaxonNameBase getRelatedTo() {
|
|
208 |
protected TaxonName getRelatedTo() { |
|
209 | 209 |
return relatedTo; |
210 | 210 |
} |
211 | 211 |
|
... | ... | |
215 | 215 |
} |
216 | 216 |
|
217 | 217 |
@Override |
218 |
protected void setRelatedFrom(TaxonNameBase relatedFrom) {
|
|
218 |
protected void setRelatedFrom(TaxonName relatedFrom) { |
|
219 | 219 |
this.relatedFrom = relatedFrom; |
220 | 220 |
} |
221 | 221 |
|
222 | 222 |
@Override |
223 |
protected void setRelatedTo(TaxonNameBase relatedTo) {
|
|
223 |
protected void setRelatedTo(TaxonName relatedTo) { |
|
224 | 224 |
this.relatedTo = relatedTo; |
225 | 225 |
} |
226 | 226 |
|
... | ... | |
238 | 238 |
* modifying only some of the attributes.<BR> |
239 | 239 |
* CAUTION: Cloning a relationship will not add the relationship to the according |
240 | 240 |
* {@link #relatedFrom} and {@link #relatedTo} objects. The method is meant to be used |
241 |
* mainly for internal purposes (e.g. used within {@link TaxonNameBase#clone()}
|
|
241 |
* mainly for internal purposes (e.g. used within {@link TaxonName#clone()} |
|
242 | 242 |
* |
243 | 243 |
* @see eu.etaxonomy.cdm.model.common.RelationshipBase#clone() |
244 | 244 |
* @see java.lang.Object#clone() |
Also available in: Unified diff
fix #6368 rename table and class TaxonNameBase