Project

General

Profile

Download (8.88 KB) Statistics
| Branch: | Tag: | Revision:
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.xml.bind.annotation.XmlAccessType;
15
import javax.xml.bind.annotation.XmlAccessorType;
16
import javax.xml.bind.annotation.XmlElement;
17
import javax.xml.bind.annotation.XmlRootElement;
18
import javax.xml.bind.annotation.XmlType;
19

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

    
25
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
26
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
27
import eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy;
28

    
29
/**
30
 * The taxon name class for plants and fungi.
31
 * <P>
32
 * This class corresponds to: NameBotanical according to the ABCD schema.
33
 *
34
 * @author m.doering
35
 * @created 08-Nov-2007 13:06:15
36
 */
37
@XmlAccessorType(XmlAccessType.FIELD)
38
@XmlType(name = "BotanicalName", propOrder = {
39
        "anamorphic"
40
})
41
@XmlRootElement(name = "BotanicalName")
42
@Entity
43
@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
44
@Audited
45
@Configurable
46
public class BotanicalName
47
            extends NonViralName<BotanicalName>
48
            /*, IMergable*/ {
49
    private static final long serialVersionUID = -3484146190510367749L;
50
    @SuppressWarnings("unused")
51
	private static final Logger logger = Logger.getLogger(BotanicalName.class);
52

    
53
//    IBotanicalName,
54

    
55
    //ICNAFP
56

    
57
    //Only for fungi: to indicate that the type of the name is asexual or not
58
    @XmlElement(name ="IsAnamorphic")
59
    private boolean anamorphic = false;
60

    
61
    // ************* ICNAFP Names
62

    
63
    /**
64
     * Returns the boolean value of the flag indicating whether the specimen
65
     * type of <i>this</i> botanical taxon name for a fungus is asexual (true) or not
66
     * (false). This applies only in case of fungi. The Article 59 of the ICBN
67
     * permits mycologists to give asexually reproducing fungi (anamorphs)
68
     * separate names from their sexual states (teleomorphs).
69
     *
70
     * @return  the boolean value of the isAnamorphic flag
71
     */
72
    public boolean isAnamorphic(){
73
        return this.anamorphic;
74
    }
75

    
76
    /**
77
     * @see  #isAnamorphic()
78
     */
79
    public void setAnamorphic(boolean anamorphic){
80
        this.anamorphic = anamorphic;
81
    }
82

    
83
	// ************* CONSTRUCTORS *************/
84
	//needed by hibernate
85
	/**
86
	 * Class constructor: creates a new botanical taxon name instance
87
	 * only containing the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
88
	 *
89
	 * @see #BotanicalName(Rank, HomotypicalGroup)
90
	 * @see #BotanicalName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
91
	 * @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
92
	 */
93
	protected BotanicalName(){
94
		super();
95
		this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance();
96
	}
97
	/**
98
	 * Class constructor: creates a new botanical taxon name instance
99
	 * only containing its {@link Rank rank},
100
	 * its {@link HomotypicalGroup homotypical group} and
101
	 * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
102
	 * The new botanical taxon name instance will be also added to the set of
103
	 * botanical taxon names belonging to this homotypical group.
104
	 *
105
	 * @param	rank  the rank to be assigned to <i>this</i> botanical taxon name
106
	 * @param	homotypicalGroup  the homotypical group to which <i>this</i> botanical taxon name belongs
107
	 * @see 	#BotanicalName()
108
	 * @see 	#BotanicalName(Rank, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
109
	 * @see 	eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
110
	 */
111
	protected BotanicalName(Rank rank, HomotypicalGroup homotypicalGroup) {
112
		super(rank, homotypicalGroup);
113
		this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance();
114
	}
115
	/**
116
	 * Class constructor: creates a new botanical taxon name instance
117
	 * containing its {@link Rank rank},
118
	 * its {@link HomotypicalGroup homotypical group},
119
	 * its scientific name components, its {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase author(team)},
120
	 * its {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} and
121
	 * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
122
	 * The new botanical taxon name instance will be also added to the set of
123
	 * botanical taxon names belonging to this homotypical group.
124
	 *
125
	 * @param	rank  the rank to be assigned to <i>this</i> botanical taxon name
126
	 * @param	genusOrUninomial the string for <i>this</i> botanical taxon name
127
	 * 			if its rank is genus or higher or for the genus part
128
	 * 			if its rank is lower than genus
129
	 * @param	infraGenericEpithet  the string for the first epithet of
130
	 * 			<i>this</i> botanical taxon name if its rank is lower than genus
131
	 * 			and higher than species aggregate
132
	 * @param	specificEpithet  the string for the first epithet of
133
	 * 			<i>this</i> botanical taxon name if its rank is species aggregate or lower
134
	 * @param	infraSpecificEpithet  the string for the second epithet of
135
	 * 			<i>this</i> botanical taxon name if its rank is lower than species
136
	 * @param	combinationAuthorship  the author or the team who published <i>this</i> botanical taxon name
137
	 * @param	nomenclaturalReference  the nomenclatural reference where <i>this</i> botanical taxon name was published
138
	 * @param	nomenclMicroRef  the string with the details for precise location within the nomenclatural reference
139
	 * @param	homotypicalGroup  the homotypical group to which <i>this</i> botanical taxon name belongs
140
	 * @see 	#BotanicalName()
141
	 * @see 	#BotanicalName(Rank, HomotypicalGroup)
142
	 * @see		#NewBotanicalInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
143
	 * @see 	eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
144
	 * @see 	eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
145
	 * @see 	eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
146
	 */
147
	protected BotanicalName(Rank rank, String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet, TeamOrPersonBase combinationAuthorship, INomenclaturalReference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) {
148
		super(rank, genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet, combinationAuthorship, nomenclaturalReference, nomenclMicroRef, homotypicalGroup);
149
		this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance();
150
	}
151

    
152

    
153
//*************************
154

    
155

    
156

    
157
	/**
158
	 * Returns the {@link NomenclaturalCode nomenclatural code} that governs
159
	 * the construction of <i>this</i> botanical taxon name, that is the
160
	 * International Code of Botanical Nomenclature. This method overrides
161
	 * the getNomenclaturalCode method from {@link INonViralName NonViralName}.
162
	 *
163
	 * @return  the nomenclatural code for plants
164
	 * @see  	NonViralName#isCodeCompliant()
165
	 * @see  	TaxonNameBase#getHasProblem()
166
	 */
167
	@Override
168
	public NomenclaturalCode getNomenclaturalCode(){
169
		return NomenclaturalCode.ICNAFP;
170
	}
171

    
172

    
173
	/**
174
	 * Checks if this name is an autonym.<BR>
175
	 * An autonym is a taxon name that has equal specific and infra specific epithets.<BR>
176
	 * {@link http://ibot.sav.sk/icbn/frameset/0010Ch2Sec1a006.htm#6.8. Vienna Code §6.8}
177
	 * or a taxon name that has equal generic and infrageneric epithets (A22.2)
178
	 * @return true, if name has Rank, Rank is below species and species epithet equals infraSpeciesEpithtet, else false
179
	 */
180
	@Override
181
	public boolean isAutonym(){
182
		if (this.getRank() != null && this.getSpecificEpithet() != null && this.getInfraSpecificEpithet() != null &&
183
				this.isInfraSpecific() && this.getSpecificEpithet().trim().equals(this.getInfraSpecificEpithet().trim())){
184
			return true;
185
		}else if (this.getRank() != null && this.getGenusOrUninomial() != null && this.getInfraGenericEpithet() != null &&
186
				this.isInfraGeneric() && this.getGenusOrUninomial().trim().equals(this.getInfraGenericEpithet().trim())){
187
			return true;
188
		}else{
189
			return false;
190
		}
191
	}
192

    
193
//*********************** CLONE ********************************************************/
194

    
195
	/**
196
	 * Clones <i>this</i> botanical name. This is a shortcut that enables to create
197
	 * a new instance that differs only slightly from <i>this</i> botanical name by
198
	 * modifying only some of the attributes.
199
	 *
200
	 * @see eu.etaxonomy.cdm.model.name.NonViralName#clone()
201
	 * @see java.lang.Object#clone()
202
	 */
203
	@Override
204
	public Object clone() {
205
		IBotanicalName result = (IBotanicalName)super.clone();
206
		//no changes to:
207
		return result;
208
	}
209

    
210

    
211
}
(2-2/37)