Revision 892efc69
Added by Andreas Kohlbecker almost 14 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/CommonTaxonName.java | ||
---|---|---|
21 | 21 |
import javax.xml.bind.annotation.XmlSchemaType; |
22 | 22 |
import javax.xml.bind.annotation.XmlType; |
23 | 23 |
|
24 |
import org.apache.commons.lang.StringUtils; |
|
24 | 25 |
import org.apache.log4j.Logger; |
25 | 26 |
import org.hibernate.envers.Audited; |
26 | 27 |
import org.hibernate.search.annotations.Field; |
... | ... | |
29 | 30 |
import org.hibernate.search.annotations.IndexedEmbedded; |
30 | 31 |
|
31 | 32 |
import eu.etaxonomy.cdm.model.common.Language; |
32 |
|
|
33 |
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
|
33 |
import eu.etaxonomy.cdm.model.common.MultilanguageText; |
|
34 |
import eu.etaxonomy.cdm.model.location.NamedArea;
|
|
34 | 35 |
|
35 | 36 |
/** |
36 | 37 |
* This class represents common or vernacular names for {@link Taxon taxa}. |
... | ... | |
48 | 49 |
@XmlAccessorType(XmlAccessType.FIELD) |
49 | 50 |
@XmlType(name = "CommonTaxonName", propOrder = { |
50 | 51 |
"name", |
51 |
"language" |
|
52 |
"language", |
|
53 |
"area" |
|
52 | 54 |
}) |
53 | 55 |
@XmlRootElement(name = "CommonTaxonName") |
54 | 56 |
@Entity |
55 | 57 |
@Audited |
56 | 58 |
@Indexed(index = "eu.etaxonomy.cdm.model.description.DescriptionElementBase") |
57 |
public class CommonTaxonName extends DescriptionElementBase { |
|
59 |
public class CommonTaxonName extends DescriptionElementBase implements Cloneable {
|
|
58 | 60 |
private static final long serialVersionUID = 2643808051976643339L; |
59 | 61 |
private static final Logger logger = Logger.getLogger(CommonTaxonName.class); |
60 | 62 |
|
... | ... | |
68 | 70 |
@ManyToOne(fetch = FetchType.LAZY) |
69 | 71 |
@IndexedEmbedded(depth = 2) |
70 | 72 |
private Language language; |
73 |
|
|
74 |
@XmlElement(name = "Area") |
|
75 |
@XmlIDREF |
|
76 |
@XmlSchemaType(name = "IDREF") |
|
77 |
@ManyToOne(fetch = FetchType.LAZY) |
|
78 |
private NamedArea area; |
|
71 | 79 |
|
72 | 80 |
/** |
73 | 81 |
* Class constructor: creates a new empty common name instance. |
... | ... | |
136 | 144 |
this.name = name; |
137 | 145 |
} |
138 | 146 |
|
147 |
/** |
|
148 |
* The area where the name is used |
|
149 |
* @return |
|
150 |
*/ |
|
151 |
public NamedArea getArea() { |
|
152 |
return area; |
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* @see #getArea() |
|
157 |
* @param area |
|
158 |
*/ |
|
159 |
public void setArea(NamedArea area) { |
|
160 |
this.area = area; |
|
161 |
} |
|
162 |
|
|
163 |
|
|
164 |
//*********************************** CLONE *****************************************/ |
|
165 |
|
|
166 |
@Override |
|
167 |
public Object clone() throws CloneNotSupportedException { |
|
168 |
//no changes to name, language, area |
|
169 |
return super.clone(); |
|
170 |
} |
|
171 |
|
|
172 |
//*********************************** toString *****************************************/ |
|
173 |
|
|
174 |
@Override |
|
175 |
public String toString(){ |
|
176 |
if (StringUtils.isNotBlank(name)){ |
|
177 |
return name; |
|
178 |
}else{ |
|
179 |
return super.toString(); |
|
180 |
} |
|
181 |
} |
|
139 | 182 |
} |
Also available in: Unified diff
merging /branches/cdmlib/SPRINT-Chichorieae1/ to trunk