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
;
13 import javax
.persistence
.Entity
;
14 import javax
.persistence
.Transient
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
19 import eu
.etaxonomy
.cdm
.model
.reference
.INomenclaturalReference
;
20 import eu
.etaxonomy
.cdm
.strategy
.cache
.name
.ZooNameDefaultCacheStrategy
;
21 import eu
.etaxonomy
.cdm
.strategy
.parser
.INonViralNameParser
;
22 import eu
.etaxonomy
.cdm
.strategy
.parser
.NonViralNameParserImpl
;
24 import javax
.xml
.bind
.annotation
.XmlAccessType
;
25 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
26 import javax
.xml
.bind
.annotation
.XmlElement
;
27 import javax
.xml
.bind
.annotation
.XmlRootElement
;
28 import javax
.xml
.bind
.annotation
.XmlType
;
31 * The taxon name class for animals.
35 * @created 08-Nov-2007 13:07:03
38 @XmlAccessorType(XmlAccessType
.FIELD
)
39 @XmlType(name
= "ZoologicalName", propOrder
= {
42 "originalPublicationYear"
44 @XmlRootElement(name
= "ZoologicalName")
46 public class ZoologicalName
extends NonViralName
{
48 static Logger logger
= Logger
.getLogger(ZoologicalName
.class);
50 //Name of the breed of an animal
51 @XmlElement(name
= "Breed")
54 @XmlElement(name
= "PublicationYear")
55 private Integer publicationYear
;
57 @XmlElement(name
= "OriginalPublicationYear")
58 private Integer originalPublicationYear
;
60 static private INonViralNameParser nameParser
= new NonViralNameParserImpl();
63 // ************* CONSTRUCTORS *************/
65 * Class constructor: creates a new zoological taxon name instance
66 * only containing the {@link eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy default cache strategy}.
68 * @see #ZoologicalName(Rank, HomotypicalGroup)
69 * @see #ZoologicalName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
70 * @see eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy
72 protected ZoologicalName() {
73 this.cacheStrategy
= ZooNameDefaultCacheStrategy
.NewInstance();
77 * Class constructor: creates a new zoological taxon name instance
78 * only containing its {@link common.Rank rank},
79 * its {@link HomotypicalGroup homotypical group} and
80 * the {@link eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy default cache strategy}.
81 * The new zoological taxon name instance will be also added to the set of
82 * zoological taxon names belonging to this homotypical group.
84 * @param rank the rank to be assigned to this zoological taxon name
85 * @param homotypicalGroup the homotypical group to which this zoological taxon name belongs
86 * @see #ZoologicalName()
87 * @see #ZoologicalName(Rank, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
88 * @see eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy
90 protected ZoologicalName(Rank rank
, HomotypicalGroup homotypicalGroup
) {
91 super(rank
, homotypicalGroup
);
92 this.cacheStrategy
= ZooNameDefaultCacheStrategy
.NewInstance();
96 * Class constructor: creates a new zoological taxon name instance
97 * containing its {@link common.Rank rank},
98 * its {@link HomotypicalGroup homotypical group},
99 * its scientific name components, its {@link agent.TeamOrPersonBase author(team)},
100 * its {@link reference.INomenclaturalReference nomenclatural reference} and
101 * the {@link eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy default cache strategy}.
102 * The new zoological taxon name instance will be also added to the set of
103 * zoological taxon names belonging to this homotypical group.
105 * @param rank the rank to be assigned to this zoological taxon name
106 * @param genusOrUninomial the string for this zoological taxon name
107 * if its rank is genus or higher or for the genus part
108 * if its rank is lower than genus
109 * @param infraGenericEpithet the string for the first epithet of
110 * this zoological taxon name if its rank is lower than genus
111 * and higher than species aggregate
112 * @param specificEpithet the string for the first epithet of
113 * this zoological taxon name if its rank is species aggregate or lower
114 * @param infraSpecificEpithet the string for the second epithet of
115 * this zoological taxon name if its rank is lower than species
116 * @param combinationAuthorTeam the author or the team who published this zoological taxon name
117 * @param nomenclaturalReference the nomenclatural reference where this zoological taxon name was published
118 * @param nomenclMicroRef the string with the details for precise location within the nomenclatural reference
119 * @param homotypicalGroup the homotypical group to which this zoological taxon name belongs
120 * @see #ZoologicalName()
121 * @see #ZoologicalName(Rank, HomotypicalGroup)
122 * @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
123 * @see eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy
124 * @see eu.etaxonomy.cdm.strategy.cache.INonViralNameCacheStrategy
125 * @see eu.etaxonomy.cdm.strategy.cache.IIdentifiableEntityCacheStrategy
127 protected ZoologicalName (Rank rank
, String genusOrUninomial
, String infraGenericEpithet
, String specificEpithet
, String infraSpecificEpithet
, TeamOrPersonBase combinationAuthorTeam
, INomenclaturalReference nomenclaturalReference
, String nomenclMicroRef
, HomotypicalGroup homotypicalGroup
) {
128 super(rank
, genusOrUninomial
, infraGenericEpithet
, specificEpithet
, infraSpecificEpithet
, combinationAuthorTeam
, nomenclaturalReference
, nomenclMicroRef
, homotypicalGroup
);
129 this.cacheStrategy
= ZooNameDefaultCacheStrategy
.NewInstance();
133 //********* METHODS **************************************/
136 * Creates a new zoological taxon name instance
137 * only containing its {@link common.Rank rank} and
138 * the {@link eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy default cache strategy}.
140 * @param rank the rank to be assigned to this zoological taxon name
141 * @see #ZoologicalName(Rank, HomotypicalGroup)
142 * @see #NewInstance(Rank, HomotypicalGroup)
143 * @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
144 * @see eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy
146 public static ZoologicalName
NewInstance(Rank rank
){
147 return new ZoologicalName(rank
, null);
151 * Creates a new zoological taxon name instance
152 * only containing its {@link common.Rank rank},
153 * its {@link HomotypicalGroup homotypical group} and
154 * the {@link eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy default cache strategy}.
155 * The new zoological taxon name instance will be also added to the set of
156 * zoological taxon names belonging to this homotypical group.
158 * @param rank the rank to be assigned to this zoological taxon name
159 * @param homotypicalGroup the homotypical group to which this zoological taxon name belongs
160 * @see #NewInstance(Rank)
161 * @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
162 * @see #ZoologicalName(Rank, HomotypicalGroup)
163 * @see eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy
165 public static ZoologicalName
NewInstance(Rank rank
, HomotypicalGroup homotypicalGroup
){
166 return new ZoologicalName(rank
, homotypicalGroup
);
169 * Creates a new zoological taxon name instance
170 * containing its {@link common.Rank rank},
171 * its {@link HomotypicalGroup homotypical group},
172 * its scientific name components, its {@link agent.TeamOrPersonBase author(team)},
173 * its {@link reference.INomenclaturalReference nomenclatural reference} and
174 * the {@link eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy default cache strategy}.
175 * The new zoological taxon name instance will be also added to the set of
176 * zoological taxon names belonging to this homotypical group.
178 * @param rank the rank to be assigned to this zoological taxon name
179 * @param genusOrUninomial the string for this zoological taxon name
180 * if its rank is genus or higher or for the genus part
181 * if its rank is lower than genus
182 * @param infraGenericEpithet the string for the first epithet of
183 * this zoological taxon name if its rank is lower than genus
184 * and higher than species aggregate
185 * @param specificEpithet the string for the first epithet of
186 * this zoological taxon name if its rank is species aggregate or lower
187 * @param infraSpecificEpithet the string for the second epithet of
188 * this zoological taxon name if its rank is lower than species
189 * @param combinationAuthorTeam the author or the team who published this zoological taxon name
190 * @param nomenclaturalReference the nomenclatural reference where this zoological taxon name was published
191 * @param nomenclMicroRef the string with the details for precise location within the nomenclatural reference
192 * @param homotypicalGroup the homotypical group to which this zoological taxon name belongs
193 * @see #NewInstance(Rank)
194 * @see #NewInstance(Rank, HomotypicalGroup)
195 * @see #ZoologicalName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
196 * @see eu.etaxonomy.cdm.strategy.cache.ZooNameDefaultCacheStrategy
198 public static ZoologicalName
NewInstance(Rank rank
, String genusOrUninomial
, String infraGenericEpithet
, String specificEpithet
, String infraSpecificEpithet
, TeamOrPersonBase combinationAuthorTeam
, INomenclaturalReference nomenclaturalReference
, String nomenclMicroRef
, HomotypicalGroup homotypicalGroup
) {
199 return new ZoologicalName(rank
, genusOrUninomial
, infraGenericEpithet
, specificEpithet
, infraSpecificEpithet
, combinationAuthorTeam
, nomenclaturalReference
, nomenclMicroRef
, homotypicalGroup
);
204 * Returns a zoological taxon name based on parsing a string representing
205 * all elements (according to the ICZN) of a zoological taxon name (where
206 * the scientific name is an uninomial) including authorship but without
207 * nomenclatural reference.
209 * @param fullNameString the string to be parsed
210 * @return the new zoological taxon name
212 public static ZoologicalName
PARSED_NAME(String fullNameString
){
213 return PARSED_NAME(fullNameString
, Rank
.GENUS());
217 * Returns a zoological taxon name based on parsing a string representing
218 * all elements (according to the ICZN) of a zoological taxon name including
219 * authorship but without nomenclatural reference. The parsing result
220 * depends on the given rank of the zoological taxon name to be created.
222 * @param fullNameString the string to be parsed
223 * @param rank the rank of the taxon name
224 * @return the new zoological taxon name
226 public static ZoologicalName
PARSED_NAME(String fullNameString
, Rank rank
){
227 if (nameParser
== null){
228 nameParser
= new NonViralNameParserImpl();
230 return (ZoologicalName
)nameParser
.parseFullName(fullNameString
, NomenclaturalCode
.ICZN(), rank
);
234 * Returns the {@link NomenclaturalCode nomenclatural code} that governs
235 * the construction of this zoological taxon name, that is the
236 * International Code of Zoological Nomenclature. This method overrides
237 * the getNomeclaturalCode method from {@link NonViralName#getNomeclaturalCode() NonViralName}.
239 * @return the nomenclatural code for animals
240 * @see NonViralName#isCodeCompliant()
241 * @see TaxonNameBase#getHasProblem()
245 public NomenclaturalCode
getNomenclaturalCode(){
246 return NomenclaturalCode
.ICZN();
249 /* ***************** GETTER / SETTER ***************************/
252 * Returns the breed name string for this animal (zoological taxon name).
254 * @return the string containing the breed name for this zoological taxon name
256 public String
getBreed(){
262 public void setBreed(String breed
){
267 * Returns the publication year (as an integer) for this zoological taxon
268 * name. If the publicationYear attribute is null and a nomenclatural
269 * reference exists the year could be computed from the
270 * {@link reference.INomenclaturalReference#getYear() nomenclatural reference}.
272 * @return the integer representing the publication year for this zoological taxon name
273 * @see #getOriginalPublicationYear()
275 public Integer
getPublicationYear() {
276 return publicationYear
;
279 * @see #getPublicationYear()
281 public void setPublicationYear(Integer publicationYear
) {
282 this.publicationYear
= publicationYear
;
286 * Returns the publication year (as an integer) of the original validly
287 * published species epithet for this zoological taxon name. This only
288 * applies for zoological taxon names that are no {@link TaxonNameBase#isOriginalCombination() original combinations}.
289 * If the originalPublicationYear attribute is null the year could be taken
290 * from the publication year of the corresponding original name (basionym)
291 * or from the {@link reference.INomenclaturalReference#getYear() nomenclatural reference} of the basionym
294 * @return the integer representing the publication year of the original
295 * species epithet corresponding to this zoological taxon name
296 * @see #getPublicationYear()
298 public Integer
getOriginalPublicationYear() {
299 return originalPublicationYear
;
302 * @see #getOriginalPublicationYear()
304 public void setOriginalPublicationYear(Integer originalPublicationYear
) {
305 this.originalPublicationYear
= originalPublicationYear
;