added ranks proles, race and sublusus #2793 (II)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / name / BacterialName.java
index 1be8bcdaf813fde19a02ef224813ec041a3f044b..6b747bd77ce2343aded49fb8c5a93ef5be72964e 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * 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 javax.persistence.*;
+import javax.persistence.Entity;
 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.springframework.beans.factory.annotation.Configurable;
+
+import eu.etaxonomy.cdm.strategy.cache.name.BacterialNameDefaultCacheStrategy;
+
 /**
  * The taxon name class for bacteria.
- * 
+ * <P>
+ * This class corresponds to: NameBacterial according to the ABCD schema.
+ *
  * @author m.doering
  * @version 1.0
  * @created 08-Nov-2007 13:06:11
@@ -33,29 +41,41 @@ import javax.xml.bind.annotation.XmlType;
 })
 @XmlRootElement(name = "BacterialName")
 @Entity
-public class BacterialName extends NonViralName {
-       
-       static Logger logger = Logger.getLogger(BacterialName.class);
+@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
+@Audited
+@Configurable
+public class BacterialName extends NonViralName<BacterialName> implements Cloneable{
+       private static final long serialVersionUID = -7641841279209976443L;
+       @SuppressWarnings("unused")
+       private static final Logger logger = Logger.getLogger(BacterialName.class);
 
        //Author team and year of the subgenus name
        @XmlElement(name = "SubGenusAuthorship")
+       @Field
        private String subGenusAuthorship;
-       
+
        //Approbation of name according to approved list, validation list, or validly published, paper in IJSB after 1980
        @XmlElement(name = "NameApprobation")
+       @Field
        private String nameApprobation;
 
-       // ************* CONSTRUCTORS *************/    
-       /** 
+       // ************* CONSTRUCTORS *************/
+
+       protected BacterialName(){
+               super();
+               this.cacheStrategy = BacterialNameDefaultCacheStrategy.NewInstance();
+       }
+
+       /**
         * Class constructor: creates a new bacterial taxon name instance
-        * only containing its {@link common.Rank rank},
+        * only containing its {@link Rank rank},
         * its {@link HomotypicalGroup homotypical group} and
         * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
         * The new bacterial taxon name instance will be also added to the set of
         * bacterial taxon names belonging to this homotypical group.
-        * 
-        * @param       rank  the rank to be assigned to this bacterial taxon name
-        * @param       homotypicalGroup  the homotypical group to which this bacterial taxon name belongs
+        *
+        * @param       rank  the rank to be assigned to <i>this</i> bacterial taxon name
+        * @param       homotypicalGroup  the homotypical group to which <i>this</i> bacterial taxon name belongs
         * @see         #NewInstance(Rank)
         * @see         #NewInstance(Rank, HomotypicalGroup)
         * @see         eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
@@ -64,15 +84,16 @@ public class BacterialName extends NonViralName {
         */
        protected BacterialName(Rank rank, HomotypicalGroup homotypicalGroup) {
                super(rank, homotypicalGroup);
+               this.cacheStrategy = BacterialNameDefaultCacheStrategy.NewInstance();
        }
 
        //********* METHODS **************************************/
