NomenclaturalCode -> enum
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / name / ViralName.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.Transient;
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlElement;
18 import javax.xml.bind.annotation.XmlRootElement;
19 import javax.xml.bind.annotation.XmlTransient;
20 import javax.xml.bind.annotation.XmlType;
21
22 import org.apache.log4j.Logger;
23
24 import eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy;
25
26 /**
27 * The taxon name class for viral taxa. The scientific name will be stored
28 * as a string (consisting eventually of several words even combined also with
29 * non alphabetical characters) in the inherited {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#setTitleCache(String) titleCache} attribute.
30 * Classification has no influence on the names of viral taxon names and no
31 * viral taxon must be taxonomically included in another viral taxon with
32 * higher rank. For examples see ICTVdb:
33 * "http://www.ncbi.nlm.nih.gov/ICTVdb/Ictv/vn_indxA.htm"
34 * <P>
35 * This class corresponds to: NameViral according to the ABCD schema.
36 *
37 * @author m.doering
38 * @version 1.0
39 * @created 08-Nov-2007 13:07:02
40 */
41 @XmlAccessorType(XmlAccessType.FIELD)
42 @XmlType(name = "", propOrder = {
43 "acronym"
44 })
45 @XmlRootElement(name = "ViralName")
46 @Entity
47 //@Audited
48 public class ViralName extends TaxonNameBase<ViralName, INameCacheStrategy<ViralName>> {
49
50 private static final Logger logger = Logger.getLogger(ViralName.class);
51
52 @XmlTransient
53 protected INameCacheStrategy<ViralName> cacheStrategy;
54
55 @XmlElement(name = "Acronym")
56 private String acronym;
57
58 // ************* CONSTRUCTORS *************/
59
60 protected ViralName(){
61 super();
62 }
63
64 /**
65 * Class constructor: creates a new viral taxon name instance
66 * only containing its {@link Rank rank}.
67 *
68 * @param rank the rank to be assigned to <i>this</i> viral taxon name
69 * @see TaxonNameBase#TaxonNameBase(Rank)
70 */
71 public ViralName(Rank rank) {
72 super(rank);
73 }
74
75
76 //********* METHODS **************************************/
77
78 /**
79 * Creates a new viral taxon name instance only containing its {@link Rank rank}.
80 *
81 * @param rank the rank to be assigned to <i>this</i> viral taxon name
82 * @see #ViralName(Rank)
83 */
84 public static ViralName NewInstance(Rank rank){
85 return new ViralName(rank);
86 }
87
88 /**
89 * Returns the accepted acronym (an assigned abbreviation) string for <i>this</i>
90 * viral taxon name. For instance PCV stays for Peanut Clump Virus.
91 *
92 * @return the string containing the accepted acronym of <i>this</i> viral taxon name
93 */
94 public String getAcronym(){
95 return this.acronym;
96 }
97 /**
98 * @see #getAcronym()
99 */
100 public void setAcronym(String acronym){
101 this.acronym = acronym;
102 }
103
104 /**
105 * Generates and returns the string with the scientific name of <i>this</i>
106 * viral taxon name. This string may be stored in the inherited
107 * {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache() titleCache} attribute.
108 * This method overrides the generic and inherited
109 * method from {@link TaxonNameBase TaxonNameBase} .
110 *
111 * @return the string with the composed name of <i>this</i> viral taxon name with authorship (and maybe year)
112 * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle()
113 * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
114 * @see TaxonNameBase#generateTitle()
115 */
116 @Override
117 public String generateTitle(){
118 logger.warn("not yet implemented");
119 return this.toString();
120 }
121
122 @Override
123 public String generateFullTitle(){
124 logger.warn("not yet implemented");
125 return this.toString();
126 }
127
128 /**
129 * Returns the boolean value "true" if the components of <i>this</i> viral taxon name
130 * follow the rules of the corresponding
131 * {@link NomenclaturalCode International Code of Virus Classification and Nomenclature},
132 * "false" otherwise.
133 * This method overrides and implements the isCodeCompliant method from
134 * the abstract {@link TaxonNameBase#isCodeCompliant() TaxonNameBase} class.
135 *
136 * @return the boolean value expressing the compliance of <i>this</i> viral taxon name to its nomenclatural code
137 * @see TaxonNameBase#isCodeCompliant()
138 */
139 @Override
140 @Transient
141 public boolean isCodeCompliant() {
142 logger.warn("not yet implemented");
143 return false;
144 }
145
146
147 /**
148 * Returns the {@link NomenclaturalCode nomenclatural code} that governs
149 * the construction of <i>this</i> viral taxon name, that is the
150 * International Code of Virus Classification and Nomenclature.
151 * This method overrides the getNomeclaturalCode method from {@link TaxonNameBase TaxonNameBase}.
152 *
153 * @return the nomenclatural code for viruses
154 * @see #isCodeCompliant()
155 * @see TaxonNameBase#getHasProblem()
156 * @see TaxonNameBase#getNomenclaturalCode()
157 */
158 @Transient
159 @Override
160 public NomenclaturalCode getNomenclaturalCode(){
161 return NomenclaturalCode.ICVCN;
162 }
163
164
165 /**
166 * Returns the {@link eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy cache strategy} used to generate
167 * several strings corresponding to <i>this</i> viral taxon name.
168 *
169 * @return the cache strategy used for <i>this</i> viral taxon name
170 * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
171 * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
172 */
173 @Transient
174 @Override
175 public INameCacheStrategy getCacheStrategy() {
176 return cacheStrategy;
177 }
178
179
180 /**
181 * @see #getCacheStrategy()
182 */
183 @Override
184 public void setCacheStrategy(INameCacheStrategy cacheStrategy) {
185 this.cacheStrategy = cacheStrategy;
186 }
187
188 }