Project

General

Profile

Revision 536aae8b

ID536aae8b1ff89fd4e44165697a109c4feac5838a
Parent 02736ff3
Child 8eea91a5

Added by Andreas Müller almost 4 years ago

ref #6364 Move all BacterialName attributes up to TaxonNameBase

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BacterialName.java
13 13
import javax.persistence.Entity;
14 14
import javax.xml.bind.annotation.XmlAccessType;
15 15
import javax.xml.bind.annotation.XmlAccessorType;
16
import javax.xml.bind.annotation.XmlElement;
17 16
import javax.xml.bind.annotation.XmlRootElement;
18 17
import javax.xml.bind.annotation.XmlType;
19 18

  
20 19
import org.apache.log4j.Logger;
21 20
import org.hibernate.envers.Audited;
22
import org.hibernate.search.annotations.Field;
23 21
import org.hibernate.search.annotations.Indexed;
24 22
import org.springframework.beans.factory.annotation.Configurable;
25 23

  
......
31 29
 * This class corresponds to: NameBacterial according to the ABCD schema.
32 30
 *
33 31
 * @author m.doering
34
 * @version 1.0
35 32
 * @created 08-Nov-2007 13:06:11
36 33
 */
37 34
@XmlAccessorType(XmlAccessType.FIELD)
38 35
@XmlType(name = "", propOrder = {
39
    "subGenusAuthorship",
40
    "nameApprobation"
41 36
})
42 37
@XmlRootElement(name = "BacterialName")
43 38
@Entity
......
45 40
@Audited
46 41
@Configurable
47 42
public class BacterialName
48
        extends NonViralName<BacterialName>
