Project

General

Profile

Download (1.64 KB) Statistics
| Branch: | Tag: | Revision:
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

    
13
import org.apache.log4j.Logger;
14
import org.hibernate.annotations.Cascade;
15
import org.hibernate.annotations.CascadeType;
16

    
17
import java.util.*;
18
import javax.persistence.*;
19

    
20
/**
21
 * @author m.doering
22
 * @version 1.0
23
 * @created 08-Nov-2007 13:06:32
24
 */
25
@MappedSuperclass
26
public class LanguageString  extends VersionableEntity{
27
	static Logger logger = Logger.getLogger(LanguageString.class);
28
	protected String text;
29
	private Language language;
30

    
31
	public LanguageString() {
32
		super();
33
	}
34
	public LanguageString(String text, Language lang) {
35
		this.setLanguage(lang);
36
		this.setText(text);
37
	}
38

    
39

    
40
	@ManyToOne
41
	@Cascade({CascadeType.SAVE_UPDATE})
42
	public Language getLanguage(){
43
		return this.language;
44
	}
45
	public void setLanguage(Language language){
46
		this.language = language;
47
	}
48

    
49
	public String getText(){
50
		return this.text;
51
	}
52
	protected void setText(String text) {
53
		this.text = text;
54
	}
55
	
56
	@Transient
57
	public String getLanguageLabel(){
58
		return this.language.getRepresentation(Language.DEFAULT()).getLabel();
59
	}
60
	@Transient
61
	public String getLanguageLabel(Language lang){
62
		return this.language.getRepresentation(lang).getLabel();
63
	}
64
	@Transient
65
	public String getLanguageText(){
66
		return this.language.getRepresentation(Language.DEFAULT()).getLabel();
67
	}
68
	@Transient
69
	public String getLanguageText(Language lang){
70
		return this.language.getRepresentation(lang).getLabel();
71
	}
72
}
(22-22/46)