Project

General

Profile

Download (6.1 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
import java.util.Map;
13

    
14
import org.apache.log4j.Logger;
15
import org.hibernate.envers.Audited;
16
import org.hibernate.search.annotations.Indexed;
17
import org.springframework.beans.factory.annotation.Configurable;
18

    
19
import eu.etaxonomy.cdm.common.CdmUtils;
20
import eu.etaxonomy.cdm.model.common.CdmBase;
21

    
22
import javax.persistence.*;
23
import javax.xml.bind.annotation.XmlAccessType;
24
import javax.xml.bind.annotation.XmlAccessorType;
25
import javax.xml.bind.annotation.XmlElement;
26
import javax.xml.bind.annotation.XmlRootElement;
27
import javax.xml.bind.annotation.XmlType;
28

    
29
/**
30
 * The taxon name class for cultivars (cultivated plants). The only possible
31
 * {@link Rank ranks} for cultivars are CULTIVAR, GREX, CONVAR, CULTIVAR_GROUP,
32
 * GRAFT_CHIMAERA or DENOMINATION_CLASS.
33
 * <P>
34
 * This class corresponds partially to: NameBotanical according to the
35
 * ABCD schema.
36
 * 
37
 * @author m.doering
38
 * @version 1.0
39
 * @created 08-Nov-2007 13:06:18
40
 */
41
@XmlAccessorType(XmlAccessType.FIELD)
42
@XmlType(name = "", propOrder = {
43
    "cultivarName"
44
})
45
@XmlRootElement(name = "CultivarPlantName")
46
@Entity
47
@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
48
@Audited
49
@Configurable
50
public class CultivarPlantName extends BotanicalName {
51
	static Logger logger = Logger.getLogger(CultivarPlantName.class);
52
	
53
	//the characteristical name of the cultivar
54
    @XmlElement(name = "CultivarName", required = true)
55
	private String cultivarName;
56

    
57
	// ************* CONSTRUCTORS *************/	
58
	/** 
59
	 * Class constructor: creates a new cultivar taxon name instance
60
	 * only containing the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
61
	 * 
62
	 * @see #CultivarPlantName(Rank, HomotypicalGroup)
63
	 * @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
64
	 */
65
	public CultivarPlantName(){
66
		super();
67
	}
68

    
69
	/** 
70
	 * Class constructor: creates a new cultivar taxon name instance
71
	 * only containing its {@link Rank rank},
72
	 * its {@link HomotypicalGroup homotypical group} and
73
	 * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
74
	 * The new cultivar taxon name instance will be also added to the set of
75
	 * cultivar taxon names belonging to this homotypical group.
76
	 * 
77
	 * @param	rank  the rank to be assigned to <i>this</i> cultivar taxon name
78
	 * @param	homotypicalGroup  the homotypical group to which <i>this</i> cultivar taxon name belongs
79
	 * @see 	#CultivarPlantName()
80
	 * @see 	eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
81
	 */
82
	protected CultivarPlantName(Rank rank, HomotypicalGroup homotypicalGroup) {
83
		super(rank, homotypicalGroup);
84
	}
85
	
86
	//********* METHODS **************************************/
87
	
88
	/** 
89
	 * Creates a new cultivar taxon name instance
90
	 * only containing its {@link Rank rank} and
91
	 * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
92
	 * 
93
	 * @param	rank	the rank to be assigned to <i>this</i> cultivar taxon name
94
	 * @see 			#CultivarPlantName(Rank, HomotypicalGroup)
95
	 * @see 			#NewInstance(Rank, HomotypicalGroup)
96
	 * @see 			eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
97
	 */
98
	public static CultivarPlantName NewInstance(Rank rank){
99
		return new CultivarPlantName(rank, null);
100
	}
101

    
102
	/** 
103
	 * Creates a new cultivar taxon name instance
104
	 * only containing its {@link Rank rank},
105
	 * its {@link HomotypicalGroup homotypical group} and 
106
 	 * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
107
	 * The new cultivar taxon name instance will be also added to the set of
108
	 * cultivar taxon names belonging to this homotypical group.
109
	 * 
110
	 * @param  rank  the rank to be assigned to <i>this</i> cultivar taxon name
111
	 * @param  homotypicalGroup  the homotypical group to which <i>this</i> cultivar taxon name belongs
112
	 * @see    #NewInstance(Rank)
113
	 * @see    #CultivarPlantName(Rank, HomotypicalGroup)
114
	 * @see    eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
115
	 */
116
	public static CultivarPlantName NewInstance(Rank rank, HomotypicalGroup homotypicalGroup){
117
		return new CultivarPlantName(rank, homotypicalGroup);
118
	}
119
	
120
//*********************** 	
121

    
122
	private static Map<String, java.lang.reflect.Field> allFields = null;
123
	@Override
124
    protected Map<String, java.lang.reflect.Field> getAllFields(){
125
    	if (allFields == null){
126
			allFields = CdmUtils.getAllFields(this.getClass(), CdmBase.class, false, false, false, true);
127
		}
128
    	return allFields;
129
    }
130

    
131
//************************* 
132
	
133
	/** 
134
	 * Returns the characteristical cultivar name part string assigned to <i>this</i>
135
	 * cultivar taxon name. In the scientific name "Clematis alpina 'Ruby'" for
136
	 * instance this characteristical string is "Ruby". This part of the name is
137
	 * governed by the International Code for the Nomenclature of Cultivated
138
	 * Plants and the string should include neither quotes nor + signs
139
	 * (these elements of the name cache string will be generated by the
140
	 * {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}).
141
	 */
142
	public String getCultivarName(){
143
		return this.cultivarName;
144
	}
145

    
146
	/**
147
	 * @see  #getCultivarName()
148
	 */
149
	public void setCultivarName(String cultivarName){
150
		this.cultivarName = cultivarName;
151
	}
152
	
153
	
154
	/**
155
	 * Returns the {@link NomenclaturalCode nomenclatural code} that governs
156
	 * the construction of <i>this</i> cultivar taxon name, that is the
157
	 * International Code of Nomenclature for Cultivated Plants. This method
158
	 * overrides the getNomeclaturalCode method from {@link NonViralName#getNomeclaturalCode() NonViralName}.
159
	 *
160
	 * @return  the nomenclatural code for cultivated plants
161
	 * @see  	NonViralName#isCodeCompliant()
162
	 * @see  	TaxonNameBase#getHasProblem()
163
	 */
164
	@Override
165
	public NomenclaturalCode getNomenclaturalCode(){
166
		return NomenclaturalCode.ICNCP;
167
	}
168

    
169
}
(3-3/25)