Delete Warning, no substantial changes
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / common / LanguageString.java
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 javax.persistence.Entity;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlRootElement;
16 import javax.xml.bind.annotation.XmlType;
17
18 import org.apache.log4j.Logger;
19
20 /**
21 * @author m.doering
22 * @version 1.0
23 * @created 08-Nov-2007 13:06:32
24 */
25 @XmlAccessorType(XmlAccessType.FIELD)
26 @XmlType(name = "LanguageString")
27 @XmlRootElement(name = "LanguageString")
28 @Entity
29 public class LanguageString extends LanguageStringBase{
30 private static final long serialVersionUID = -1502298496073201104L;
31 @SuppressWarnings("unused")
32 private static final Logger logger = Logger.getLogger(LanguageString.class);
33
34 public static LanguageString NewInstance(String text, Language language){
35 return new LanguageString(text, language);
36 }
37
38 protected LanguageString() {
39 super();
40 }
41
42 protected LanguageString(String text, Language language) {
43 super(text, language);
44 }
45
46 /* (non-Javadoc)
47 * @see eu.etaxonomy.cdm.model.common.CdmBase#toString()
48 */
49 @Override
50 public String toString() {
51 if (text == null){
52 return super.toString() + "null";
53 }else{
54 String languagePart = "";
55 if (this.language != null){
56 languagePart = "(" + this.language.toString() + ")";
57 }
58 if (text.length() > 20){
59 return text.substring(0, 20) + "..." + languagePart;
60 }else{
61 return text + languagePart;
62 }
63 }
64 }
65
66
67
68 }