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
.common
;
13 import javax
.persistence
.Entity
;
14 import javax
.persistence
.Transient
;
15 import javax
.xml
.bind
.annotation
.XmlAccessType
;
16 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
17 import javax
.xml
.bind
.annotation
.XmlElement
;
18 import javax
.xml
.bind
.annotation
.XmlRootElement
;
19 import javax
.xml
.bind
.annotation
.XmlType
;
21 import org
.apache
.log4j
.Logger
;
22 import org
.hibernate
.envers
.Audited
;
23 import org
.hibernate
.search
.annotations
.Field
;
24 import org
.hibernate
.search
.annotations
.Store
;
27 * workaround for enumerations
29 * @since 08-Nov-2007 13:06:49
32 @XmlAccessorType(XmlAccessType
.FIELD
)
33 @XmlType(name
= "Representation", propOrder
= {
38 @XmlRootElement(name
= "Representation")
40 //@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
41 //@Indexed(index = "eu.etaxonomy.cdm.model.common.Representation")
43 public class Representation
extends LanguageStringBase
{
44 private static final long serialVersionUID
= -4202420199587324532L;
45 private static final Logger logger
= Logger
.getLogger(Representation
.class);
47 @XmlElement(name
= "Label")
48 @Field(store
=Store
.YES
)
51 @XmlElement(name
= "AbbreviatedLabel")
52 @Field(store
=Store
.YES
)
53 private String abbreviatedLabel
;
56 @XmlElement(name
= "Plural")
57 @Field(store
=Store
.YES
)
58 private String plural
;
66 public static Representation
NewInstance(String description
, String label
, String abbreviatedLabel
, Language lang
){
67 return new Representation(description
, label
, abbreviatedLabel
, lang
);
70 public Representation() {
75 * text represents an explanation/declaration ('The name is illegitimate according to ICBN'); label a string identifier ('illegitimate name');
76 * abbreviatedLabel a shortened string for the label ('nom. illeg.')
78 public Representation(String description
, String label
, String abbreviatedLabel
, Language language
) {
79 super(description
, language
);
81 this.abbreviatedLabel
= abbreviatedLabel
;
85 public String
getLabel(){
88 public void setLabel(String label
){
92 public String
getAbbreviatedLabel(){
93 return this.abbreviatedLabel
;
95 public void setAbbreviatedLabel(String abbreviatedLabel
){
96 this.abbreviatedLabel
= abbreviatedLabel
;
99 public String
getPlural() {
102 public void setPlural(String plural
) {
103 this.plural
= plural
;
107 * Returns the description of this representation
108 * see {@link #getText()}
112 public String
getDescription(){
116 protected void setDescription(String text
) {
122 * Overrides super.getText() only to document that here the Text attribute
123 * should be used for a larger description of the label.
126 * Returns the description of this representation.
127 * @see #getDescription()
131 public String
getText(){
132 return super.getText();
137 public String
toString(){
138 // we dont need the language returned too, do we?
140 // if(getLanguage()==null || getLanguage().getLabel()==null){
141 // return getLabel();
143 // return getLabel()+"("+ getLanguage().getLabel()+")";
147 //*********************** CLONE ********************************************************/
150 * Clones <i>this</i> Representation. This is a shortcut that enables to create
151 * a new instance that differs only slightly from <i>this</i> Representation by
152 * modifying only some of the attributes.
154 * @see eu.etaxonomy.cdm.model.common.LanguageStringBase#clone()
155 * @see java.lang.Object#clone()
158 public Object
clone() {
160 Representation result
= (Representation
) super.clone();
161 //no changes to abbreviatedLabel and label
163 }catch (CloneNotSupportedException e
) {
164 logger
.warn("Object does not implement cloneable");