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 org
.apache
.log4j
.Logger
;
14 import org
.hibernate
.envers
.Audited
;
15 import org
.hibernate
.search
.annotations
.Field
;
16 import org
.hibernate
.search
.annotations
.Index
;
17 import org
.hibernate
.search
.annotations
.Indexed
;
19 import javax
.persistence
.*;
20 import javax
.xml
.bind
.annotation
.XmlAccessType
;
21 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
22 import javax
.xml
.bind
.annotation
.XmlElement
;
23 import javax
.xml
.bind
.annotation
.XmlRootElement
;
24 import javax
.xml
.bind
.annotation
.XmlType
;
27 * workaround for enumerations
30 * @created 08-Nov-2007 13:06:49
33 @XmlAccessorType(XmlAccessType
.FIELD
)
34 @XmlType(name
= "Representation", propOrder
= {
38 @XmlRootElement(name
= "Representation")
40 @Indexed(index
= "eu.etaxonomy.cdm.model.common.Representation")
42 public class Representation
extends LanguageStringBase
{
43 private static final long serialVersionUID
= -4202420199587324532L;
44 @SuppressWarnings("unused")
45 private static final Logger logger
= Logger
.getLogger(Representation
.class);
47 @XmlElement(name
= "Label")
48 @Field(index
=Index
.TOKENIZED
)
51 @XmlElement(name
= "AbbreviatedLabel")
52 @Field(index
=Index
.TOKENIZED
)
53 private String abbreviatedLabel
;
61 public static Representation
NewInstance(String text
, String label
, String abbreviatedLabel
, Language lang
){
62 return new Representation(text
, label
, abbreviatedLabel
, lang
);
65 public Representation() {
70 * text represents an explanation/declaration ('The name is illegitimate according to ICBN'); label a string identifier ('illegitimate name');
71 * abbreviatedLabel a shortened string for the label ('nom. illeg.')
73 public Representation(String text
, String label
, String abbreviatedLabel
, Language language
) {
74 super(text
, language
);
76 this.abbreviatedLabel
= abbreviatedLabel
;
80 public String
getLabel(){
83 public void setLabel(String label
){
87 public String
getAbbreviatedLabel(){
88 return this.abbreviatedLabel
;
90 public void setAbbreviatedLabel(String abbreviatedLabel
){
91 this.abbreviatedLabel
= abbreviatedLabel
;
95 * Returns the description of this representation
96 * see {@link #getText()}
100 public String
getDescription(){
104 protected void setDescription(String text
) {
110 * Overrides super.getText() only to document that here the Text attribute
111 * should be used for a larger description of the label.
114 * Returns the description of this representation.
115 * @see #getDescription()
119 public String
getText(){
120 return super.getText();
125 public String
toString(){
126 // we dont need the language returned too, do we?
128 // if(getLanguage()==null || getLanguage().getLabel()==null){
129 // return getLabel();
131 // return getLabel()+"("+ getLanguage().getLabel()+")";
135 //*********************** CLONE ********************************************************/
138 * Clones <i>this</i> Representation. This is a shortcut that enables to create
139 * a new instance that differs only slightly from <i>this</i> Representation by
140 * modifying only some of the attributes.
142 * @see eu.etaxonomy.cdm.model.common.LanguageStringBase#clone()
143 * @see java.lang.Object#clone()
146 public Object
clone() {
148 Representation result
= (Representation
) super.clone();
149 //no changes to abbreviatedLabel and label
151 }catch (CloneNotSupportedException e
) {
152 logger
.warn("Object does not implement cloneable");