-       /** 
+       /**
         * Creates a new bacterial taxon name instance
-        * only containing its {@link common.Rank rank} and 
+        * only containing its {@link Rank rank} and
         * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
-        * 
-        * @param  rank  the rank to be assigned to this bacterial taxon name
+        *
+        * @param  rank  the rank to be assigned to <i>this</i> bacterial taxon name
         * @see    #NewInstance(Rank, HomotypicalGroup)
         * @see    #BacterialName(Rank, HomotypicalGroup)
         * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
@@ -83,16 +104,16 @@ public class BacterialName extends NonViralName {
                return new BacterialName(rank, null);
        }
 
-       /** 
+       /**
         * Creates a new bacterial taxon name instance
-        * only containing its {@link common.Rank rank},
-        * its {@link HomotypicalGroup homotypical group} and 
+        * only containing its {@link Rank rank},
+        * its {@link HomotypicalGroup homotypical group} and
         * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
         * The new bacterial taxon name instance will be also added to the set of
         * bacterial taxon names belonging to this homotypical group.
-        * 
-        * @param  rank  the rank to be assigned to this bacterial taxon name
-        * @param  homotypicalGroup  the homotypical group to which this bacterial taxon name belongs
+        *
+        * @param  rank  the rank to be assigned to <i>this</i> bacterial taxon name
+        * @param  homotypicalGroup  the homotypical group to which <i>this</i> bacterial taxon name belongs
         * @see    #NewInstance(Rank)
         * @see    #BacterialName(Rank, HomotypicalGroup)
         * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
@@ -102,17 +123,17 @@ public class BacterialName extends NonViralName {
        public static BacterialName NewInstance(Rank rank, HomotypicalGroup homotypicalGroup){
                return new BacterialName(rank, homotypicalGroup);
        }
-       
+
        /**
         * Returns the string containing the authorship with the year and details
         * of the reference in which the subgenus included in the scientific name
-        * of this bacterial taxon name was published.
+        * of <i>this</i> bacterial taxon name was published.
         * For instance if the bacterial taxon name is
         * 'Bacillus (subgen. Aerobacillus Donker 1926, 128) polymyxa' the subgenus
-        * authorship string is 'Donker 1926, 128'. 
-        * 
+        * authorship string is 'Donker 1926, 128'.
+        *
         * @return  the string containing the complete subgenus' authorship
-        *                      included in this bacterial taxon name
+        *                      included in <i>this</i> bacterial taxon name
         */
        public String getSubGenusAuthorship(){
                return this.subGenusAuthorship;
@@ -126,16 +147,20 @@ public class BacterialName extends NonViralName {
        }
 
        /**
-        * Returns the string representing the reason for the approbation of this
+        * Returns the string representing the reason for the approbation of <i>this</i>
         * bacterial taxon name. Bacterial taxon names are valid or approved
         * according to:
-        * - the approved list, c.f.r. IJSB 1980 (AL)
-        * - the validation list, in IJSB after 1980 (VL)
+        * <ul>
+        * <li>the approved list, c.f.r. IJSB 1980 (AL)
+        * <li>the validation list, in IJSB after 1980 (VL)
+        * </ul>
         * or
-        * - are validly published as paper in IJSB after 1980 (VP).
+        * <ul>
+        * <li>are validly published as paper in IJSB after 1980 (VP).
+        * </ul>
         * IJSB is the acronym for International Journal of Systematic Bacteriology.
-        * 
-        * @return  the string with the source of the approbation for this bacterial taxon name
+        *
+        * @return  the string with the source of the approbation for <i>this</i> bacterial taxon name
         */
        public String getNameApprobation(){
                return this.nameApprobation;
@@ -147,23 +172,39 @@ public class BacterialName extends NonViralName {
        public void setNameApprobation(String nameApprobation){
                this.nameApprobation = nameApprobation;
        }
-       
-       
+
+
        /**
         * Returns the {@link NomenclaturalCode nomenclatural code} that governs
-        * the construction of this bacterial taxon name, that is the
+        * the construction of <i>this</i> bacterial taxon name, that is the
         * International Code of Nomenclature of Bacteria. This method overrides
-        * the getNomeclaturalCode method from {@link NonViralName#getNomeclaturalCode() NonViralName}.
+        * the getNomeclaturalCode method from {@link NonViralName NonViralName}.
         *
         * @return  the nomenclatural code for bacteria
         * @see         NonViralName#isCodeCompliant()
         * @see         TaxonNameBase#getHasProblem()
         */
-       @Transient
        @Override
        public NomenclaturalCode getNomenclaturalCode(){
-               return NomenclaturalCode.BACTERIOLOGICAL();
+               return NomenclaturalCode.ICNB;
 
        }
 
-}
\ No newline at end of file
+//*********************** CLONE ********************************************************/
+
+       /**
+        * Clones <i>this</i> bacterial name. This is a shortcut that enables to create
+        * a new instance that differs only slightly from <i>this</i> bacterial name by
+        * modifying only some of the attributes.
+        *
+        * @see eu.etaxonomy.cdm.model.name.NonViralName#clone()
+        * @see java.lang.Object#clone()
+        */
+       @Override
+       public Object clone() {
+               BacterialName result = (BacterialName)super.clone();
+               //no changes to: subGenusAuthorship, nameApprobation
+               return result;
+       }
+
+}