de8f2665fae937608b9a472116211aa5a92e5498
[cdmlib.git] / cdmlibrary / src / main / java / eu / etaxonomy / cdm / model / name / TaxonName.java
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 java.util.ArrayList;
14
15 import javax.persistence.CascadeType;
16 import javax.persistence.Entity;
17 import javax.persistence.ManyToOne;
18 import javax.persistence.Transient;
19
20 import org.apache.log4j.Logger;
21
22 import eu.etaxonomy.cdm.model.agent.Team;
23 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
24 import eu.etaxonomy.cdm.model.common.Source;
25 import eu.etaxonomy.cdm.model.publication.NomenclaturalReference;
26 import eu.etaxonomy.cdm.strategy.INameCacheStrategy;
27
28 import javax.xml.bind.annotation.XmlElement;
29 import javax.xml.bind.annotation.XmlRootElement;
30
31 /**
32 * @author Andreas Mueller
33 * @version 1.0
34 * @created 15-Aug-2007 18:36:15
35 */
36 @XmlRootElement //JAXP test dummy
37 @Entity
38 public class TaxonName extends IdentifiableEntity {
39 static Logger logger = Logger.getLogger(TaxonName.class);
40
41 private INameCacheStrategy cacheStrategy;
42 private String year;
43
44 //TODO make private but then the Aspect class has problems !!
45 public TaxonName(){
46
47 }
48
49 public TaxonName(INameCacheStrategy cacheStrategy){
50 setCacheStrategy(cacheStrategy);
51 }
52
53 //TODO inserted for PROTOTYPE
54 public String getYear(){
55 return this.year;
56 }
57 public void setYear(String strYear){
58 this.year = strYear;
59 }
60
61 //TODO for PROTOTYPE
62 @Transient
63 public INameCacheStrategy getCacheStrategy() {
64 return cacheStrategy;
65 }
66 public void setCacheStrategy(INameCacheStrategy cacheStrategy) {
67 this.cacheStrategy = cacheStrategy;
68 }
69
70
71 //The complete author string and maybe year
72 private String authorship;
73 private String cultivarName;
74 //The full name including author strings and maybe year
75 private String fullName;
76 //Genus part of a name
77 private String genus;
78 private boolean hasProblem;
79 private String idInSource;
80 //Genus subdivision epithet
81 private String infragenericEpithet;
82 private String infraSpecificEpithet;
83 private boolean isAnamorphic;
84 //alternative naming: useFullName
85 //when not set this flag protects the detailed parsed attributes from being overwritten
86 private boolean isAtomised;
87 private boolean isBinomHybrid;
88 private boolean isCultivarGroup;
89 //if set: this name is a hybrid formula (a hybrid that does not have an own name) and no other hybrid flags may be set. A
90 //hybrid name may not have either an authorteam nor other name components.
91 private boolean isHybridFormula;
92 private boolean isMonomHybrid;
93 private boolean isTrinomHybrid;
94 //The name without author strings and year
95 private String name;
96 private String nameInSource;
97 private String nomenclaturalMicroReference;
98 //The species epithet
99 private String specificEpithet;
100 //Name of taxon when rank is above genus
101 private String uninomial;
102 //Non-atomised addition to a name
103 private String unnamedNamePhrase;
104 private Rank rank;
105 private ArrayList inverseNameRelation;
106 private NomenclaturalCode nomenclaturalCode;
107 private ArrayList facts;
108 private ArrayList nameRelation;
109 private ArrayList typeDesignations;
110 private NomenclaturalReference nomenclaturalReference;
111 private Source source;
112 private Team authorTeam;
113 private Team exAuthorTeam;
114
115 public String getAuthorship(){
116 return authorship;
117 }
118
119 @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
120 public Team getAuthorTeam(){
121 return authorTeam;
122 }
123
124 @XmlElement
125 public String getCultivarName(){
126 return cultivarName;
127 }
128
129 @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
130 public Team getExAuthorTeam(){
131 return exAuthorTeam;
132 }
133
134 public ArrayList getFacts(){
135 return facts;
136 }
137
138 public String getFullName(){
139 if (name == null){
140 return cacheStrategy.getFullNameCache(this);
141 }else{
142 return fullName;
143 }
144 }
145
146 public String getGenus(){
147 return genus;
148 }
149
150 public boolean getHasProblem(){
151 return hasProblem;
152 }
153
154 public String getIdInSource(){
155 return idInSource;
156 }
157
158 public String getInfragenericEpithet(){
159 return infragenericEpithet;
160 }
161
162 public String getInfraSpecificEpithet(){
163 return infraSpecificEpithet;
164 }
165
166 public ArrayList getInverseNameRelation(){
167 return inverseNameRelation;
168 }
169
170 public String getName(){
171 if (name == null){
172 return cacheStrategy.getNameCache(this);
173 }else{
174 return name;
175 }
176 }
177
178 public String getNameInSource(){
179 return nameInSource;
180 }
181
182 public ArrayList getNameRelation(){
183 return nameRelation;
184 }
185
186 public NomenclaturalCode getNomenclaturalCode(){
187 return nomenclaturalCode;
188 }
189
190 public String getNomenclaturalMicroReference(){
191 return nomenclaturalMicroReference;
192 }
193
194 @Transient
195 public NomenclaturalReference getNomenclaturalReference(){
196 return nomenclaturalReference;
197 }
198
199 @Transient
200 public String[] getProblems(){
201 return null;
202 }
203
204 public Rank getRank(){
205 return rank;
206 }
207
208 @Transient
209 public Source getSource(){
210 return source;
211 }
212
213 public String getSpecificEpithet(){
214 return specificEpithet;
215 }
216
217 public ArrayList getTypeDesignations(){
218 return typeDesignations;
219 }
220
221 public String getUninomial(){
222 return uninomial;
223 }
224
225 public String getUnnamedNamePhrase(){
226 return unnamedNamePhrase;
227 }
228
229
230 public boolean isAnamorphic(){
231 return isAnamorphic;
232 }
233
234 public boolean isAtomised(){
235 return isAtomised;
236 }
237
238 public boolean isBinomHybrid(){
239 return isBinomHybrid;
240 }
241
242 public boolean isCultivarGroup(){
243 return isCultivarGroup;
244 }
245
246 public boolean isHybridFormula(){
247 return isHybridFormula;
248 }
249
250 public boolean isMonomHybrid(){
251 return isMonomHybrid;
252 }
253
254 public boolean isTrinomHybrid(){
255 return isTrinomHybrid;
256 }
257
258 /**
259 *
260 * @param fullname
261 */
262 public boolean parseName(String fullname){
263 return false;
264 }
265
266 /**
267 *
268 * @param newVal
269 */
270 public void setAnamorphic(boolean newVal){
271 isAnamorphic = newVal;
272
273 }
274
275 /**
276 *
277 * @param newVal
278 */
279 public void setAtomised(boolean newVal){
280 isAtomised = newVal;
281 }
282
283 /**
284 *
285 * @param newVal
286 */
287 public void setAuthorship(String newVal){
288 authorship = newVal;
289 }
290
291 /**
292 *
293 * @param newVal
294 */
295 public void setAuthorTeam(Team newVal){
296 authorTeam = newVal;
297 }
298
299 /**
300 *
301 * @param newVal
302 */
303 public void setBinomHybrid(boolean newVal){
304 isBinomHybrid = newVal;
305 }
306
307 /**
308 *
309 * @param newVal
310 */
311 public void setCultivarGroup(boolean newVal){
312 isCultivarGroup = newVal;
313 }
314
315 /**
316 *
317 * @param newVal
318 */
319 public void setCultivarName(String newVal){
320 cultivarName = newVal;
321 }
322
323 /**
324 *
325 * @param newVal
326 */
327 public void setExAuthorTeam(Team newVal){
328 exAuthorTeam = newVal;
329 }
330
331 /**
332 *
333 * @param newVal
334 */
335 public void setFacts(ArrayList newVal){
336 facts = newVal;
337 }
338
339 /**
340 *
341 * @param newVal
342 */
343 public void setFullName(String newVal){
344 fullName = newVal;
345 }
346
347 /**
348 *
349 * @param newVal
350 */
351 public void setGenus(String newVal){
352 genus = newVal;
353 }
354
355 /**
356 *
357 * @param newVal
358 */
359 public void setHasProblem(boolean newVal){
360 hasProblem = newVal;
361 }
362
363 /**
364 *
365 * @param newVal
366 */
367 public void setHybridFormula(boolean newVal){
368 isHybridFormula = newVal;
369 }
370
371 /**
372 *
373 * @param newVal
374 */
375 public void setIdInSource(String newVal){
376 idInSource = newVal;
377 }
378
379 /**
380 *
381 * @param newVal
382 */
383 public void setInfragenericEpithet(String newVal){
384 infragenericEpithet = newVal;
385 }
386
387 /**
388 *
389 * @param newVal
390 */
391 public void setInfraSpecificEpithet(String newVal){
392 infraSpecificEpithet = newVal;
393 }
394
395 /**
396 *
397 * @param newVal
398 */
399 public void setInverseNameRelation(ArrayList newVal){
400 inverseNameRelation = newVal;
401 }
402
403 /**
404 *
405 * @param newVal
406 */
407 public void setMonomHybrid(boolean newVal){
408 isMonomHybrid = newVal;
409 }
410
411 /**
412 *
413 * @param newVal
414 */
415 public void setName(String newVal){
416 name = newVal;
417 }
418
419 /**
420 *
421 * @param newVal
422 */
423 public void setNameInSource(String newVal){
424 nameInSource = newVal;
425 }
426
427 /**
428 *
429 * @param newVal
430 */
431 public void setNameRelation(ArrayList newVal){
432 nameRelation = newVal;
433 }
434
435 /**
436 *
437 * @param newVal
438 */
439 public void setNomenclaturalCode(NomenclaturalCode newVal){
440 nomenclaturalCode = newVal;
441 }
442
443 /**
444 *
445 * @param newVal
446 */
447 public void setNomenclaturalMicroReference(String newVal){
448 nomenclaturalMicroReference = newVal;
449 }
450
451 /**
452 *
453 * @param newVal
454 */
455 public void setNomenclaturalReference(NomenclaturalReference newVal){
456 nomenclaturalReference = newVal;
457 }
458
459 /**
460 *
461 * @param newVal
462 */
463 public void setRank(Rank newVal){
464 rank = newVal;
465 }
466
467 /**
468 *
469 * @param newVal
470 */
471 public void setSource(Source newVal){
472 source = newVal;
473 }
474
475 /**
476 *
477 * @param newVal
478 */
479 public void setSpecificEpithet(String newVal){
480 specificEpithet = newVal;
481 }
482
483 /**
484 *
485 * @param newVal
486 */
487 public void setTrinomHybrid(boolean newVal){
488 isTrinomHybrid = newVal;
489 }
490
491 /**
492 *
493 * @param newVal
494 */
495 public void setTypeDesignations(ArrayList newVal){
496 //super.changeSupport.firePropertyChange("typeDesignations", typeDesignations, newVal);
497 typeDesignations = newVal;
498 }
499
500 /**
501 *
502 * @param newVal
503 */
504 public void setUninomial(String newVal){
505 uninomial = newVal;
506 }
507
508 /**
509 *
510 * @param newVal
511 */
512 public void setUnnamedNamePhrase(String newVal){
513 unnamedNamePhrase = newVal;
514 }
515
516 }