49
        implements IBacterialName{
50
	private static final long serialVersionUID = -7641841279209976443L;
51
	@SuppressWarnings("unused")
52
	private static final Logger logger = Logger.getLogger(BacterialName.class);
43
        extends NonViralName<BacterialName>{
53 44

  
54
	//Author team and year of the subgenus name
55
	@XmlElement(name = "SubGenusAuthorship")
56
	@Field
57
	private String subGenusAuthorship;
45
    private static final long serialVersionUID = 5161176481172718843L;
46
    @SuppressWarnings("unused")
47
	private static final Logger logger = Logger.getLogger(BacterialName.class);
58 48

  
59
	//Approbation of name according to approved list, validation list, or validly published, paper in IJSB after 1980
60
	@XmlElement(name = "NameApprobation")
61
	@Field
62
	private String nameApprobation;
63 49

  
64 50
	// ************* CONSTRUCTORS *************/
65 51

  
......
90 76
	}
91 77

  
92 78
	//********* METHODS **************************************/
93
	/**
94
	 * Creates a new bacterial taxon name instance
95
	 * only containing its {@link Rank rank} and
96
 	 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
97
	 *
98
	 * @param  rank  the rank to be assigned to <i>this</i> bacterial taxon name
99
	 * @see    #NewInstance(Rank, HomotypicalGroup)
100
	 * @see    #BacterialName(Rank, HomotypicalGroup)
101
	 * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
102
	 * @see    eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
103
	 * @see    eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
104
	 */
105
	public static BacterialName NewInstance(Rank rank){
106
		return new BacterialName(rank, null);
107
	}
108 79

  
109
	/**
110
	 * Creates a new bacterial taxon name instance
111
	 * only containing its {@link Rank rank},
112
	 * its {@link HomotypicalGroup homotypical group} and
113
 	 * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
114
	 * The new bacterial taxon name instance will be also added to the set of
115
	 * bacterial taxon names belonging to this homotypical group.
116
	 *
117
	 * @param  rank  the rank to be assigned to <i>this</i> bacterial taxon name
118
	 * @param  homotypicalGroup  the homotypical group to which <i>this</i> bacterial taxon name belongs
119
	 * @see    #NewInstance(Rank)
120
	 * @see    #BacterialName(Rank, HomotypicalGroup)
121
	 * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
122
	 * @see    eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
123
	 * @see    eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
124
	 */
125
	public static BacterialName NewInstance(Rank rank, HomotypicalGroup homotypicalGroup){
126
		return new BacterialName(rank, homotypicalGroup);
127
	}
128 80

  
129
	/**
130
	 * Returns the string containing the authorship with the year and details
131
	 * of the reference in which the subgenus included in the scientific name
132
	 * of <i>this</i> bacterial taxon name was published.
133
	 * For instance if the bacterial taxon name is
134
	 * 'Bacillus (subgen. Aerobacillus Donker 1926, 128) polymyxa' the subgenus
135
	 * authorship string is 'Donker 1926, 128'.
136
	 *
137
	 * @return  the string containing the complete subgenus' authorship
138
	 * 			included in <i>this</i> bacterial taxon name
139
	 */
140
	@Override
141
    public String getSubGenusAuthorship(){
142
		return this.subGenusAuthorship;
143
	}
144

  
145
	/**
146
	 * @see  #getSubGenusAuthorship()
147
	 */
148
	@Override
149
    public void setSubGenusAuthorship(String subGenusAuthorship){
150
		this.subGenusAuthorship = subGenusAuthorship;
151
	}
152

  
153
	/**
154
	 * Returns the string representing the reason for the approbation of <i>this</i>
155
	 * bacterial taxon name. Bacterial taxon names are valid or approved
156
	 * according to:
157
	 * <ul>
158
	 * <li>the approved list, c.f.r. IJSB 1980 (AL)
159
	 * <li>the validation list, in IJSB after 1980 (VL)
160
	 * </ul>
161
	 * or
162
	 * <ul>
163
	 * <li>are validly published as paper in IJSB after 1980 (VP).
164
	 * </ul>
165
	 * IJSB is the acronym for International Journal of Systematic Bacteriology.
166
	 *
167
	 * @return  the string with the source of the approbation for <i>this</i> bacterial taxon name
168
	 */
169
	@Override
170
    public String getNameApprobation(){
171
		return this.nameApprobation;
172
	}
173

  
174
	/**
175
	 * @see  #getNameApprobation()
176
	 */
177
	@Override
178
    public void setNameApprobation(String nameApprobation){
179
		this.nameApprobation = nameApprobation;
180
	}
181 81

  
182 82

  
183 83
	/**
......
209 109
	@Override
210 110
	public Object clone() {
211 111
		BacterialName result = (BacterialName)super.clone();
212
		//no changes to: subGenusAuthorship, nameApprobation
112
		//no changes to:
213 113
		return result;
214 114
	}
215 115

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java
143 143
    "binomHybrid",
144 144
    "trinomHybrid",
145 145

  
146
    "acronym"
146
    "acronym",
147

  
148
    "subGenusAuthorship",
149
    "nameApprobation"
147 150
})
148 151
@XmlRootElement(name = "TaxonNameBase")
149 152
@Entity
......
152 155
@Table(appliesTo="TaxonNameBase", indexes = { @org.hibernate.annotations.Index(name = "taxonNameBaseTitleCacheIndex", columnNames = { "titleCache" }),  @org.hibernate.annotations.Index(name = "taxonNameBaseNameCacheIndex", columnNames = { "nameCache" }) })
153 156
public abstract class TaxonNameBase<T extends TaxonNameBase<?,?>, S extends INameCacheStrategy>
154 157
            extends IdentifiableEntity<S>
155
            implements ITaxonNameBase, INonViralName, IViralName,
158
            implements ITaxonNameBase, INonViralName, IViralName, IBacterialName,
156 159
                IParsable, IRelated, IMatchable, Cloneable {
157 160

  
158
    private static final long serialVersionUID = -4530368639601532116L;
161
    private static final long serialVersionUID = -791164269603409712L;
159 162
    private static final Logger logger = Logger.getLogger(TaxonNameBase.class);
160 163

  
161 164
    @XmlElement(name = "FullTitleCache")
......
447 450
    @Column(length=255)
448 451
    private String acronym;
449 452

  
453
// BacterialName attributes ***********************/
454

  
455
    //Author team and year of the subgenus name
456
    @XmlElement(name = "SubGenusAuthorship")
457
    @Field
458
    private String subGenusAuthorship;
459

  
460
    //Approbation of name according to approved list, validation list, or validly published, paper in IJSB after 1980
461
    @XmlElement(name = "NameApprobation")
462
    @Field
463
    private String nameApprobation;
464

  
450 465
// *************** FACTORY METHODS ********************************/
451 466

  
452 467
    /**
......
500 515
        return new ViralName(rank);
501 516
    }
502 517

  
518
    /**
519
     * Creates a new bacterial taxon name instance
520
     * only containing its {@link Rank rank} and
521
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
522
     *
523
     * @param  rank  the rank to be assigned to <i>this</i> bacterial taxon name
524
     * @see    #NewInstance(Rank, HomotypicalGroup)
525
     * @see    #BacterialName(Rank, HomotypicalGroup)
526
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
527
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
528
     * @see    eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
529
     */
530
    public static BacterialName NewBacterialInstance(Rank rank){
531
        return new BacterialName(rank, null);
532
    }
533

  
534
    /**
535
     * Creates a new bacterial taxon name instance
536
     * only containing its {@link Rank rank},
537
     * its {@link HomotypicalGroup homotypical group} and
538
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
539
     * The new bacterial taxon name instance will be also added to the set of
540
     * bacterial taxon names belonging to this homotypical group.
541
     *
542
     * @param  rank  the rank to be assigned to <i>this</i> bacterial taxon name
543
     * @param  homotypicalGroup  the homotypical group to which <i>this</i> bacterial taxon name belongs
544
     * @see    #NewInstance(Rank)
545
     * @see    #BacterialName(Rank, HomotypicalGroup)
546
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
547
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
548
     * @see    eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
549
     */
550
    public static BacterialName NewBacterialInstance(Rank rank, HomotypicalGroup homotypicalGroup){
551
        return new BacterialName(rank, homotypicalGroup);
552
    }
553

  
503 554
// ************* CONSTRUCTORS *************/
504 555
    /**
505 556
     * Class constructor: creates a new empty taxon name.
......
1138 1189
        this.acronym = StringUtils.isBlank(acronym)? null : acronym;
1139 1190
    }
1140 1191

  
1192
    // ****************** BACTERIAL NAME ******************/
1193

  
1194
    /**
1195
     * Returns the string containing the authorship with the year and details
1196
     * of the reference in which the subgenus included in the scientific name
1197
     * of <i>this</i> bacterial taxon name was published.
1198
     * For instance if the bacterial taxon name is
1199
     * 'Bacillus (subgen. Aerobacillus Donker 1926, 128) polymyxa' the subgenus
1200
     * authorship string is 'Donker 1926, 128'.
1201
     *
1202
     * @return  the string containing the complete subgenus' authorship
1203
     *          included in <i>this</i> bacterial taxon name
1204
     */
1205
    @Override
1206
    public String getSubGenusAuthorship(){
1207
        return this.subGenusAuthorship;
1208
    }
1209

  
1210
    /**
1211
     * @see  #getSubGenusAuthorship()
1212
     */
1213
    @Override
1214
    public void setSubGenusAuthorship(String subGenusAuthorship){
1215
        this.subGenusAuthorship = subGenusAuthorship;
1216
    }
1217

  
1218
    /**
1219
     * Returns the string representing the reason for the approbation of <i>this</i>
1220
     * bacterial taxon name. Bacterial taxon names are valid or approved
1221
     * according to:
1222
     * <ul>
1223
     * <li>the approved list, c.f.r. IJSB 1980 (AL)
1224
     * <li>the validation list, in IJSB after 1980 (VL)
1225
     * </ul>
1226
     * or
1227
     * <ul>
1228
     * <li>are validly published as paper in IJSB after 1980 (VP).
1229
     * </ul>
1230
     * IJSB is the acronym for International Journal of Systematic Bacteriology.
1231
     *
1232
     * @return  the string with the source of the approbation for <i>this</i> bacterial taxon name
1233
     */
1234
    @Override
1235
    public String getNameApprobation(){
1236
        return this.nameApprobation;
1237
    }
1238

  
1239
    /**
1240
     * @see  #getNameApprobation()
1241
     */
1242
    @Override
1243
    public void setNameApprobation(String nameApprobation){
1244
        this.nameApprobation = nameApprobation;
1245
    }
1246

  
1141 1247
// **************** ADDER / REMOVE *************************/
1142 1248

  
1143 1249
    /**
......
3212 3318
            //protectedAuthorshipCache, protectedNameCache,
3213 3319
            //binomHybrid, monomHybrid, trinomHybrid, hybridFormula,
3214 3320
            //acronym
3321
            //subGenusAuthorship, nameApprobation
3215 3322
            return result;
3216 3323
        } catch (CloneNotSupportedException e) {
3217 3324
            logger.warn("Object does not implement cloneable");
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/ViralName.java
45 45
@Configurable
46 46
public class ViralName
47 47
            extends TaxonNameBase<ViralName, INameCacheStrategy<ViralName>> {
48
	private static final long serialVersionUID = 4516625507432071817L;
49

  
48
    private static final long serialVersionUID = -6201649691028218290L;
50 49

  
51 50
// ************* CONSTRUCTORS *************/
52 51

  
53
	protected ViralName(){
52
    protected ViralName(){
54 53
		super();
55 54
	}
56 55

  
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/BacterialNameTest.java
1 1
/**
2 2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
22 22
public class BacterialNameTest {
23 23
	@SuppressWarnings("unused")
24 24
	private static final Logger logger = Logger.getLogger(BacterialNameTest.class);
25
	
25

  
26 26
	private BacterialName bacterialName1;
27
	
27

  
28 28
	/**
29 29
	 * @throws java.lang.Exception
30 30
	 */
......
37 37
	 */
38 38
	@Before
39 39
	public void setUp() throws Exception {
40
		bacterialName1 = BacterialName.NewInstance(Rank.SPECIES());
40
		bacterialName1 = TaxonNameBase.NewBacterialInstance(Rank.SPECIES());
41 41
	}
42 42

  
43 43
//****************** TESTS ******************************************/
44
	
44

  
45 45
	/**
46 46
	 * Test method for {@link eu.etaxonomy.cdm.model.name.BacterialName#clone()}.
47 47
	 */
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/data/FullCoverageDataGenerator.java
811 811

  
812 812

  
813 813
	private void createTaxonName(List<CdmBase> cdmBases) {
814
		BacterialName bacName = BacterialName.NewInstance(Rank.GENUS());
814
		BacterialName bacName = TaxonNameBase.NewBacterialInstance(Rank.GENUS());
815 815
		bacName.setSubGenusAuthorship("sub Genus author");
816 816
		bacName.setNameApprobation("nameApprobation");
817 817
		handleIdentifiableEntity(bacName);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)