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
.FetchType
;
15 import javax
.persistence
.ManyToOne
;
16 import javax
.persistence
.Transient
;
17 import javax
.xml
.bind
.annotation
.XmlAccessType
;
18 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
19 import javax
.xml
.bind
.annotation
.XmlElement
;
20 import javax
.xml
.bind
.annotation
.XmlIDREF
;
21 import javax
.xml
.bind
.annotation
.XmlRootElement
;
22 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
23 import javax
.xml
.bind
.annotation
.XmlTransient
;
24 import javax
.xml
.bind
.annotation
.XmlType
;
26 import org
.apache
.log4j
.Logger
;
27 import org
.hibernate
.annotations
.Cascade
;
28 import org
.hibernate
.annotations
.CascadeType
;
29 import org
.hibernate
.annotations
.Target
;
30 import org
.hibernate
.envers
.Audited
;
31 import org
.hibernate
.search
.annotations
.Field
;
32 import org
.hibernate
.search
.annotations
.Fields
;
33 import org
.hibernate
.search
.annotations
.Index
;
34 import org
.hibernate
.search
.annotations
.Indexed
;
35 import org
.springframework
.beans
.factory
.annotation
.Configurable
;
37 import eu
.etaxonomy
.cdm
.model
.agent
.INomenclaturalAuthor
;
38 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
39 import eu
.etaxonomy
.cdm
.model
.reference
.INomenclaturalReference
;
40 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
41 import eu
.etaxonomy
.cdm
.strategy
.cache
.name
.INonViralNameCacheStrategy
;
42 import eu
.etaxonomy
.cdm
.strategy
.cache
.name
.NonViralNameDefaultCacheStrategy
;
45 * The taxon name class for all non viral taxa. Parenthetical authorship is derived
46 * from basionym relationship. The scientific name including author strings and
47 * maybe year can be stored as a string in the inherited {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache() titleCache} attribute.
48 * The year itself is an information obtained from the {@link eu.etaxonomy.cdm.model.reference.ReferenceBase#getYear() nomenclatural reference}.
49 * The scientific name string without author strings and year can be stored in the {@link #getNameCache() nameCache} attribute.
51 * This class corresponds partially to: <ul>
52 * <li> TaxonName according to the TDWG ontology
53 * <li> ScientificName and CanonicalName according to the TCS
54 * <li> ScientificName according to the ABCD schema
59 * @created 08-Nov-2007 13:06:39
61 @XmlAccessorType(XmlAccessType
.FIELD
)
62 @XmlType(name
= "NonViralName", propOrder
= {
65 "infraGenericEpithet",
67 "infraSpecificEpithet",
68 "combinationAuthorTeam",
69 "exCombinationAuthorTeam",
71 "exBasionymAuthorTeam",
73 "protectedAuthorshipCache",
76 @XmlRootElement(name
= "NonViralName")
78 @Indexed(index
= "eu.etaxonomy.cdm.model.name.TaxonNameBase")
81 public class NonViralName
<T
extends NonViralName
> extends TaxonNameBase
<T
, INonViralNameCacheStrategy
> {
83 private static final Logger logger
= Logger
.getLogger(NonViralName
.class);
85 @XmlElement(name
= "NameCache")
86 @Fields({@Field(index
= org
.hibernate
.search
.annotations
.Index
.TOKENIZED
),
87 @Field(name
= "nameCache_forSort", index
= org
.hibernate
.search
.annotations
.Index
.UN_TOKENIZED
)
89 private String nameCache
;
91 @XmlElement(name
= "GenusOrUninomial")
92 @Field(index
=Index
.TOKENIZED
)
93 private String genusOrUninomial
;
95 @XmlElement(name
= "InfraGenericEpithet")
96 @Field(index
=Index
.TOKENIZED
)
97 private String infraGenericEpithet
;
99 @XmlElement(name
= "SpecificEpithet")
100 @Field(index
=Index
.TOKENIZED
)
101 private String specificEpithet
;
103 @XmlElement(name
= "InfraSpecificEpithet")
104 @Field(index
=Index
.TOKENIZED
)
105 private String infraSpecificEpithet
;
107 @XmlElement(name
= "CombinationAuthorTeam", type
= TeamOrPersonBase
.class)
109 @XmlSchemaType(name
= "IDREF")
110 @ManyToOne(fetch
= FetchType
.LAZY
)
111 @Target(TeamOrPersonBase
.class)
112 @Cascade(CascadeType
.SAVE_UPDATE
)
113 private INomenclaturalAuthor combinationAuthorTeam
;
115 @XmlElement(name
= "ExCombinationAuthorTeam", type
= TeamOrPersonBase
.class)
117 @XmlSchemaType(name
= "IDREF")
118 @ManyToOne(fetch
= FetchType
.LAZY
)
119 @Target(TeamOrPersonBase
.class)
120 @Cascade(CascadeType
.SAVE_UPDATE
)
121 private INomenclaturalAuthor exCombinationAuthorTeam
;
123 @XmlElement(name
= "BasionymAuthorTeam", type
= TeamOrPersonBase
.class)
125 @XmlSchemaType(name
= "IDREF")
126 @ManyToOne(fetch
= FetchType
.LAZY
)
127 @Target(TeamOrPersonBase
.class)
128 @Cascade(CascadeType
.SAVE_UPDATE
)
129 private INomenclaturalAuthor basionymAuthorTeam
;
131 @XmlElement(name
= "ExBasionymAuthorTeam", type
= TeamOrPersonBase
.class)
133 @XmlSchemaType(name
= "IDREF")
134 @ManyToOne(fetch
= FetchType
.LAZY
)
135 @Target(TeamOrPersonBase
.class)
136 @Cascade(CascadeType
.SAVE_UPDATE
)
137 private INomenclaturalAuthor exBasionymAuthorTeam
;
139 @XmlElement(name
= "AuthorshipCache")
140 @Field(index
=Index
.TOKENIZED
)
141 private String authorshipCache
;
143 @XmlElement(name
= "ProtectedAuthorshipCache")
144 protected boolean protectedAuthorshipCache
;
146 @XmlElement(name
= "ProtectedNameCache")
147 protected boolean protectedNameCache
;
151 // protected INonViralNameCacheStrategy cacheStrategy;
153 // ************* CONSTRUCTORS *************/
155 //needed by hibernate
157 * Class constructor: creates a new non viral taxon name instance
158 * only containing the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
160 * @see #NonViralName(Rank, HomotypicalGroup)
161 * @see #NonViralName(Rank, String, String, String, String, TeamOrPersonBase, ReferenceBase, String, HomotypicalGroup)
162 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
163 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
164 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
166 protected NonViralName(){
168 setNameCacheStrategy();
172 * Class constructor: creates a new non viral taxon name instance
173 * only containing its {@link Rank rank},
174 * its {@link HomotypicalGroup homotypical group} and
175 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
176 * The new non viral taxon name instance will be also added to the set of
177 * non viral taxon names belonging to this homotypical group.
179 * @param rank the rank to be assigned to <i>this</i> non viral taxon name
180 * @param homotypicalGroup the homotypical group to which <i>this</i> non viral taxon name belongs
181 * @see #NonViralName()
182 * @see #NonViralName(Rank, String, String, String, String, TeamOrPersonBase, ReferenceBase, String, HomotypicalGroup)
183 * @see #NewInstance(Rank, HomotypicalGroup)
184 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
185 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
186 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
188 protected NonViralName(Rank rank
, HomotypicalGroup homotypicalGroup
) {
189 super(rank
, homotypicalGroup
);
190 setNameCacheStrategy();
193 * Class constructor: creates a new non viral taxon name instance
194 * containing its {@link Rank rank},
195 * its {@link HomotypicalGroup homotypical group},
196 * its scientific name components, its {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase author(team)},
197 * its {@link eu.etaxonomy.cdm.model.reference.ReferenceBase nomenclatural reference} and
198 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
199 * The new non viral taxon name instance will be also added to the set of
200 * non viral taxon names belonging to this homotypical group.
202 * @param rank the rank to be assigned to <i>this</i> non viral taxon name
203 * @param genusOrUninomial the string for <i>this</i> non viral taxon name
204 * if its rank is genus or higher or for the genus part
205 * if its rank is lower than genus
206 * @param infraGenericEpithet the string for the first epithet of
207 * <i>this</i> non viral taxon name if its rank is lower than genus
208 * and higher than species aggregate
209 * @param specificEpithet the string for the first epithet of
210 * <i>this</i> non viral taxon name if its rank is species aggregate or lower
211 * @param infraSpecificEpithet the string for the second epithet of
212 * <i>this</i> non viral taxon name if its rank is lower than species
213 * @param combinationAuthorTeam the author or the team who published <i>this</i> non viral taxon name
214 * @param nomenclaturalReference the nomenclatural reference where <i>this</i> non viral taxon name was published
215 * @param nomenclMicroRef the string with the details for precise location within the nomenclatural reference
216 * @param homotypicalGroup the homotypical group to which <i>this</i> non viral taxon name belongs
217 * @see #NonViralName()
218 * @see #NonViralName(Rank, HomotypicalGroup)
219 * @see #NewInstance(Rank, HomotypicalGroup)
220 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
221 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
222 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
224 protected NonViralName(Rank rank
, String genusOrUninomial
, String infraGenericEpithet
, String specificEpithet
, String infraSpecificEpithet
, TeamOrPersonBase combinationAuthorTeam
, INomenclaturalReference nomenclaturalReference
, String nomenclMicroRef
, HomotypicalGroup homotypicalGroup
) {
225 super(rank
, homotypicalGroup
);
226 setNameCacheStrategy();
227 setGenusOrUninomial(genusOrUninomial
);
228 setInfraGenericEpithet (infraGenericEpithet
);
229 setSpecificEpithet(specificEpithet
);
230 setInfraSpecificEpithet(infraSpecificEpithet
);
231 setCombinationAuthorTeam(combinationAuthorTeam
);
232 setNomenclaturalReference((ReferenceBase
)nomenclaturalReference
);
233 this.setNomenclaturalMicroReference(nomenclMicroRef
);
236 //********* METHODS **************************************/
238 * Creates a new non viral taxon name instance
239 * only containing its {@link common.Rank rank} and
240 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
242 * @param rank the rank to be assigned to <i>this</i> non viral taxon name
243 * @see #NewInstance(Rank, HomotypicalGroup)
244 * @see #NonViralName(Rank, HomotypicalGroup)
245 * @see #NonViralName()
246 * @see #NonViralName(Rank, String, String, String, String, TeamOrPersonBase, ReferenceBase, String, HomotypicalGroup)
247 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
248 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
249 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
251 public static NonViralName
NewInstance(Rank rank
){
252 return new NonViralName(rank
, null);
256 * Creates a new non viral taxon name instance
257 * only containing its {@link common.Rank rank},
258 * its {@link HomotypicalGroup homotypical group} and
259 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
260 * The new non viral taxon name instance will be also added to the set of
261 * non viral taxon names belonging to this homotypical group.
263 * @param rank the rank to be assigned to <i>this</i> non viral taxon name
264 * @param homotypicalGroup the homotypical group to which <i>this</i> non viral taxon name belongs
265 * @see #NewInstance(Rank)
266 * @see #NonViralName(Rank, HomotypicalGroup)
267 * @see #NonViralName()
268 * @see #NonViralName(Rank, String, String, String, String, TeamOrPersonBase, ReferenceBase, String, HomotypicalGroup)
269 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
270 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
271 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
273 public static NonViralName
NewInstance(Rank rank
, HomotypicalGroup homotypicalGroup
){
274 return new NonViralName(rank
, homotypicalGroup
);
277 private void setNameCacheStrategy(){
278 if (getClass() == NonViralName
.class){
279 this.cacheStrategy
= NonViralNameDefaultCacheStrategy
.NewInstance();
286 * Returns the {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy cache strategy} used to generate
287 * several strings corresponding to <i>this</i> non viral taxon name
288 * (in particular taxon name caches and author strings).
290 * @return the cache strategy used for <i>this</i> non viral taxon name
291 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
292 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
293 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
297 // public INonViralNameCacheStrategy getCacheStrategy() {
298 // return cacheStrategy;
302 * @see #getCacheStrategy()
305 // public void setCacheStrategy(INonViralNameCacheStrategy cacheStrategy) {
306 // this.cacheStrategy = cacheStrategy;
310 * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that published <i>this</i> non viral
313 * @return the nomenclatural author (team) of <i>this</i> non viral taxon name
314 * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
315 * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
317 public INomenclaturalAuthor
getCombinationAuthorTeam(){
318 return this.combinationAuthorTeam
;
322 * @see #getCombinationAuthorTeam()
324 public void setCombinationAuthorTeam(INomenclaturalAuthor combinationAuthorTeam
){
325 this.combinationAuthorTeam
= combinationAuthorTeam
;
329 * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that contributed to
330 * the publication of <i>this</i> non viral taxon name as generally stated by
331 * the {@link #getCombinationAuthorTeam() combination author (team)} itself.<BR>
332 * An ex-author(-team) is an author(-team) to whom a taxon name was ascribed
333 * although it is not the author(-team) of a valid publication (for instance
334 * without the validating description or diagnosis in case of a name for a
335 * new taxon). The name of this ascribed authorship, followed by "ex", may
336 * be inserted before the name(s) of the publishing author(s) of the validly
337 * published name:<BR>
338 * <i>Lilium tianschanicum</i> was described by Grubov (1977) as a new species and
339 * its name was ascribed to Ivanova; since there is no indication that
340 * Ivanova provided the validating description, the name may be cited as
341 * <i>Lilium tianschanicum</i> N. A. Ivanova ex Grubov or <i>Lilium tianschanicum</i> Grubov.
343 * The presence of an author (team) of <i>this</i> non viral taxon name is a
344 * condition for the existence of an ex author (team) for <i>this</i> same name.
346 * @return the nomenclatural ex author (team) of <i>this</i> non viral taxon name
347 * @see #getCombinationAuthorTeam()
348 * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
349 * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
351 public INomenclaturalAuthor
getExCombinationAuthorTeam(){
352 return this.exCombinationAuthorTeam
;
356 * @see #getExCombinationAuthorTeam()
358 public void setExCombinationAuthorTeam(INomenclaturalAuthor exCombinationAuthorTeam
){
359 this.exCombinationAuthorTeam
= exCombinationAuthorTeam
;
363 * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that published the original combination
364 * on which <i>this</i> non viral taxon name is nomenclaturally based. Such an
365 * author (team) can only exist if <i>this</i> non viral taxon name is a new
366 * combination due to a taxonomical revision.
368 * @return the nomenclatural basionym author (team) of <i>this</i> non viral taxon name
369 * @see #getCombinationAuthorTeam()
370 * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
371 * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
373 public INomenclaturalAuthor
getBasionymAuthorTeam(){
374 return basionymAuthorTeam
;
378 * @see #getBasionymAuthorTeam()
380 public void setBasionymAuthorTeam(INomenclaturalAuthor basionymAuthorTeam
) {
381 this.basionymAuthorTeam
= basionymAuthorTeam
;
385 * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that contributed to
386 * the publication of the original combination <i>this</i> non viral taxon name is
387 * based on. This should have been generally stated by
388 * the {@link #getBasionymAuthorTeam() basionym author (team)} itself.
389 * The presence of a basionym author (team) of <i>this</i> non viral taxon name is a
390 * condition for the existence of an ex basionym author (team)
391 * for <i>this</i> same name.
393 * @return the nomenclatural ex basionym author (team) of <i>this</i> non viral taxon name
394 * @see #getBasionymAuthorTeam()
395 * @see #getExCombinationAuthorTeam()
396 * @see #getCombinationAuthorTeam()
397 * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
398 * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
400 public INomenclaturalAuthor
getExBasionymAuthorTeam(){
401 return exBasionymAuthorTeam
;
405 * @see #getExBasionymAuthorTeam()
407 public void setExBasionymAuthorTeam(INomenclaturalAuthor exBasionymAuthorTeam
) {
408 this.exBasionymAuthorTeam
= exBasionymAuthorTeam
;
411 * Returns either the scientific name string (without authorship) for <i>this</i>
412 * non viral taxon name if its rank is genus or higher (monomial) or the string for
413 * the genus part of it if its {@link Rank rank} is lower than genus (bi- or trinomial).
414 * Genus or uninomial strings begin with an upper case letter.
416 * @return the string containing the suprageneric name, the genus name or the genus part of <i>this</i> non viral taxon name
417 * @see #getNameCache()
419 public String
getGenusOrUninomial() {
420 return genusOrUninomial
;
424 * @see #getGenusOrUninomial()
426 public void setGenusOrUninomial(String genusOrUninomial
) {
427 this.genusOrUninomial
= genusOrUninomial
;
431 * Returns the genus subdivision epithet string (infrageneric part) for
432 * <i>this</i> non viral taxon name if its {@link Rank rank} is infrageneric (lower than genus and
433 * higher than species aggregate: binomial). Genus subdivision epithet
434 * strings begin with an upper case letter.
436 * @return the string containing the infrageneric part of <i>this</i> non viral taxon name
437 * @see #getNameCache()
439 public String
getInfraGenericEpithet(){
440 return this.infraGenericEpithet
;
444 * @see #getInfraGenericEpithet()
446 public void setInfraGenericEpithet(String infraGenericEpithet
){
447 this.infraGenericEpithet
= infraGenericEpithet
;
451 * Returns the species epithet string for <i>this</i> non viral taxon name if its {@link Rank rank} is
452 * species aggregate or lower (bi- or trinomial). Species epithet strings
453 * begin with a lower case letter.
455 * @return the string containing the species epithet of <i>this</i> non viral taxon name
456 * @see #getNameCache()
458 public String
getSpecificEpithet(){
459 return this.specificEpithet
;
463 * @see #getSpecificEpithet()
465 public void setSpecificEpithet(String specificEpithet
){
466 this.specificEpithet
= specificEpithet
;
470 * Returns the species subdivision epithet string (infraspecific part) for
471 * <i>this</i> non viral taxon name if its {@link Rank rank} is infraspecific
472 * (lower than species: trinomial). Species subdivision epithet strings
473 * begin with a lower case letter.
475 * @return the string containing the infraspecific part of <i>this</i> non viral taxon name
476 * @see #getNameCache()
478 public String
getInfraSpecificEpithet(){
479 return this.infraSpecificEpithet
;
483 * @see #getInfraSpecificEpithet()
485 public void setInfraSpecificEpithet(String infraSpecificEpithet
){
486 this.infraSpecificEpithet
= infraSpecificEpithet
;
490 * Generates and returns the string with the scientific name of <i>this</i>
491 * non viral taxon name including author strings and maybe year according to
492 * the strategy defined in
493 * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy INonViralNameCacheStrategy}.
494 * This string may be stored in the inherited
495 * {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache() titleCache} attribute.
496 * This method overrides the generic and inherited
497 * TaxonNameBase#generateTitle() method.
499 * @return the string with the composed name of <i>this</i> non viral taxon name with authorship (and maybe year)
500 * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle()
501 * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
502 * @see TaxonNameBase#generateTitle()
505 // public String generateTitle(){
506 // if (cacheStrategy == null){
507 // logger.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
510 // return cacheStrategy.getTitleCache(this);
515 public String
generateFullTitle(){
516 if (cacheStrategy
== null){
517 logger
.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
520 return cacheStrategy
.getFullTitleCache(this);
525 * Generates the composed name string of <i>this</i> non viral taxon name without author
526 * strings or year according to the strategy defined in
527 * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy INonViralNameCacheStrategy}.
528 * The result might be stored in {@link #getNameCache() nameCache} if the
529 * flag {@link #isProtectedNameCache() protectedNameCache} is not set.
531 * @return the string with the composed name of <i>this</i> non viral taxon name without authors or year
532 * @see #getNameCache()
534 protected String
generateNameCache(){
535 if (cacheStrategy
== null){
536 logger
.warn("No CacheStrategy defined for taxonName: " + this.toString());
539 return cacheStrategy
.getNameCache(this);
544 * Returns or generates the nameCache (scientific name
545 * without author strings and year) string for <i>this</i> non viral taxon name. If the
546 * {@link #isProtectedNameCache() protectedNameCache} flag is not set (False)
547 * the string will be generated according to a defined strategy,
548 * otherwise the value of the actual nameCache string will be returned.
550 * @return the string which identifies <i>this</i> non viral taxon name (without authors or year)
551 * @see #generateNameCache()
554 public String
getNameCache() {
555 if (protectedNameCache
){
556 return this.nameCache
;
558 // is title dirty, i.e. equal NULL?
559 if (nameCache
== null){
560 this.nameCache
= generateNameCache();
566 * Assigns a nameCache string to <i>this</i> non viral taxon name and protects it from being overwritten.
567 * Sets the protectedNameCache flag to <code>true</code>.
569 * @param nameCache the string which identifies <i>this</i> non viral taxon name (without authors or year)
570 * @see #getNameCache()
572 public void setNameCache(String nameCache
){
573 setNameCache(nameCache
, true);
577 * Assigns a nameCache string to <i>this</i> non viral taxon name and protects it from being overwritten.
578 * Sets the protectedNameCache flag to <code>true</code>.
580 * @param nameCache the string which identifies <i>this</i> non viral taxon name (without authors or year)
581 * @param protectedNameCache if true teh protectedNameCache is set to <code>true</code> or otherwise set to
583 * @see #getNameCache()
585 public void setNameCache(String nameCache
, boolean protectedNameCache
){
586 this.nameCache
= nameCache
;
587 this.setProtectedTitleCache(false);
588 this.setProtectedNameCache(protectedNameCache
);
592 * Returns the boolean value of the flag intended to protect (true)
593 * or not (false) the {@link #getNameCache() nameCache} (scientific name without author strings and year)
594 * string of <i>this</i> non viral taxon name.
596 * @return the boolean value of the protectedNameCache flag
597 * @see #getNameCache()
599 public boolean isProtectedNameCache() {
600 return protectedNameCache
;
604 * @see #isProtectedNameCache()
606 public void setProtectedNameCache(boolean protectedNameCache
) {
607 this.protectedNameCache
= protectedNameCache
;
612 * Generates and returns a concatenated and formated authorteams string
613 * including basionym and combination authors of <i>this</i> non viral taxon name
614 * according to the strategy defined in
615 * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName) INonViralNameCacheStrategy}.
617 * @return the string with the concatenated and formated authorteams for <i>this</i> non viral taxon name
618 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName)
620 public String
generateAuthorship(){
621 if (cacheStrategy
== null){
622 logger
.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
625 return ((INonViralNameCacheStrategy
<T
>)cacheStrategy
).getAuthorshipCache((T
)this);
630 * Returns the concatenated and formated authorteams string including
631 * basionym and combination authors of <i>this</i> non viral taxon name.
632 * If the protectedAuthorshipCache flag is set this method returns the
633 * string stored in the the authorshipCache attribute, otherwise it
634 * generates the complete authorship string, returns it and stores it in
635 * the authorshipCache attribute.
637 * @return the string with the concatenated and formated authorteams for <i>this</i> non viral taxon name
638 * @see #generateAuthorship()
641 public String
getAuthorshipCache() {
642 if (protectedAuthorshipCache
){
643 return this.authorshipCache
;
645 // is title dirty, i.e. equal NULL?
646 if (authorshipCache
== null ){
647 this.authorshipCache
= generateAuthorship();
649 //TODO get is Dirty of authors
650 this.authorshipCache
= generateAuthorship();
652 return authorshipCache
;
656 * Assigns an authorshipCache string to <i>this</i> non viral taxon name. Sets the isProtectedAuthorshipCache
657 * flag to <code>true</code>.
659 * @param authorshipCache the string which identifies the complete authorship of <i>this</i> non viral taxon name
660 * @see #getAuthorshipCache()
662 public void setAuthorshipCache(String authorshipCache
) {
663 setAuthorshipCache(authorshipCache
, true);
667 * Assigns an authorshipCache string to <i>this</i> non viral taxon name.
669 * @param authorshipCache the string which identifies the complete authorship of <i>this</i> non viral taxon name
670 * @param protectedAuthorshipCache if true the isProtectedAuthorshipCache flag is set to <code>true</code>, otherwise
671 * the flag is set to <code>false</code>.
672 * @see #getAuthorshipCache()
674 public void setAuthorshipCache(String authorshipCache
, boolean protectedAuthorshipCache
) {
675 this.authorshipCache
= authorshipCache
;
676 //TODO hibernate safe?
677 if (! this.isProtectedTitleCache()){
678 this.setTitleCache(null, false);
680 this.setProtectedAuthorshipCache(protectedAuthorshipCache
);
683 public void setTitleCache(String titleCache
, boolean protectCache
){
684 super.setTitleCache(titleCache
, protectCache
);
685 if (! this.isProtectedFullTitleCache()){
686 this.setFullTitleCache(null, false);
691 * Returns the boolean value "false" since the components of <i>this</i> taxon name
692 * cannot follow the rules of a corresponding {@link NomenclaturalCode nomenclatural code}
693 * which is not defined for this class. The nomenclature code depends on
694 * the concrete name subclass ({@link BacterialName BacterialName},
695 * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} or
696 * {@link ZoologicalName ZoologicalName} to which <i>this</i> non viral taxon name belongs.
697 * This method overrides the isCodeCompliant method from the abstract
698 * {@link TaxonNameBase#isCodeCompliant() TaxonNameBase} class.
701 * @see TaxonNameBase#isCodeCompliant()
705 public boolean isCodeCompliant() {
707 logger
.warn("is CodeCompliant not yet implemented");
712 * @see eu.etaxonomy.cdm.model.name.TaxonNameBase#getNomeclaturalCode()
715 * Returns null as {@link NomenclaturalCode nomenclatural code} that governs
716 * the construction of <i>this</i> non viral taxon name since there is no specific
717 * nomenclatural code defined. The real implementention takes place in the
718 * subclasses {@link BacterialName BacterialName},
719 * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} and
720 * {@link ZoologicalName ZoologicalName}.
721 * This method overrides the getNomeclaturalCode method from {@link TaxonNameBase TaxonNameBase}.
724 * @see #isCodeCompliant()
725 * @see TaxonNameBase#getHasProblem()
729 public NomenclaturalCode
getNomenclaturalCode() {
730 logger
.warn("Non Viral Name has no specific Code defined. Use subclasses");
735 * Returns the boolean value of the flag intended to protect (true)
736 * or not (false) the {@link #getAuthorshipCache() authorshipCache} (complete authorship string)
737 * of <i>this</i> non viral taxon name.
739 * @return the boolean value of the protectedAuthorshipCache flag
740 * @see #getAuthorshipCache()
742 public boolean isProtectedAuthorshipCache() {
743 return protectedAuthorshipCache
;
747 * @see #isProtectedAuthorshipCache()
748 * @see #getAuthorshipCache()
750 public void setProtectedAuthorshipCache(boolean protectedAuthorshipCache
) {
751 this.protectedAuthorshipCache
= protectedAuthorshipCache
;
752 if (protectedAuthorshipCache
== false){
753 if (! this.isProtectedFullTitleCache()){
754 this.setFullTitleCache(null, false);