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