(no commit message)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / name / NameTypeDesignation.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
13 import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
14 import eu.etaxonomy.cdm.model.reference.ReferenceBase;
15
16 import org.apache.log4j.Logger;
17 import org.hibernate.annotations.Cascade;
18 import org.hibernate.annotations.CascadeType;
19
20 import java.util.*;
21 import javax.persistence.*;
22
23 /**
24 * Only taxon names which have a rank above "species" are typified by other
25 * taxon names of lower rank. A type of a name of a genus or of any
26 * subdivision of a genus can only be the name of a species. A type of a name
27 * of a family or of any subdivision of a family is the name of a genus
28 * (or resolving it: a name of a species typifying this genus).
29 * Moreover the mentioned taxon name type may be rejected or conserved.
30 * Depending on the date of publication, the same designation could have the
31 * rejected status according to one reference and later have the conserved
32 * status according to another reference.
33 *
34 * @author m.doering
35 * @version 1.0
36 * @created 08-Nov-2007 13:06:38
37 */
38 @Entity
39 public class NameTypeDesignation extends ReferencedEntityBase {
40 static Logger logger = Logger.getLogger(NameTypeDesignation.class);
41 private boolean isRejectedType;
42 private boolean isConservedType;
43 private TaxonNameBase typeSpecies;
44 private TaxonNameBase typifiedName;
45
46 protected NameTypeDesignation(TaxonNameBase typifiedName, TaxonNameBase typeSpecies, ReferenceBase citation, String citationMicroReference,
47 String originalNameString, boolean isRejectedType, boolean isConservedType) {
48 super(citation, citationMicroReference, originalNameString);
49 this.setTypeSpecies(typeSpecies);
50 this.setTypifiedName(typifiedName);
51 // the typified name has to be part of the same homotypical group as the type species
52 typifiedName.setHomotypicalGroup(typeSpecies.getHomotypicalGroup());
53 this.isRejectedType = isRejectedType;
54 this.isConservedType = isConservedType;
55 }
56
57
58 @Cascade({CascadeType.SAVE_UPDATE})
59 public TaxonNameBase getTypifiedName() {
60 return typifiedName;
61 }
62 private void setTypifiedName(TaxonNameBase typifiedName) {
63 this.typifiedName = typifiedName;
64 typifiedName.nameTypeDesignations.add(this);
65 }
66
67
68 @ManyToOne
69 @Cascade({CascadeType.SAVE_UPDATE})
70 public TaxonNameBase getTypeSpecies(){
71 return this.typeSpecies;
72 }
73 private void setTypeSpecies(TaxonNameBase typeSpecies){
74 this.typeSpecies = typeSpecies;
75 }
76
77 public boolean isRejectedType(){
78 return this.isRejectedType;
79 }
80 public void setRejectedType(boolean isRejectedType){
81 this.isRejectedType = isRejectedType;
82 }
83
84 public boolean isConservedType(){
85 return this.isConservedType;
86 }
87 public void setConservedType(boolean isConservedType){
88 this.isConservedType = isConservedType;
89 }
90
91 }