1 |
9479da48
|
Andreas Müller
|
/**
|
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 |
f4713776
|
Andreas Müller
|
@Entity
|
21 |
bdd34db4
|
Andreas Müller
|
public class LanguageString extends LanguageStringBase{
|
22 |
9479da48
|
Andreas Müller
|
static Logger logger = Logger.getLogger(LanguageString.class);
|
23 |
|
|
|
24 |
39fc27c3
|
Andreas Müller
|
public static LanguageString NewInstance(String text, Language language){
|
25 |
|
|
return new LanguageString(text, language);
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
protected LanguageString() {
|
29 |
9479da48
|
Andreas Müller
|
super();
|
30 |
|
|
}
|
31 |
39fc27c3
|
Andreas Müller
|
|
32 |
f4713776
|
Andreas Müller
|
protected LanguageString(String text, Language language) {
|
33 |
|
|
super(text, language);
|
34 |
9479da48
|
Andreas Müller
|
}
|
35 |
e57694f4
|
Andreas Müller
|
|
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 |
9479da48
|
Andreas Müller
|
|
58 |
|
|
}
|