Project

General

Profile

Download (3.32 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.description;
11

    
12

    
13
import java.util.HashMap;
14
import java.util.Map;
15
import java.util.UUID;
16

    
17
import javax.persistence.Entity;
18
import javax.xml.bind.annotation.XmlAccessType;
19
import javax.xml.bind.annotation.XmlAccessorType;
20
import javax.xml.bind.annotation.XmlRootElement;
21
import javax.xml.bind.annotation.XmlType;
22

    
23
import org.apache.log4j.Logger;
24
import org.hibernate.envers.Audited;
25
import org.hibernate.search.annotations.Indexed;
26

    
27
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
28
import eu.etaxonomy.cdm.model.common.TermVocabulary;
29

    
30
/**
31
 * The class representing kinds of formats used for structuring text
32
 * (like "xml schema namespace", "rdf", or any other format).
33
 * 
34
 * @author m.doering
35
 * @version 1.0
36
 * @created 08-Nov-2007 13:06:59
37
 */
38
@XmlAccessorType(XmlAccessType.FIELD)
39
@XmlType(name = "TextFormat")
40
@XmlRootElement(name = "TextFormat")
41
@Entity
42
@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
43
@Audited
44
public class TextFormat extends DefinedTermBase<TextFormat> {
45
	private static final long serialVersionUID = 2063382669537212917L;
46
	@SuppressWarnings("unused")
47
	private static final Logger logger = Logger.getLogger(TextFormat.class);
48
	
49
	protected static Map<UUID, TextFormat> termMap = null;
50
	
51
	// ************* CONSTRUCTORS *************/	
52
	/** 
53
	 * Class constructor: creates a new empty text format instance.
54
	 * 
55
	 * @see 	#TextFormat(String, String, String, boolean, boolean)
56
	 */
57
	public TextFormat() {
58
	}
59

    
60
	/** 
61
	 * Class constructor: creates a new text format instance with a description,
62
	 * a label and a label abbreviation.
63
	 * 
64
	 * @param	term  		 the string (in the default language) describing the
65
	 * 						 new text format to be created 
66
	 * @param	label  		 the string identifying the new text format to be created
67
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
68
	 * 						 new text format to be created
69
	 * @see 				 #TextFormat()
70
	 */
71
	public TextFormat(String term, String label, String labelAbbrev) {
72
		super(term, label, labelAbbrev);
73
	}
74

    
75
	//********* METHODS **************************************/
76
	/** 
77
	 * Creates a new empty text format instance.
78
	 * 
79
	 * @see 	#NewInstance(String, String, String, boolean, boolean)
80
	 */
81
	public static TextFormat NewInstance(){
82
		return new TextFormat();
83
	}
84
	/** 
85
	 * Creates a new text format instance with a description, a label
86
	 * and a label abbreviation.
87
	 * 
88
	 * @param	term  		 the string (in the default language) describing the
89
	 * 						 new text format to be created 
90
	 * @param	label  		 the string identifying the new text format to be created
91
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
92
	 * 						 new text format to be created
93
	 * @see 				 #NewInstance()
94
	 */
95
	public static TextFormat NewInstance(String term, String label, String labelAbbrev){
96
		return new TextFormat(term, label, labelAbbrev);
97
	}
98

    
99
	@Override
100
	protected void setDefaultTerms(TermVocabulary<TextFormat> termVocabulary){
101
		termMap = new HashMap<UUID, TextFormat>();
102
		for (TextFormat term : termVocabulary.getTerms()){
103
			termMap.put(term.getUuid(), term); 
104
		}
105
	}
106
	
107
}
(33-33/36)