Revision da39aca0
Added by Andreas Müller about 7 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BotanicalName.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.cdm.model.name; |
11 | 11 |
|
12 | 12 |
|
13 |
import java.util.Map; |
|
14 |
|
|
15 | 13 |
import javax.persistence.Entity; |
16 | 14 |
import javax.xml.bind.annotation.XmlAccessType; |
17 | 15 |
import javax.xml.bind.annotation.XmlAccessorType; |
... | ... | |
24 | 22 |
import org.hibernate.search.annotations.Indexed; |
25 | 23 |
import org.springframework.beans.factory.annotation.Configurable; |
26 | 24 |
|
27 |
import eu.etaxonomy.cdm.common.CdmUtils; |
|
28 | 25 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
29 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
30 | 26 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
31 | 27 |
import eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy; |
32 |
import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser; |
|
33 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
|
34 | 28 |
|
35 | 29 |
/** |
36 | 30 |
* The taxon name class for plants and fungi. |
... | ... | |
38 | 32 |
* This class corresponds to: NameBotanical according to the ABCD schema. |
39 | 33 |
* |
40 | 34 |
* @author m.doering |
41 |
* @version 1.0 |
|
42 | 35 |
* @created 08-Nov-2007 13:06:15 |
43 | 36 |
*/ |
44 | 37 |
@XmlAccessorType(XmlAccessType.FIELD) |
45 | 38 |
@XmlType(name = "BotanicalName", propOrder = { |
46 |
"anamorphic" |
|
39 |
"anamorphic"
|
|
47 | 40 |
}) |
48 | 41 |
@XmlRootElement(name = "BotanicalName") |
49 | 42 |
@Entity |
... | ... | |
52 | 45 |
@Configurable |
53 | 46 |
public class BotanicalName |
54 | 47 |
extends NonViralName<BotanicalName> |
55 |
implements IBotanicalName /*, IMergable*/ {
|
|
56 |
private static final long serialVersionUID = 6818651572463497727L;
|
|
57 |
@SuppressWarnings("unused")
|
|
48 |
/*, IMergable*/ { |
|
49 |
private static final long serialVersionUID = -3484146190510367749L;
|
|
50 |
@SuppressWarnings("unused")
|
|
58 | 51 |
private static final Logger logger = Logger.getLogger(BotanicalName.class); |
59 | 52 |
|
60 |
//Only for fungi: to indicate that the type of the name is asexual or not |
|
53 |
// IBotanicalName, |
|
54 |
|
|
55 |
//ICNAFP |
|
56 |
|
|
57 |
//Only for fungi: to indicate that the type of the name is asexual or not |
|
61 | 58 |
@XmlElement(name ="IsAnamorphic") |
62 |
private boolean anamorphic; |
|
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 |
} |
|
63 | 75 |
|
64 |
static private INonViralNameParser<?> nameParser = new NonViralNameParserImpl(); |
|
76 |
/** |
|
77 |
* @see #isAnamorphic() |
|
78 |
*/ |
|
79 |
public void setAnamorphic(boolean anamorphic){ |
|
80 |
this.anamorphic = anamorphic; |
|
81 |
} |
|
65 | 82 |
|
66 | 83 |
// ************* CONSTRUCTORS *************/ |
67 | 84 |
//needed by hibernate |
... | ... | |
122 | 139 |
* @param homotypicalGroup the homotypical group to which <i>this</i> botanical taxon name belongs |
123 | 140 |
* @see #BotanicalName() |
124 | 141 |
* @see #BotanicalName(Rank, HomotypicalGroup) |
125 |
* @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) |
|
142 |
* @see #NewBotanicalInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
|
|
126 | 143 |
* @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy |
127 | 144 |
* @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy |
128 | 145 |
* @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy |
... | ... | |
133 | 150 |
} |
134 | 151 |
|
135 | 152 |
|
136 |
//********* METHODS **************************************/ |
|
137 |
|
|
138 |
/** |
|
139 |
* Creates a new botanical taxon name instance |
|
140 |
* only containing its {@link Rank rank} and |
|
141 |
* the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}. |
|
142 |
* |
|
143 |
* @param rank the rank to be assigned to <i>this</i> botanical taxon name |
|
144 |
* @see #BotanicalName(Rank, HomotypicalGroup) |
|
145 |
* @see #NewInstance(Rank, HomotypicalGroup) |
|
146 |
* @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) |
|
147 |
* @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy |
|
148 |
*/ |
|
149 |
public static BotanicalName NewInstance(Rank rank){ |
|
150 |
return new BotanicalName(rank, null); |
|
151 |
} |
|
152 |
/** |
|
153 |
* Creates a new botanical taxon name instance |
|
154 |
* only containing its {@link Rank rank}, |
|
155 |
* its {@link HomotypicalGroup homotypical group} and |
|
156 |
* the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}. |
|
157 |
* The new botanical taxon name instance will be also added to the set of |
|
158 |
* botanical taxon names belonging to this homotypical group. |
|
159 |
* |
|
160 |
* @param rank the rank to be assigned to <i>this</i> botanical taxon name |
|
161 |
* @param homotypicalGroup the homotypical group to which <i>this</i> botanical taxon name belongs |
|
162 |
* @see #NewInstance(Rank) |
|
163 |
* @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) |
|
164 |
* @see #BotanicalName(Rank, HomotypicalGroup) |
|
165 |
* @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy |
|
166 |
*/ |
|
167 |
public static BotanicalName NewInstance(Rank rank, HomotypicalGroup homotypicalGroup){ |
|
168 |
return new BotanicalName(rank, homotypicalGroup); |
|
169 |
} |
|
170 |
/** |
|
171 |
* Creates a new botanical taxon name instance |
|
172 |
* containing its {@link Rank rank}, |
|
173 |
* its {@link HomotypicalGroup homotypical group}, |
|
174 |
* its scientific name components, its {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase author(team)}, |
|
175 |
* its {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} and |
|
176 |
* the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}. |
|
177 |
* The new botanical taxon name instance will be also added to the set of |
|
178 |
* botanical taxon names belonging to this homotypical group. |
|
179 |
* |
|
180 |
* @param rank the rank to be assigned to <i>this</i> botanical taxon name |
|
181 |
* @param genusOrUninomial the string for <i>this</i> botanical taxon name |
|
182 |
* if its rank is genus or higher or for the genus part |
|
183 |
* if its rank is lower than genus |
|
184 |
* @param infraGenericEpithet the string for the first epithet of |
|
185 |
* <i>this</i> botanical taxon name if its rank is lower than genus |
|
186 |
* and higher than species aggregate |
|
187 |
* @param specificEpithet the string for the first epithet of |
|
188 |
* <i>this</i> botanical taxon name if its rank is species aggregate or lower |
|
189 |
* @param infraSpecificEpithet the string for the second epithet of |
|
190 |
* <i>this</i> botanical taxon name if its rank is lower than species |
|
191 |
* @param combinationAuthorship the author or the team who published <i>this</i> botanical taxon name |
|
192 |
* @param nomenclaturalReference the nomenclatural reference where <i>this</i> botanical taxon name was published |
|
193 |
* @param nomenclMicroRef the string with the details for precise location within the nomenclatural reference |
|
194 |
* @param homotypicalGroup the homotypical group to which <i>this</i> botanical taxon name belongs |
|
195 |
* @see #NewInstance(Rank) |
|
196 |
* @see #NewInstance(Rank, HomotypicalGroup) |
|
197 |
* @see ZoologicalName#ZoologicalName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) |
|
198 |
* @see eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy |
|
199 |
*/ |
|
200 |
public static BotanicalName NewInstance(Rank rank, String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet, TeamOrPersonBase combinationAuthorship, INomenclaturalReference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) { |
|
201 |
return new BotanicalName(rank, genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet, combinationAuthorship, nomenclaturalReference, nomenclMicroRef, homotypicalGroup); |
|
202 |
} |
|
203 |
|
|
204 |
/** |
|
205 |
* Returns a botanical taxon name based on parsing a string representing |
|
206 |
* all elements (according to the ICBN) of a botanical taxon name (where |
|
207 |
* the scientific name is an uninomial) including authorship but without |
|
208 |
* nomenclatural reference. If the {@link Rank rank} is not "Genus" it should be |
|
209 |
* set afterwards with the {@link TaxonNameBase#setRank(Rank) setRank} methode. |
|
210 |
* |
|
211 |
* @param fullNameString the string to be parsed |
|
212 |
* @return the new botanical taxon name |
|
213 |
*/ |
|
214 |
public static BotanicalName PARSED_NAME(String fullNameString){ |
|
215 |
return PARSED_NAME(fullNameString, Rank.GENUS()); |
|
216 |
} |
|
217 |
|
|
218 |
/** |
|
219 |
* Returns a botanical taxon name based on parsing a string representing |
|
220 |
* all elements (according to the ICBN) of a botanical taxon name including |
|
221 |
* authorship but without nomenclatural reference. The parsing result |
|
222 |
* depends on the given rank of the botanical taxon name to be created. |
|
223 |
* |
|
224 |
* @param fullNameString the string to be parsed |
|
225 |
* @param rank the rank of the taxon name |
|
226 |
* @return the new botanical taxon name |
|
227 |
*/ |
|
228 |
public static BotanicalName PARSED_NAME(String fullNameString, Rank rank){ |
|
229 |
if (nameParser == null){ |
|
230 |
nameParser = new NonViralNameParserImpl(); |
|
231 |
} |
|
232 |
return (BotanicalName)nameParser.parseFullName(fullNameString, NomenclaturalCode.ICNAFP, rank); |
|
233 |
} |
|
234 |
|
|
235 |
/** |
|
236 |
* Returns a botanical taxon name based on parsing a string representing |
|
237 |
* all elements (according to the ICBN) of a botanical taxon name (where |
|
238 |
* the scientific name is an uninomial) including authorship and |
|
239 |
* nomenclatural reference. Eventually a new {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} |
|
240 |
* instance will also be created. If the {@link Rank rank} is not "Genus" it should be |
|
241 |
* set afterwards with the {@link TaxonNameBase#setRank(Rank) setRank} methode. |
|
242 |
* |
|
243 |
* @param fullNameAndReferenceString the string to be parsed |
|
244 |
* @return the new botanical taxon name |
|
245 |
*/ |
|
246 |
public static BotanicalName PARSED_REFERENCE(String fullNameAndReferenceString){ |
|
247 |
return PARSED_REFERENCE(fullNameAndReferenceString, Rank.GENUS()); |
|
248 |
} |
|
249 |
|
|
250 |
/** |
|
251 |
* Returns a botanical taxon name based on parsing a string representing |
|
252 |
* all elements (according to the ICBN) of a botanical taxon name including |
|
253 |
* authorship and nomenclatural reference. The parsing result depends on |
|
254 |
* the given rank of the botanical taxon name to be created. |
|
255 |
* Eventually a new {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} |
|
256 |
* instance will also be created. |
|
257 |
* |
|
258 |
* @param fullNameAndReferenceString the string to be parsed |
|
259 |
* @param rank the rank of the taxon name |
|
260 |
* @return the new botanical taxon name |
|
261 |
*/ |
|
262 |
public static BotanicalName PARSED_REFERENCE(String fullNameAndReferenceString, Rank rank){ |
|
263 |
if (nameParser == null){ |
|
264 |
nameParser = new NonViralNameParserImpl(); |
|
265 |
} |
|
266 |
return (BotanicalName)nameParser.parseReferencedName(fullNameAndReferenceString, NomenclaturalCode.ICNAFP, rank); |
|
267 |
} |
|
268 |
|
|
269 |
//*********************** |
|
270 |
|
|
271 |
private static Map<String, java.lang.reflect.Field> allFields = null; |
|
272 |
@Override |
|
273 |
protected Map<String, java.lang.reflect.Field> getAllFields(){ |
|
274 |
if (allFields == null){ |
|
275 |
allFields = CdmUtils.getAllFields(this.getClass(), CdmBase.class, false, false, false, true); |
|
276 |
} |
|
277 |
return allFields; |
|
278 |
} |
|
279 |
|
|
280 | 153 |
//************************* |
281 | 154 |
|
282 |
/** |
|
283 |
* Returns the boolean value of the flag indicating whether the specimen |
|
284 |
* type of <i>this</i> botanical taxon name for a fungus is asexual (true) or not |
|
285 |
* (false). This applies only in case of fungi. The Article 59 of the ICBN |
|
286 |
* permits mycologists to give asexually reproducing fungi (anamorphs) |
|
287 |
* separate names from their sexual states (teleomorphs). |
|
288 |
* |
|
289 |
* @return the boolean value of the isAnamorphic flag |
|
290 |
*/ |
|
291 |
@Override |
|
292 |
public boolean isAnamorphic(){ |
|
293 |
return this.anamorphic; |
|
294 |
} |
|
295 |
|
|
296 |
/** |
|
297 |
* @see #isAnamorphic() |
|
298 |
*/ |
|
299 |
@Override |
|
300 |
public void setAnamorphic(boolean anamorphic){ |
|
301 |
this.anamorphic = anamorphic; |
|
302 |
} |
|
303 | 155 |
|
304 | 156 |
|
305 | 157 |
/** |
... | ... | |
351 | 203 |
@Override |
352 | 204 |
public Object clone() { |
353 | 205 |
BotanicalName result = (BotanicalName)super.clone(); |
354 |
//no changes to: title, authorTeam, hasProblem, nomenclaturallyRelevant, uri
|
|
206 |
//no changes to: |
|
355 | 207 |
return result; |
356 | 208 |
} |
357 | 209 |
|
Also available in: Unified diff
ref #6365 merge static methods from BotanicaName to TaxonNameBase