introducing the QueryFactory for to modularize lucene query building
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / name / BacterialName.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 javax.persistence.Entity;
14 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElement;
17 import javax.xml.bind.annotation.XmlRootElement;
18 import javax.xml.bind.annotation.XmlType;
19
20 import org.apache.log4j.Logger;
21 import org.hibernate.envers.Audited;
22 import org.hibernate.search.annotations.Field;
23 import org.hibernate.search.annotations.Index;
24 import org.hibernate.search.annotations.Indexed;
25 import org.springframework.beans.factory.annotation.Configurable;
26
27 import eu.etaxonomy.cdm.strategy.cache.name.BacterialNameDefaultCacheStrategy;
28
29 /**
30 * The taxon name class for bacteria.
31 * <P>
32 * This class corresponds to: NameBacterial according to the ABCD schema.
33 *
34 * @author m.doering
35 * @version 1.0
36 * @created 08-Nov-2007 13:06:11
37 */
38 @XmlAccessorType(XmlAccessType.FIELD)
39 @XmlType(name = "", propOrder = {
40 "subGenusAuthorship",
41 "nameApprobation"
42 })
43 @XmlRootElement(name = "BacterialName")
44 @Entity
45 @Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
46 @Audited
47 @Configurable
48 public class BacterialName extends NonViralName<BacterialName> implements Cloneable{
49 private static final long serialVersionUID = -7641841279209976443L;
50 @SuppressWarnings("unused")
51 private static final Logger logger = Logger.getLogger(BacterialName.class);
52
53 //Author team and year of the subgenus name
54 @XmlElement(name = "SubGenusAuthorship")
55 @Field(index=Index.TOKENIZED)
56 private String subGenusAuthorship;
57
58 //Approbation of name according to approved list, validation list, or validly published, paper in IJSB after 1980
59 @XmlElement(name = "NameApprobation")
60 @Field(index=Index.TOKENIZED)
61 private String nameApprobation;
62
63 // ************* CONSTRUCTORS *************/
64
65 protected BacterialName(){
66 super();
67 this.cacheStrategy = BacterialNameDefaultCacheStrategy.NewInstance();
68 }
69
70 /**
71 * Class constructor: creates a new bacterial taxon name instance
72 * only containing its {@link Rank rank},
73 * its {@link HomotypicalGroup homotypical group} and
74 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
75 * The new bacterial taxon name instance will be also added to the set of
76 * bacterial taxon names belonging to this homotypical group.
77 *
78 * @param rank the rank to be assigned to <i>this</i> bacterial taxon name
79 * @param homotypicalGroup the homotypical group to which <i>this</i> bacterial taxon name belongs
80 * @see #NewInstance(Rank)
81 * @see #NewInstance(Rank, HomotypicalGroup)
82 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
83 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
84 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
85 */
86 protected BacterialName(Rank rank, HomotypicalGroup homotypicalGroup) {
87 super(rank, homotypicalGroup);
88 this.cacheStrategy = BacterialNameDefaultCacheStrategy.NewInstance();
89 }
90
91 //********* METHODS **************************************/
92 /**
93 * Creates a new bacterial taxon name instance
94 * only containing its {@link Rank rank} and
95 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
96 *
97 * @param rank the rank to be assigned to <i>this</i> bacterial taxon name
98 * @see #NewInstance(Rank, HomotypicalGroup)
99 * @see #BacterialName(Rank, HomotypicalGroup)
100 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
101 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
102 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
103 */
104 public static BacterialName NewInstance(Rank rank){
105 return new BacterialName(rank, null);
106 }
107
108 /**
109 * Creates a new bacterial taxon name instance
110 * only containing its {@link Rank rank},
111 * its {@link HomotypicalGroup homotypical group} and
112 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
113 * The new bacterial taxon name instance will be also added to the set of
114 * bacterial taxon names belonging to this homotypical group.
115 *
116 * @param rank the rank to be assigned to <i>this</i> bacterial taxon name
117 * @param homotypicalGroup the homotypical group to which <i>this</i> bacterial taxon name belongs
118 * @see #NewInstance(Rank)
119 * @see #BacterialName(Rank, HomotypicalGroup)
120 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
121 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
122 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
123 */
124 public static BacterialName NewInstance(Rank rank, HomotypicalGroup homotypicalGroup){
125 return new BacterialName(rank, homotypicalGroup);
126 }
127
128 /**
129 * Returns the string containing the authorship with the year and details
130 * of the reference in which the subgenus included in the scientific name
131 * of <i>this</i> bacterial taxon name was published.
132 * For instance if the bacterial taxon name is
133 * 'Bacillus (subgen. Aerobacillus Donker 1926, 128) polymyxa' the subgenus
134 * authorship string is 'Donker 1926, 128'.
135 *
136 * @return the string containing the complete subgenus' authorship
137 * included in <i>this</i> bacterial taxon name
138 */
139 public String getSubGenusAuthorship(){
140 return this.subGenusAuthorship;
141 }
142
143 /**
144 * @see #getSubGenusAuthorship()
145 */
146 public void setSubGenusAuthorship(String subGenusAuthorship){
147 this.subGenusAuthorship = subGenusAuthorship;
148 }
149
150 /**
151 * Returns the string representing the reason for the approbation of <i>this</i>
152 * bacterial taxon name. Bacterial taxon names are valid or approved
153 * according to:
154 * <ul>
155 * <li>the approved list, c.f.r. IJSB 1980 (AL)
156 * <li>the validation list, in IJSB after 1980 (VL)
157 * </ul>
158 * or
159 * <ul>
160 * <li>are validly published as paper in IJSB after 1980 (VP).
161 * </ul>
162 * IJSB is the acronym for International Journal of Systematic Bacteriology.
163 *
164 * @return the string with the source of the approbation for <i>this</i> bacterial taxon name
165 */
166 public String getNameApprobation(){
167 return this.nameApprobation;
168 }
169
170 /**
171 * @see #getNameApprobation()
172 */
173 public void setNameApprobation(String nameApprobation){
174 this.nameApprobation = nameApprobation;
175 }
176
177
178 /**
179 * Returns the {@link NomenclaturalCode nomenclatural code} that governs
180 * the construction of <i>this</i> bacterial taxon name, that is the
181 * International Code of Nomenclature of Bacteria. This method overrides
182 * the getNomeclaturalCode method from {@link NonViralName NonViralName}.
183 *
184 * @return the nomenclatural code for bacteria
185 * @see NonViralName#isCodeCompliant()
186 * @see TaxonNameBase#getHasProblem()
187 */
188 @Override
189 public NomenclaturalCode getNomenclaturalCode(){
190 return NomenclaturalCode.ICNB;
191
192 }
193
194 //*********************** CLONE ********************************************************/
195
196 /**
197 * Clones <i>this</i> bacterial name. This is a shortcut that enables to create
198 * a new instance that differs only slightly from <i>this</i> bacterial name by
199 * modifying only some of the attributes.
200 *
201 * @see eu.etaxonomy.cdm.model.name.NonViralName#clone()
202 * @see java.lang.Object#clone()
203 */
204 @Override
205 public Object clone() {
206 BacterialName result = (BacterialName)super.clone();
207 //no changes to: subGenusAuthorship, nameApprobation
208 return result;
209 }
210
211 }