/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
package eu.etaxonomy.cdm.model.name;
-import org.apache.log4j.Logger;
+import java.util.Map;
-import eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy;
-import javax.persistence.*;
+import javax.persistence.Entity;
+import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.apache.log4j.Logger;
+import org.hibernate.envers.Audited;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.validator.constraints.Length;
+import org.springframework.beans.factory.annotation.Configurable;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy;
+import eu.etaxonomy.cdm.validation.annotation.NullOrNotEmpty;
+
/**
* The taxon name class for viral taxa. The scientific name will be stored
* as a string (consisting eventually of several words even combined also with
* "http://www.ncbi.nlm.nih.gov/ICTVdb/Ictv/vn_indxA.htm"
* <P>
* This class corresponds to: NameViral according to the ABCD schema.
- *
+ *
* @author m.doering
* @version 1.0
* @created 08-Nov-2007 13:07:02
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
- "cacheStrategy",
"acronym"
})
@XmlRootElement(name = "ViralName")
@Entity
-public class ViralName extends TaxonNameBase<ViralName, INameCacheStrategy> {
-
+@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
+@Audited
+@Configurable
+public class ViralName extends TaxonNameBase<ViralName, INameCacheStrategy<ViralName>> implements Cloneable {
+ private static final long serialVersionUID = 4516625507432071817L;
private static final Logger logger = Logger.getLogger(ViralName.class);
- @XmlElement(name = "CacheStrategy")
- protected INameCacheStrategy cacheStrategy;
+// @XmlTransient
+// @Transient
+// protected INameCacheStrategy<ViralName> cacheStrategy;
+
@XmlElement(name = "Acronym")
+ @Field
+ //TODO Val #3379
+// @NullOrNotEmpty
+ @Length(max = 255)
private String acronym;
- // ************* CONSTRUCTORS *************/
- /**
+ // ************* CONSTRUCTORS *************/
+
+ protected ViralName(){
+ super();
+ }
+
+ /**
* Class constructor: creates a new viral taxon name instance
* only containing its {@link Rank rank}.
- *
+ *
* @param rank the rank to be assigned to <i>this</i> viral taxon name
* @see TaxonNameBase#TaxonNameBase(Rank)
*/
super(rank);
}
-
+//***********************
+
+ private static Map<String, java.lang.reflect.Field> allFields = null;
+ @Override
+ protected Map<String, java.lang.reflect.Field> getAllFields(){
+ if (allFields == null){
+ allFields = CdmUtils.getAllFields(this.getClass(), CdmBase.class, false, false, false, true);
+ }
+ return allFields;
+ }
+
+//*************************
+
//********* METHODS **************************************/
- /**
+ /**
* Creates a new viral taxon name instance only containing its {@link Rank rank}.
- *
+ *
* @param rank the rank to be assigned to <i>this</i> viral taxon name
* @see #ViralName(Rank)
*/
/**
* Returns the accepted acronym (an assigned abbreviation) string for <i>this</i>
* viral taxon name. For instance PCV stays for Peanut Clump Virus.
- *
+ *
* @return the string containing the accepted acronym of <i>this</i> viral taxon name
*/
public String getAcronym(){
* @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
* @see TaxonNameBase#generateTitle()
*/
+// @Override
+// public String generateTitle(){
+// logger.warn("not yet implemented");
+// return this.toString();
+// }
+
@Override
- public String generateTitle(){
+ public String generateFullTitle(){
logger.warn("not yet implemented");
return this.toString();
}
* "false" otherwise.
* This method overrides and implements the isCodeCompliant method from
* the abstract {@link TaxonNameBase#isCodeCompliant() TaxonNameBase} class.
- *
+ *
* @return the boolean value expressing the compliance of <i>this</i> viral taxon name to its nomenclatural code
* @see TaxonNameBase#isCodeCompliant()
*/
logger.warn("not yet implemented");
return false;
}
-
-
+
+
/**
* Returns the {@link NomenclaturalCode nomenclatural code} that governs
* the construction of <i>this</i> viral taxon name, that is the
* @see TaxonNameBase#getHasProblem()
* @see TaxonNameBase#getNomenclaturalCode()
*/
- @Transient
@Override
public NomenclaturalCode getNomenclaturalCode(){
- return NomenclaturalCode.ICVCN();
+ return NomenclaturalCode.ICVCN;
}
/**
* Returns the {@link eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy cache strategy} used to generate
* several strings corresponding to <i>this</i> viral taxon name.
- *
+ *
* @return the cache strategy used for <i>this</i> viral taxon name
* @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
* @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
*/
- @Transient
- @Override
- public INameCacheStrategy getCacheStrategy() {
- return cacheStrategy;
- }
+// @Override
+// @Transient
+// public INameCacheStrategy getCacheStrategy() {
+// return cacheStrategy;
+// }
/**
* @see #getCacheStrategy()
*/
+// @Override
+// public void setCacheStrategy(INameCacheStrategy cacheStrategy) {
+// this.cacheStrategy = cacheStrategy;
+// }
+
+
+//*********************** CLONE ********************************************************/
+
+ /**
+ * Clones <i>this</i> viral name. This is a shortcut that enables to create
+ * a new instance that differs only slightly from <i>this</i> viral name by
+ * modifying only some of the attributes.
+ *
+ * @see eu.etaxonomy.cdm.model.name.TaxonNameBase#clone()
+ * @see java.lang.Object#clone()
+ */
@Override
- public void setCacheStrategy(INameCacheStrategy cacheStrategy) {
- this.cacheStrategy = cacheStrategy;
+ public Object clone() {
+ ViralName result = (ViralName)super.clone();
+ //no changes to: acronym
+ return result;
}
-
}