00edb9d7a53b8b6bb097673696f3af15f8a779b3
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / name / NonViralName.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.persistence.ManyToOne;
15 import javax.persistence.Transient;
16 import javax.xml.bind.annotation.XmlAccessType;
17 import javax.xml.bind.annotation.XmlAccessorType;
18 import javax.xml.bind.annotation.XmlAnyElement;
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.XmlType;
23
24 import org.apache.log4j.Logger;
25 import org.hibernate.annotations.Cascade;
26 import org.hibernate.annotations.CascadeType;
27 import org.hibernate.annotations.Target;
28
29 import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
30 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
31 import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
32 import eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy;
33 import eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy;
34
35 /**
36 * The taxon name class for all non viral taxa. Parenthetical authorship is derived
37 * from basionym relationship. The scientific name including author strings and
38 * maybe year can be stored as a string in the inherited {@link common.IdentifiableEntity#getTitleCache() titleCache} attribute.
39 * The year itself is an information obtained from the {@link reference.INomenclaturalReference#getYear() nomenclatural reference}.
40 * The scientific name string without author strings and year can be stored in the {@link #getNameCache() nameCache} attribute.
41 *
42 * @author m.doering
43 * @version 1.0
44 * @created 08-Nov-2007 13:06:39
45 */
46 @XmlAccessorType(XmlAccessType.FIELD)
47 @XmlType(name = "", propOrder = {
48 "nameCache",
49 "genusOrUninomial",
50 "infraGenericEpithet",
51 "specificEpithet",
52 "infraSpecificEpithet",
53 "combinationAuthorTeam",
54 "exCombinationAuthorTeam",
55 "basionymAuthorTeam",
56 "exBasionymAuthorTeam",
57 "authorshipCache",
58 "protectedAuthorshipCache",
59 "protectedNameCache",
60 "cacheStrategy"
61 })
62 @XmlRootElement(name = "NonViralName")
63 @Entity
64 public class NonViralName<T extends NonViralName> extends TaxonNameBase<NonViralName, INonViralNameCacheStrategy> {
65
66 private static final Logger logger = Logger.getLogger(NonViralName.class);
67
68 @XmlElement(name = "NameCache")
69 private String nameCache;
70
71 @XmlElement(name = "GenusOrUninomial")
72 private String genusOrUninomial;
73
74 @XmlElement(name = "InfraGenericEpithet")
75 private String infraGenericEpithet;
76
77 @XmlElement(name = "SpecificEpithet")
78 private String specificEpithet;
79
80 @XmlElement(name = "InfraSpecificEpithet")
81 private String infraSpecificEpithet;
82
83 @XmlAnyElement
84 //@XmlIDREF
85 //@XmlSchemaType(name = "IDREF")
86 private INomenclaturalAuthor combinationAuthorTeam;
87
88 @XmlAnyElement
89 //@XmlIDREF
90 //@XmlSchemaType(name = "IDREF")
91 private INomenclaturalAuthor exCombinationAuthorTeam;
92
93 @XmlAnyElement
94 //@XmlIDREF
95 //@XmlSchemaType(name = "IDREF")
96 private INomenclaturalAuthor basionymAuthorTeam;
97
98 @XmlAnyElement
99 private INomenclaturalAuthor exBasionymAuthorTeam;
100
101 @XmlElement(name = "AuthorshipCache")
102 private String authorshipCache;
103
104 @XmlElement(name = "ProtectedAuthorshipCache")
105 protected boolean protectedAuthorshipCache;
106
107 @XmlElement(name = "ProtectedNameCache")
108 protected boolean protectedNameCache;
109
110 @XmlAnyElement
111 protected INonViralNameCacheStrategy cacheStrategy;
112
113 // ************* CONSTRUCTORS *************/
114
115 //needed by hibernate
116 /**
117 * Class constructor: creates a new non viral taxon name instance
118 * only containing the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
119 *
120 * @see #NonViralName(Rank, HomotypicalGroup)
121 * @see #NonViralName(Rank, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
122 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
123 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
124 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
125 */
126 protected NonViralName(){
127 super();
128 setNameCacheStrategy();
129 }
130
131 /**
132 * Class constructor: creates a new non viral taxon name instance
133 * only containing its {@link common.Rank rank},
134 * its {@link common.HomotypicalGroup homotypical group} and
135 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
136 *
137 * @param rank the rank to be assigned to this non viral taxon name
138 * @param homotypicalGroup the homotypical group to which this non viral taxon name belongs
139 * @see #NonViralName()
140 * @see #NonViralName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
141 * @see #NewInstance(Rank, HomotypicalGroup)
142 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
143 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
144 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
145 */
146 protected NonViralName(Rank rank, HomotypicalGroup homotypicalGroup) {
147 super(rank, homotypicalGroup);
148 setNameCacheStrategy();
149 }
150 /**
151 * Class constructor: creates a new non viral taxon name instance
152 * containing its {@link common.Rank rank},
153 * its {@link common.HomotypicalGroup homotypical group},
154 * its scientific name components, its {@link agent.TeamOrPersonBase author(team)},
155 * its {@link reference.INomenclaturalReference nomenclatural reference} and
156 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
157 *
158 * @param rank the rank to be assigned to this non viral taxon name
159 * @param genusOrUninomial the string for this taxon name
160 * if its rank is genus or higher or for the genus part
161 * if its rank is lower than genus
162 * @param infraGenericEpithet the string for the first epithet of
163 * this non viral taxon name if its rank is lower than genus
164 * and higher than species aggregate
165 * @param specificEpithet the string for the first epithet of
166 * this non viral taxon name if its rank is species aggregate or lower
167 * @param infraSpecificEpithet the string for the second epithet of
168 * this non viral taxon name if its rank is lower than species
169 * @param combinationAuthorTeam the author or the team who published this non viral taxon name
170 * @param nomenclaturalReference the nomenclatural reference where this non viral taxon name was published
171 * @param nomenclMicroRef the string with the details for precise location within the nomenclatural reference
172 * @param homotypicalGroup the homotypical group to which this non viral taxon name belongs
173 * @see #NonViralName()
174 * @see #NonViralName(Rank, HomotypicalGroup)
175 * @see #NewInstance(Rank, HomotypicalGroup)
176 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
177 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
178 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
179 */
180 protected NonViralName(Rank rank, String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet, TeamOrPersonBase combinationAuthorTeam, INomenclaturalReference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) {
181 super(rank, homotypicalGroup);
182 setNameCacheStrategy();
183 setGenusOrUninomial(genusOrUninomial);
184 setInfraGenericEpithet (infraGenericEpithet);
185 setSpecificEpithet(specificEpithet);
186 setInfraSpecificEpithet(infraSpecificEpithet);
187 setCombinationAuthorTeam(combinationAuthorTeam);
188 setNomenclaturalReference(nomenclaturalReference);
189 this.setNomenclaturalMicroReference(nomenclMicroRef);
190 }
191
192 //********* METHODS **************************************/
193 /**
194 * Creates a new non viral taxon name instance
195 * only containing its {@link common.Rank rank} and
196 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
197 *
198 * @param rank the rank to be assigned to this non viral taxon name
199 * @see #NewInstance(Rank, HomotypicalGroup)
200 * @see #NonViralName(Rank, HomotypicalGroup)
201 * @see #NonViralName()
202 * @see #NonViralName(Rank, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
203 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
204 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
205 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
206 */
207 public static NonViralName NewInstance(Rank rank){
208 return new NonViralName(rank, null);
209 }
210
211 /**
212 * Creates a new non viral taxon name instance
213 * only containing its {@link common.Rank rank} and
214 * its {@link common.HomotypicalGroup homotypical group} and
215 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
216 * The new non viral taxon name instance will be also added to the set of
217 * non viral taxon names belonging to this homotypical group. If the homotypical
218 * group does not exist a new instance will be created for it.
219 *
220 * @param rank the rank to be assigned to this non viral taxon name
221 * @param homotypicalGroup the homotypical group to which this non viral taxon name belongs
222 * @see #NewInstance(Rank)
223 * @see #NonViralName(Rank, HomotypicalGroup)
224 * @see #NonViralName()
225 * @see #NonViralName(Rank, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
226 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
227 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
228 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
229 */
230 public static NonViralName NewInstance(Rank rank, HomotypicalGroup homotypicalGroup){
231 return new NonViralName(rank, homotypicalGroup);
232 }
233
234 private void setNameCacheStrategy(){
235 if (getClass() == NonViralName.class){
236 this.cacheStrategy = NonViralNameDefaultCacheStrategy.NewInstance();
237 }
238
239 }
240
241 //TODO for PROTOTYPE
242 /**
243 * Returns the {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy cache strategy} used to generate
244 * several strings corresponding to this non viral taxon name
245 * (in particular taxon name caches and author strings).
246 *
247 * @return the cache strategy used for this non viral taxon name
248 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
249 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
250 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
251 */
252 @Transient
253 @Override
254 public INonViralNameCacheStrategy getCacheStrategy() {
255 return cacheStrategy;
256 }
257 /**
258 * @see #getCacheStrategy()
259 */
260 @Override
261 public void setCacheStrategy(INonViralNameCacheStrategy cacheStrategy) {
262 this.cacheStrategy = cacheStrategy;
263 }
264
265
266
267 /**
268 * Returns the {@link agent.INomenclaturalAuthor author (team)} that published this non viral
269 * taxon name.
270 *
271 * @return the nomenclatural author (team) of this non viral taxon name
272 * @see agent.INomenclaturalAuthor
273 * @see agent.TeamOrPersonBase#getNomenclaturalTitle()
274 */
275 @ManyToOne
276 @Cascade({CascadeType.SAVE_UPDATE})
277 @Target(TeamOrPersonBase.class)
278 public INomenclaturalAuthor getCombinationAuthorTeam(){
279 return this.combinationAuthorTeam;
280 }
281 /**
282 * @see #getCombinationAuthorTeam()
283 */
284 public void setCombinationAuthorTeam(INomenclaturalAuthor combinationAuthorTeam){
285 this.combinationAuthorTeam = combinationAuthorTeam;
286 }
287
288 /**
289 * Returns the {@link agent.INomenclaturalAuthor author (team)} that contributed to
290 * the publication of this non viral taxon name as generally stated by
291 * the {@link #getCombinationAuthorTeam() combination author (team)} itself.
292 * The presence of an author (team) of this non viral taxon name is a
293 * condition for the existence of an ex author (team) for this same name.
294 *
295 * @return the nomenclatural ex author (team) of this non viral taxon name
296 * @see #getCombinationAuthorTeam()
297 * @see agent.INomenclaturalAuthor
298 * @see agent.TeamOrPersonBase#getNomenclaturalTitle()
299 */
300 @ManyToOne
301 @Cascade({CascadeType.SAVE_UPDATE})
302 @Target(TeamOrPersonBase.class)
303 public INomenclaturalAuthor getExCombinationAuthorTeam(){
304 return this.exCombinationAuthorTeam;
305 }
306 /**
307 * @see #getExCombinationAuthorTeam()
308 */
309 public void setExCombinationAuthorTeam(INomenclaturalAuthor exCombinationAuthorTeam){
310 this.exCombinationAuthorTeam = exCombinationAuthorTeam;
311 }
312
313 /**
314 * Returns the {@link agent.INomenclaturalAuthor author (team)} that published the original combination
315 * on which this non viral taxon name is nomenclaturally based. Such an
316 * author (team) can only exist if this non viral taxon name is a new
317 * combination due to a taxonomical revision.
318 *
319 * @return the nomenclatural basionym author (team) of this non viral taxon name
320 * @see #getCombinationAuthorTeam()
321 * @see agent.INomenclaturalAuthor
322 * @see agent.TeamOrPersonBase#getNomenclaturalTitle()
323 */
324 @ManyToOne
325 @Cascade({CascadeType.SAVE_UPDATE})
326 @Target(TeamOrPersonBase.class)
327 public INomenclaturalAuthor getBasionymAuthorTeam(){
328 return basionymAuthorTeam;
329 }
330 /**
331 * @see #getBasionymAuthorTeam()
332 */
333 public void setBasionymAuthorTeam(INomenclaturalAuthor basionymAuthorTeam) {
334 this.basionymAuthorTeam = basionymAuthorTeam;
335 }
336
337 /**
338 * Returns the {@link agent.INomenclaturalAuthor author (team)} that contributed to
339 * the publication of the original combination this non viral taxon name is
340 * based on. This should have been generally stated by
341 * the {@link #getCombinationAuthorTeam() basionym author (team)} itself.
342 * The presence of a basionym author (team) of this non viral taxon name is a
343 * condition for the existence of an ex basionym author (team)
344 * for this same name.
345 *
346 * @return the nomenclatural ex basionym author (team) of this non viral taxon name
347 * @see #getBasionymAuthorTeam()
348 * @see #getCombinationAuthorTeam()
349 * @see agent.INomenclaturalAuthor
350 * @see agent.TeamOrPersonBase#getNomenclaturalTitle()
351 */
352 @ManyToOne
353 @Cascade({CascadeType.SAVE_UPDATE})
354 @Target(TeamOrPersonBase.class)
355 public INomenclaturalAuthor getExBasionymAuthorTeam(){
356 return exBasionymAuthorTeam;
357 }
358 /**
359 * @see #getExBasionymAuthorTeam()
360 */
361 public void setExBasionymAuthorTeam(INomenclaturalAuthor exBasionymAuthorTeam) {
362 this.exBasionymAuthorTeam = exBasionymAuthorTeam;
363 }
364 /**
365 * Returns either the scientific name string (without authorship) for this
366 * non viral taxon name if its rank is genus or higher (monomial) or the string for
367 * the genus part of it if its {@link Rank rank} is lower than genus (bi- or trinomial).
368 * Genus or uninomial strings begin with an upper case letter.
369 *
370 * @return the string containing the suprageneric name, the genus name or the genus part of this non viral taxon name
371 * @see #getNameCache()
372 */
373 public String getGenusOrUninomial() {
374 return genusOrUninomial;
375 }
376
377 /**
378 * @see #getGenusOrUninomial()
379 */
380 public void setGenusOrUninomial(String genusOrUninomial) {
381 this.genusOrUninomial = genusOrUninomial;
382 }
383
384 /**
385 * Returns the genus subdivision epithet string (infrageneric part) for
386 * this non viral taxon name if its {@link Rank rank} is infrageneric (lower than genus and
387 * higher than species aggregate). Genus subdivision epithet strings begin
388 * with an upper case letter.
389 *
390 * @return the string containing the infrageneric part of this non viral taxon name
391 * @see #getNameCache()
392 */
393 public String getInfraGenericEpithet(){
394 return this.infraGenericEpithet;
395 }
396
397 /**
398 * @see #getInfraGenericEpithet()
399 */
400 public void setInfraGenericEpithet(String infraGenericEpithet){
401 this.infraGenericEpithet = infraGenericEpithet;
402 }
403
404 /**
405 * Returns the species epithet string for this non viral taxon name if its {@link Rank rank} is
406 * species aggregate or lower. Species epithet strings begin with a
407 * lower case letter.
408 *
409 * @return the string containing the species epithet of this non viral taxon name
410 * @see #getNameCache()
411 */
412 public String getSpecificEpithet(){
413 return this.specificEpithet;
414 }
415
416 /**
417 * @see #getSpecificEpithet()
418 */
419 public void setSpecificEpithet(String specificEpithet){
420 this.specificEpithet = specificEpithet;
421 }
422
423 /**
424 * Returns the species subdivision epithet string (infraspecific part) for
425 * this non viral taxon name if its {@link Rank rank} is infraspecific (lower than species).
426 * Species subdivision epithet strings begin with a lower case letter.
427 *
428 * @return the string containing the infraspecific part of this non viral taxon name
429 * @see #getNameCache()
430 */
431 public String getInfraSpecificEpithet(){
432 return this.infraSpecificEpithet;
433 }
434
435 /**
436 * @see #getInfraSpecificEpithet()
437 */
438 public void setInfraSpecificEpithet(String infraSpecificEpithet){
439 this.infraSpecificEpithet = infraSpecificEpithet;
440 }
441
442 /**
443 * Generates and returns the string with the scientific name of this
444 * non viral taxon name including author strings and maybe year according to
445 * the strategy defined in
446 * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy INonViralNameCacheStrategy}.
447 * This string may be stored in the inherited
448 * {@link common.IdentifiableEntity#getTitleCache() titleCache} attribute.
449 * This method overrides the generic and inherited
450 * TaxonNameBase#generateTitle() method.
451 *
452 * @return the string with the composed name of this non viral taxon name with authorship (and maybe year)
453 * @see common.IdentifiableEntity#generateTitle()
454 * @see common.IdentifiableEntity#getTitleCache()
455 * @see TaxonNameBase#generateTitle()
456 */
457 @Override
458 public String generateTitle(){
459 if (cacheStrategy == null){
460 logger.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
461 return null;
462 }else{
463 return cacheStrategy.getTitleCache(this);
464 }
465 }
466
467 /**
468 * Generates the composed name string of this non viral taxon name without author
469 * strings or year according to the strategy defined in
470 * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy INonViralNameCacheStrategy}.
471 * The result might be stored in {@link #getNameCache() nameCache} if the
472 * flag {@link #isProtectedNameCache() protectedNameCache} is not set.
473 *
474 * @return the string with the composed name of this non viral taxon name without authors or year
475 * @see #getNameCache()
476 */
477 protected String generateNameCache(){
478 if (cacheStrategy == null){
479 logger.warn("No CacheStrategy defined for taxonName: " + this.toString());
480 return null;
481 }else{
482 return cacheStrategy.getNameCache(this);
483 }
484 }
485
486 /**
487 * Returns or generates the nameCache (scientific name
488 * without author strings and year) string for this non viral taxon name. If the
489 * {@link #isProtectedNameCache() protectedNameCache} flag is not set (False)
490 * the string will be generated according to a defined strategy,
491 * otherwise the value of the actual nameCache string will be returned.
492 *
493 * @return the string which identifies this non viral taxon name (without authors or year)
494 * @see #generateNameCache()
495 */
496 public String getNameCache() {
497 if (protectedNameCache){
498 return this.nameCache;
499 }
500 // is title dirty, i.e. equal NULL?
501 if (nameCache == null){
502 this.nameCache = generateNameCache();
503 }
504 return nameCache;
505 }
506
507 /**
508 * Assigns a nameCache string to this non viral taxon name and protects it from being overwritten.
509 *
510 * @param nameCache the string which identifies this non viral taxon name (without authors or year)
511 * @see #getNameCache()
512 */
513 public void setNameCache(String nameCache){
514 this.nameCache = nameCache;
515 this.setProtectedTitleCache(false);
516 this.setProtectedNameCache(true);
517 }
518
519 /**
520 * Returns the boolean value of the flag intended to protect (true)
521 * or not (false) the {@link #getNameCache() nameCache} (scientific name without author strings and year)
522 * string of this non viral taxon name.
523 *
524 * @return the boolean value of the protectedNameCache flag
525 * @see #getNameCache()
526 */
527 public boolean isProtectedNameCache() {
528 return protectedNameCache;
529 }
530
531 /**
532 * @see #isProtectedNameCache()
533 */
534 public void setProtectedNameCache(boolean protectedNameCache) {
535 this.protectedNameCache = protectedNameCache;
536 }
537
538
539 /**
540 * Generates and returns a concatenated and formated authorteams string
541 * including basionym and combination authors of this non viral taxon name
542 * according to the strategy defined in
543 * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName) INonViralNameCacheStrategy}.
544 *
545 * @return the string with the concatenated and formated authorteams for this non viral taxon name
546 * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName)
547 */
548 public String generateAuthorship(){
549 if (cacheStrategy == null){
550 logger.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
551 return null;
552 }else{
553 return ((INonViralNameCacheStrategy<T>)cacheStrategy).getAuthorshipCache((T)this);
554 }
555 }
556
557 /**
558 * Returns the concatenated and formated authorteams string including
559 * basionym and combination authors of this non viral taxon name.
560 * If the protectedAuthorshipCache flag is set this method returns the
561 * string stored in the the authorshipCache attribute, otherwise it
562 * generates the complete authorship string, returns it and stores it in
563 * the authorshipCache attribute.
564 *
565 * @return the string with the concatenated and formated authorteams for this non viral taxon name
566 * @see #generateAuthorship()
567 */
568 public String getAuthorshipCache() {
569 if (protectedAuthorshipCache){
570 return this.authorshipCache;
571 }
572 // is title dirty, i.e. equal NULL?
573 if (authorshipCache == null){
574 this.authorshipCache = generateAuthorship();
575 }else{
576 //TODO get is Dirty of authors
577 this.authorshipCache = generateAuthorship();
578 }
579 return authorshipCache;
580 }
581
582 /**
583 * Assigns an authorshipCache string to this non viral taxon name.
584 *
585 * @param authorshipCache the string which identifies the complete authorship of this non viral taxon name
586 * @see #getAuthorshipCache()
587 */
588 public void setAuthorshipCache(String authorshipCache) {
589 this.authorshipCache = authorshipCache;
590 }
591
592
593
594 /**
595 * Returns the boolean value "false" since the components of this taxon name
596 * cannot follow the rules of a corresponding {@link NomenclaturalCode nomenclatural code}
597 * which is not defined for this class. The nomenclature code depends on
598 * the concrete name subclass ({@link BacterialName BacterialName},
599 * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} or
600 * {@link ZoologicalName ZoologicalName} to which this non viral taxon name belongs.
601 * This method overrides the isCodeCompliant method from the abstract
602 * {@link TaxonNameBase#isCodeCompliant() TaxonNameBase} class.
603 *
604 * @return false
605 * @see TaxonNameBase#isCodeCompliant()
606 */
607 @Override
608 @Transient
609 public boolean isCodeCompliant() {
610 //FIXME
611 logger.warn("is CodeCompliant not yet implemented");
612 return false;
613 }
614
615 /* (non-Javadoc)
616 * @see eu.etaxonomy.cdm.model.name.TaxonNameBase#getNomeclaturalCode()
617 */
618 /**
619 * Returns null as {@link NomenclaturalCode nomenclatural code} that governs
620 * the construction of this non viral taxon name since there is no specific
621 * nomenclatural code defined. The real implementention takes place in the
622 * subclasses {@link BacterialName BacterialName},
623 * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} and
624 * {@link ZoologicalName ZoologicalName}.
625 * This method overrides the getNomeclaturalCode method from {@link TaxonNameBase#getNomeclaturalCode() TaxonNameBase}.
626 *
627 * @return null
628 * @see #isCodeCompliant()
629 * @see TaxonNameBase#getHasProblem()
630 */
631 @Transient
632 @Override
633 public NomenclaturalCode getNomenclaturalCode() {
634 //TODO What is the purpose of overriding the inherited method?
635 logger.warn("Non Viral Name has no specific Code defined. Use subclasses");
636 return null;
637 }
638
639 /**
640 * Returns the boolean value of the flag intended to protect (true)
641 * or not (false) the {@link #getAuthorshipCache() authorshipCache} (complete authorship string)
642 * of this non viral taxon name.
643 *
644 * @return the boolean value of the protectedAuthorshipCache flag
645 * @see #getAuthorshipCache()
646 */
647 public boolean isProtectedAuthorshipCache() {
648 return protectedAuthorshipCache;
649 }
650
651 /**
652 * @see #isProtectedAuthorshipCache()
653 * @see #getAuthorshipCache()
654 */
655 public void setProtectedAuthorshipCache(boolean protectedAuthorshipCache) {
656 this.protectedAuthorshipCache = protectedAuthorshipCache;
657 }
658
659
660
661
662 }