2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.name
;
12 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
;
13 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
14 import org
.apache
.log4j
.Logger
;
15 import javax
.persistence
.*;
16 import javax
.xml
.bind
.annotation
.XmlAccessType
;
17 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
18 import javax
.xml
.bind
.annotation
.XmlElement
;
19 import javax
.xml
.bind
.annotation
.XmlType
;
22 * The class representing a relationship between two {@link TaxonNameBase taxon names} according
23 * to the {@link NomenclaturalCode nomenclatural code} which governs both of them.
24 * This includes a {@link NameRelationshipType name relationship type} (for instance "later homonym" or
25 * "orthographic variant") and the article of the corresponding nomenclatural
26 * code on which the assignation of the relationship type is based.
30 * @created 08-Nov-2007 13:06:37
32 @XmlAccessorType(XmlAccessType
.FIELD
)
33 @XmlType(name
= "NameRelationship", propOrder
= {
38 public class NameRelationship
extends RelationshipBase
<TaxonNameBase
, TaxonNameBase
, NameRelationshipType
> {
40 static Logger logger
= Logger
.getLogger(NameRelationship
.class);
42 //The nomenclatural code rule considered. The article/note/recommendation in the code in question that is commented on in
44 @XmlElement(name
= "RuleConsidered")
45 private String ruleConsidered
;
47 @XmlElement(name
= "NameRelationshipType")
48 private NameRelationshipType type
;
50 //for hibernate, don't use
52 private NameRelationship(){
57 // ************* CONSTRUCTORS *************/
59 * Class constructor: creates a new name relationship instance with no
60 * reference and adds it to the respective
61 * {@link TaxonNameBase#getNameRelations() taxon name relation sets} of both involved names.
63 * @param toName the taxon name to be set as target for the new name relationship
64 * @param fromName the taxon name to be set as source for the new name relationship
65 * @param type the relationship type to be assigned to the new name relationship
66 * @param ruleConsidered the string indicating the article of the nomenclatural code for the new name relationship
67 * @see #NameRelationship(TaxonNameBase, TaxonNameBase, NameRelationshipType, ReferenceBase, String, String)
68 * @see TaxonNameBase#addNameRelationship(NameRelationship)
69 * @see TaxonNameBase#addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
70 * @see TaxonNameBase#addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
72 protected NameRelationship(TaxonNameBase toName
, TaxonNameBase fromName
, NameRelationshipType type
, String ruleConsidered
) {
73 this(toName
, fromName
, type
, null, null, ruleConsidered
);
77 * Class constructor: creates a new name relationship instance including
78 * its {@link reference.ReferenceBase reference source} and adds it to the respective
79 *{@link TaxonNameBase#getNameRelations() taxon name relation sets} of both involved names.
81 * @param toName the taxon name to be set as target for the new name relationship
82 * @param fromName the taxon name to be set as source for the new name relationship
83 * @param type the relationship type to be assigned to the new name relationship
84 * @param citation the reference source for the new name relationship
85 * @param citationMicroReference the string with the details describing the exact localisation within the reference
86 * @param ruleConsidered the string indicating the article of the nomenclatural code justifying the new name relationship
87 * @see #NameRelationship(TaxonNameBase, TaxonNameBase, NameRelationshipType, String)
88 * @see TaxonNameBase#addNameRelationship(NameRelationship)
89 * @see TaxonNameBase#addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
90 * @see TaxonNameBase#addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
92 protected NameRelationship(TaxonNameBase toName
, TaxonNameBase fromName
, NameRelationshipType type
, ReferenceBase citation
, String citationMicroReference
, String ruleConsidered
) {
93 super(fromName
, toName
, type
, citation
, citationMicroReference
);
94 this.setRuleConsidered(ruleConsidered
);
97 //********* METHODS **************************************/
100 * Returns the {@link TaxonNameBase taxon name} that plays the source role
101 * in this taxon name relationship.
104 * @see common.RelationshipBase#getRelatedFrom()
107 public TaxonNameBase
getFromName(){
108 return super.getRelatedFrom();
111 * @see #getFromName()
113 private void setFromName(TaxonNameBase fromName
){
114 super.setRelatedFrom(fromName
);
118 * Returns the {@link TaxonNameBase taxon name} that plays the target role
119 * in this taxon name relationship.
121 * @see #getFromName()
122 * @see common.RelationshipBase#getRelatedTo()
125 public TaxonNameBase
getToName(){
126 return super.getRelatedTo();
131 private void setToName(TaxonNameBase toName
){
132 super.setRelatedTo(toName
);
136 * Returns the nomenclatural code rule considered (that is the
137 * article/note/recommendation in the nomenclatural code ruling
138 * the {@link TaxonNameBase#getNomenclaturalCode() taxon name(s)}) of this
139 * nomenclatural status. The considered rule gives the reason why the
140 * {@link NomenclaturalStatusType nomenclatural status type} has been
141 * assigned to the {@link TaxonNameBase taxon name(s)}.
143 public String
getRuleConsidered(){
144 return this.ruleConsidered
;
148 * @see #getRuleConsidered()
150 public void setRuleConsidered(String ruleConsidered
){
151 this.ruleConsidered
= ruleConsidered
;