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.common;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
import javax.persistence.*;
|
14
|
|
15
|
/**
|
16
|
* @author m.doering
|
17
|
* @version 1.0
|
18
|
* @created 08-Nov-2007 13:06:32
|
19
|
*/
|
20
|
@Entity
|
21
|
public class LanguageString extends LanguageStringBase{
|
22
|
static Logger logger = Logger.getLogger(LanguageString.class);
|
23
|
|
24
|
public static LanguageString NewInstance(String text, Language language){
|
25
|
return new LanguageString(text, language);
|
26
|
}
|
27
|
|
28
|
protected LanguageString() {
|
29
|
super();
|
30
|
}
|
31
|
|
32
|
protected LanguageString(String text, Language language) {
|
33
|
super(text, language);
|
34
|
}
|
35
|
|
36
|
/* (non-Javadoc)
|
37
|
* @see eu.etaxonomy.cdm.model.common.CdmBase#toString()
|
38
|
*/
|
39
|
@Override
|
40
|
public String toString() {
|
41
|
if (text == null){
|
42
|
return super.toString() + "null";
|
43
|
}else{
|
44
|
String languagePart = "";
|
45
|
if (this.language != null){
|
46
|
languagePart = "(" + this.language.toString() + ")";
|
47
|
}
|
48
|
if (text.length() > 20){
|
49
|
return text.substring(0, 20) + "..." + languagePart;
|
50
|
}else{
|
51
|
return text + languagePart;
|
52
|
}
|
53
|
}
|
54
|
}
|
55
|
|
56
|
|
57
|
|
58
|
}
|