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
;
15 import javax
.persistence
.Entity
;
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
.XmlRootElement
;
21 import javax
.xml
.bind
.annotation
.XmlType
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.hibernate
.envers
.Audited
;
25 import org
.hibernate
.search
.annotations
.Field
;
26 import org
.hibernate
.search
.annotations
.Indexed
;
27 import org
.hibernate
.validator
.constraints
.Length
;
28 import org
.springframework
.beans
.factory
.annotation
.Configurable
;
30 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
31 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
32 import eu
.etaxonomy
.cdm
.strategy
.cache
.name
.INameCacheStrategy
;
33 import eu
.etaxonomy
.cdm
.validation
.annotation
.NullOrNotEmpty
;
36 * The taxon name class for viral taxa. The scientific name will be stored
37 * as a string (consisting eventually of several words even combined also with
38 * non alphabetical characters) in the inherited {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#setTitleCache(String) titleCache} attribute.
39 * Classification has no influence on the names of viral taxon names and no
40 * viral taxon must be taxonomically included in another viral taxon with
41 * higher rank. For examples see ICTVdb:
42 * "http://www.ncbi.nlm.nih.gov/ICTVdb/Ictv/vn_indxA.htm"
44 * This class corresponds to: NameViral according to the ABCD schema.
48 * @created 08-Nov-2007 13:07:02
50 @XmlAccessorType(XmlAccessType
.FIELD
)
51 @XmlType(name
= "", propOrder
= {
54 @XmlRootElement(name
= "ViralName")
56 @Indexed(index
= "eu.etaxonomy.cdm.model.name.TaxonNameBase")
59 public class ViralName
extends TaxonNameBase
<ViralName
, INameCacheStrategy
<ViralName
>> implements Cloneable
{
60 private static final long serialVersionUID
= 4516625507432071817L;
61 private static final Logger logger
= Logger
.getLogger(ViralName
.class);
65 // protected INameCacheStrategy<ViralName> cacheStrategy;
67 @XmlElement(name
= "Acronym")
72 private String acronym
;
74 // ************* CONSTRUCTORS *************/
76 protected ViralName(){
81 * Class constructor: creates a new viral taxon name instance
82 * only containing its {@link Rank rank}.
84 * @param rank the rank to be assigned to <i>this</i> viral taxon name
85 * @see TaxonNameBase#TaxonNameBase(Rank)
87 public ViralName(Rank rank
) {
91 //***********************
93 private static Map
<String
, java
.lang
.reflect
.Field
> allFields
= null;
95 protected Map
<String
, java
.lang
.reflect
.Field
> getAllFields(){
96 if (allFields
== null){
97 allFields
= CdmUtils
.getAllFields(this.getClass(), CdmBase
.class, false, false, false, true);
102 //*************************
104 //********* METHODS **************************************/
107 * Creates a new viral taxon name instance only containing its {@link Rank rank}.
109 * @param rank the rank to be assigned to <i>this</i> viral taxon name
110 * @see #ViralName(Rank)
112 public static ViralName
NewInstance(Rank rank
){
113 return new ViralName(rank
);
117 * Returns the accepted acronym (an assigned abbreviation) string for <i>this</i>
118 * viral taxon name. For instance PCV stays for Peanut Clump Virus.
120 * @return the string containing the accepted acronym of <i>this</i> viral taxon name
122 public String
getAcronym(){
128 public void setAcronym(String acronym
){
129 this.acronym
= acronym
;
133 * Generates and returns the string with the scientific name of <i>this</i>
134 * viral taxon name. This string may be stored in the inherited
135 * {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache() titleCache} attribute.
136 * This method overrides the generic and inherited
137 * method from {@link TaxonNameBase TaxonNameBase} .
139 * @return the string with the composed name of <i>this</i> viral taxon name with authorship (and maybe year)
140 * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle()
141 * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
142 * @see TaxonNameBase#generateTitle()
145 // public String generateTitle(){
146 // logger.warn("not yet implemented");
147 // return this.toString();
151 public String
generateFullTitle(){
152 logger
.warn("not yet implemented");
153 return this.toString();
157 * Returns the boolean value "true" if the components of <i>this</i> viral taxon name
158 * follow the rules of the corresponding
159 * {@link NomenclaturalCode International Code of Virus Classification and Nomenclature},
161 * This method overrides and implements the isCodeCompliant method from
162 * the abstract {@link TaxonNameBase#isCodeCompliant() TaxonNameBase} class.
164 * @return the boolean value expressing the compliance of <i>this</i> viral taxon name to its nomenclatural code
165 * @see TaxonNameBase#isCodeCompliant()
169 public boolean isCodeCompliant() {
170 logger
.warn("not yet implemented");
176 * Returns the {@link NomenclaturalCode nomenclatural code} that governs
177 * the construction of <i>this</i> viral taxon name, that is the
178 * International Code of Virus Classification and Nomenclature.
179 * This method overrides the getNomeclaturalCode method from {@link TaxonNameBase TaxonNameBase}.
181 * @return the nomenclatural code for viruses
182 * @see #isCodeCompliant()
183 * @see TaxonNameBase#getHasProblem()
184 * @see TaxonNameBase#getNomenclaturalCode()
187 public NomenclaturalCode
getNomenclaturalCode(){
188 return NomenclaturalCode
.ICVCN
;
193 * Returns the {@link eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy cache strategy} used to generate
194 * several strings corresponding to <i>this</i> viral taxon name.
196 * @return the cache strategy used for <i>this</i> viral taxon name
197 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
198 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
202 // public INameCacheStrategy getCacheStrategy() {
203 // return cacheStrategy;
208 * @see #getCacheStrategy()
211 // public void setCacheStrategy(INameCacheStrategy cacheStrategy) {
212 // this.cacheStrategy = cacheStrategy;
216 //*********************** CLONE ********************************************************/
219 * Clones <i>this</i> viral name. This is a shortcut that enables to create
220 * a new instance that differs only slightly from <i>this</i> viral name by
221 * modifying only some of the attributes.
223 * @see eu.etaxonomy.cdm.model.name.TaxonNameBase#clone()
224 * @see java.lang.Object#clone()
227 public Object
clone() {
228 ViralName result
= (ViralName
)super.clone();
229 //no changes to: acronym