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.description;
|
11
|
|
12
|
|
13
|
import javax.persistence.Entity;
|
14
|
import javax.persistence.ManyToOne;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.common.Language;
|
19
|
import eu.etaxonomy.cdm.model.common.MultilanguageText;
|
20
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
21
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
22
|
|
23
|
/**
|
24
|
* This class represents common or vernacular names for {@link Taxon taxa}.
|
25
|
* Only {@link TaxonDescription taxon descriptions} may contain common names.
|
26
|
* Common names vary not only according to the {@link Language language} but also sometimes
|
27
|
* according to {@link TaxonDescription#getGeoScopes() geospatial areas}. Furthermore there might be several
|
28
|
* distinct common names in one language and in the same geospatial area to
|
29
|
* designate the same taxon. Therefore using a {@link MultilanguageText multilanguage text}
|
30
|
* would not have been adequate.
|
31
|
*
|
32
|
* @author m.doering
|
33
|
* @version 1.0
|
34
|
* @created 08-Nov-2007 13:06:17
|
35
|
*/
|
36
|
@Entity
|
37
|
public class CommonTaxonName extends DescriptionElementBase {
|
38
|
static Logger logger = Logger.getLogger(CommonTaxonName.class);
|
39
|
|
40
|
private String name;
|
41
|
private Language language;
|
42
|
|
43
|
/**
|
44
|
* Class constructor: creates a new empty common name instance.
|
45
|
* The corresponding {@link Feature feature} is set to {@link Feature#COMMON_NAME() COMMON_NAME}.
|
46
|
*/
|
47
|
protected CommonTaxonName(){
|
48
|
super(Feature.COMMON_NAME());
|
49
|
}
|
50
|
|
51
|
/**
|
52
|
* Creates a common name instance with the given name string and the given
|
53
|
* {@link Language language}. The corresponding {@link Feature feature} is set to
|
54
|
* {@link Feature#COMMON_NAME() COMMON_NAME}.
|
55
|
*
|
56
|
* @param name the name string
|
57
|
* @param language the language of the name string
|
58
|
*/
|
59
|
public static CommonTaxonName NewInstance(String name, Language language){
|
60
|
CommonTaxonName result = new CommonTaxonName();
|
61
|
result.setName(name);
|
62
|
result.setLanguage(language);
|
63
|
return result;
|
64
|
}
|
65
|
|
66
|
|
67
|
|
68
|
|
69
|
/**
|
70
|
* Deprecated because {@link Feature feature} should always be {@link Feature#COMMON_NAME() COMMON_NAME}
|
71
|
* for all common name instances.
|
72
|
*/
|
73
|
/* (non-Javadoc)
|
74
|
* @see eu.etaxonomy.cdm.model.description.DescriptionElementBase#setFeature(eu.etaxonomy.cdm.model.description.Feature)
|
75
|
*/
|
76
|
@Override
|
77
|
@Deprecated
|
78
|
public void setFeature(Feature feature) {
|
79
|
super.setFeature(feature);
|
80
|
}
|
81
|
|
82
|
/**
|
83
|
* Returns the {@link Language language} used for <i>this</i> common name.
|
84
|
*/
|
85
|
@ManyToOne
|
86
|
public Language getLanguage(){
|
87
|
return this.language;
|
88
|
}
|
89
|
/**
|
90
|
* @see #getLanguage()
|
91
|
*/
|
92
|
public void setLanguage(Language language){
|
93
|
this.language = language;
|
94
|
}
|
95
|
|
96
|
/**
|
97
|
* Returns the name string of <i>this</i> common name.
|
98
|
*/
|
99
|
public String getName(){
|
100
|
return this.name;
|
101
|
}
|
102
|
|
103
|
/**
|
104
|
* @see #getName()
|
105
|
*/
|
106
|
public void setName(String name){
|
107
|
this.name = name;
|
108
|
}
|
109
|
|
110
|
}
|