(no commit message)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / name / NameRelationship.java
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.model.name;
11
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
17 /**
18 * http://rs.tdwg.org/ontology/voc/TaxonName.rdf#NomenclaturalNote
19 * @author m.doering
20 * @version 1.0
21 * @created 08-Nov-2007 13:06:37
22 */
23 @Entity
24 public class NameRelationship extends RelationshipBase<TaxonNameBase, TaxonNameBase, NameRelationshipType> {
25 static Logger logger = Logger.getLogger(NameRelationship.class);
26 //The nomenclatural code rule considered. The article/note/recommendation in the code in question that is commented on in
27 //the note property.
28 private String ruleConsidered;
29 private NameRelationshipType type;
30
31 //for hibernate, don't use
32 @Deprecated
33 private NameRelationship(){
34 super();
35 }
36
37
38 /**
39 * creates a relationship between 2 names and adds this relationship object to the respective name relation sets
40 * @param toName
41 * @param fromName
42 * @param type
43 * @param ruleConsidered
44 */
45 protected NameRelationship(TaxonNameBase toName, TaxonNameBase fromName, NameRelationshipType type, String ruleConsidered) {
46 this(toName, fromName, type, null, null, ruleConsidered);
47 }
48
49 /**
50 * Constructor that adds immediately a relationship instance to both
51 * Creates a relationship between 2 names and adds this relationship object to the respective name relation sets
52 * @param toName
53 * @param fromName
54 * @param type
55 * @param citation
56 * @param citationMicroReference
57 * @param ruleConsidered
58 */
59 protected NameRelationship(TaxonNameBase toName, TaxonNameBase fromName, NameRelationshipType type, ReferenceBase citation, String citationMicroReference, String ruleConsidered) {
60 super(fromName, toName, type, citation, citationMicroReference);
61 this.setRuleConsidered(ruleConsidered);
62 }
63
64 @Transient
65 public TaxonNameBase getFromName(){
66 return super.getRelatedFrom();
67 }
68 private void setFromName(TaxonNameBase fromName){
69 super.setRelatedFrom(fromName);
70 }
71
72 @Transient
73 public TaxonNameBase getToName(){
74 return super.getRelatedTo();
75 }
76 private void setToName(TaxonNameBase toName){
77 super.setRelatedTo(toName);
78 }
79
80 public String getRuleConsidered(){
81 return this.ruleConsidered;
82 }
83 private void setRuleConsidered(String ruleConsidered){
84 this.ruleConsidered = ruleConsidered;
85 }
86
87 }