2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.name
;
14 import org
.apache
.log4j
.Logger
;
15 import org
.hibernate
.envers
.Audited
;
16 import org
.hibernate
.search
.annotations
.Indexed
;
17 import org
.hibernate
.validator
.constraints
.Length
;
18 import org
.springframework
.beans
.factory
.annotation
.Configurable
;
20 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
21 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
22 import eu
.etaxonomy
.cdm
.validation
.annotation
.NullOrNotEmpty
;
24 import javax
.persistence
.*;
25 import javax
.xml
.bind
.annotation
.XmlAccessType
;
26 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
27 import javax
.xml
.bind
.annotation
.XmlElement
;
28 import javax
.xml
.bind
.annotation
.XmlRootElement
;
29 import javax
.xml
.bind
.annotation
.XmlType
;
32 * The taxon name class for cultivars (cultivated plants). The only possible
33 * {@link Rank ranks} for cultivars are CULTIVAR, GREX, CONVAR, CULTIVAR_GROUP,
34 * GRAFT_CHIMAERA or DENOMINATION_CLASS.
36 * This class corresponds partially to: NameBotanical according to the
41 * @created 08-Nov-2007 13:06:18
43 @XmlAccessorType(XmlAccessType
.FIELD
)
44 @XmlType(name
= "", propOrder
= {
47 @XmlRootElement(name
= "CultivarPlantName")
49 @Indexed(index
= "eu.etaxonomy.cdm.model.name.TaxonNameBase")
52 public class CultivarPlantName
extends BotanicalName
implements Cloneable
{
53 @SuppressWarnings("unused")
54 private static final Logger logger
= Logger
.getLogger(CultivarPlantName
.class);
56 //the characteristical name of the cultivar
57 @XmlElement(name
= "CultivarName", required
= true)
60 private String cultivarName
;
62 // ************* CONSTRUCTORS *************/
64 * Class constructor: creates a new cultivar taxon name instance
65 * only containing the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
67 * @see #CultivarPlantName(Rank, HomotypicalGroup)
68 * @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
70 public CultivarPlantName(){
75 * Class constructor: creates a new cultivar taxon name instance
76 * only containing its {@link Rank rank},
77 * its {@link HomotypicalGroup homotypical group} and
78 * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
79 * The new cultivar taxon name instance will be also added to the set of
80 * cultivar taxon names belonging to this homotypical group.
82 * @param rank the rank to be assigned to <i>this</i> cultivar taxon name
83 * @param homotypicalGroup the homotypical group to which <i>this</i> cultivar taxon name belongs
84 * @see #CultivarPlantName()
85 * @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
87 protected CultivarPlantName(Rank rank
, HomotypicalGroup homotypicalGroup
) {
88 super(rank
, homotypicalGroup
);
91 //********* METHODS **************************************/
94 * Creates a new cultivar taxon name instance
95 * only containing its {@link Rank rank} and
96 * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
98 * @param rank the rank to be assigned to <i>this</i> cultivar taxon name
99 * @see #CultivarPlantName(Rank, HomotypicalGroup)
100 * @see #NewInstance(Rank, HomotypicalGroup)
101 * @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
103 public static CultivarPlantName
NewInstance(Rank rank
){
104 return new CultivarPlantName(rank
, null);
108 * Creates a new cultivar taxon name instance
109 * only containing its {@link Rank rank},
110 * its {@link HomotypicalGroup homotypical group} and
111 * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
112 * The new cultivar taxon name instance will be also added to the set of
113 * cultivar taxon names belonging to this homotypical group.
115 * @param rank the rank to be assigned to <i>this</i> cultivar taxon name
116 * @param homotypicalGroup the homotypical group to which <i>this</i> cultivar taxon name belongs
117 * @see #NewInstance(Rank)
118 * @see #CultivarPlantName(Rank, HomotypicalGroup)
119 * @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
121 public static CultivarPlantName
NewInstance(Rank rank
, HomotypicalGroup homotypicalGroup
){
122 return new CultivarPlantName(rank
, homotypicalGroup
);
125 //***********************
127 private static Map
<String
, java
.lang
.reflect
.Field
> allFields
= null;
129 protected Map
<String
, java
.lang
.reflect
.Field
> getAllFields(){
130 if (allFields
== null){
131 allFields
= CdmUtils
.getAllFields(this.getClass(), CdmBase
.class, false, false, false, true);
136 //*************************
139 * Returns the characteristical cultivar name part string assigned to <i>this</i>
140 * cultivar taxon name. In the scientific name "Clematis alpina 'Ruby'" for
141 * instance this characteristical string is "Ruby". This part of the name is
142 * governed by the International Code for the Nomenclature of Cultivated
143 * Plants and the string should include neither quotes nor + signs
144 * (these elements of the name cache string will be generated by the
145 * {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}).
147 public String
getCultivarName(){
148 return this.cultivarName
;
152 * @see #getCultivarName()
154 public void setCultivarName(String cultivarName
){
155 this.cultivarName
= cultivarName
;
160 * Returns the {@link NomenclaturalCode nomenclatural code} that governs
161 * the construction of <i>this</i> cultivar taxon name, that is the
162 * International Code of Nomenclature for Cultivated Plants. This method
163 * overrides the getNomeclaturalCode method from {@link NonViralName#getNomeclaturalCode() NonViralName}.
165 * @return the nomenclatural code for cultivated plants
166 * @see NonViralName#isCodeCompliant()
167 * @see TaxonNameBase#getHasProblem()
170 public NomenclaturalCode
getNomenclaturalCode(){
171 return NomenclaturalCode
.ICNCP
;
175 //*********************** CLONE ********************************************************/
178 * Clones <i>this</i> cultivar plant name. This is a shortcut that enables to create
179 * a new instance that differs only slightly from <i>this</i> cultivar plant name by
180 * modifying only some of the attributes.
182 * @see eu.etaxonomy.cdm.model.name.BotanicalName#clone()
183 * @see java.lang.Object#clone()
186 public Object
clone() {
187 BotanicalName result
= (BotanicalName
)super.clone();
188 //no changes to: cultivarName