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
|
|
26
|
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
|
27
|
import eu.etaxonomy.cdm.model.term.TermType;
|
28
|
import eu.etaxonomy.cdm.model.term.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
|
* @since 08-Nov-2007 13:06:59
|
36
|
*/
|
37
|
@XmlAccessorType(XmlAccessType.FIELD)
|
38
|
@XmlType(name = "TextFormat")
|
39
|
@XmlRootElement(name = "TextFormat")
|
40
|
@Entity
|
41
|
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
|
42
|
//@Indexed(index = "eu.etaxonomy.cdm.model.term.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
|
/**
|
52
|
* Creates a new empty text format instance.
|
53
|
*
|
54
|
* @see #NewInstance(String, String, String, boolean, boolean)
|
55
|
*/
|
56
|
public static TextFormat NewInstance(){
|
57
|
return new TextFormat();
|
58
|
}
|
59
|
/**
|
60
|
* Creates a new text format instance with a description, a label
|
61
|
* and a label abbreviation.
|
62
|
*
|
63
|
* @param term the string (in the default language) describing the
|
64
|
* new text format to be created
|
65
|
* @param label the string identifying the new text format to be created
|
66
|
* @param labelAbbrev the string identifying (in abbreviated form) the
|
67
|
* new text format to be created
|
68
|
* @see #NewInstance()
|
69
|
*/
|
70
|
public static TextFormat NewInstance(String term, String label, String labelAbbrev){
|
71
|
return new TextFormat(term, label, labelAbbrev);
|
72
|
}
|
73
|
|
74
|
//********************************** Constructor *******************************************************************/
|
75
|
|
76
|
//for hibernate use only
|
77
|
@Deprecated
|
78
|
protected TextFormat() {
|
79
|
super(TermType.TextFormat);
|
80
|
}
|
81
|
|
82
|
/**
|
83
|
* Class constructor: creates a new text format instance with a description,
|
84
|
* a label and a label abbreviation.
|
85
|
*
|
86
|
* @param term the string (in the default language) describing the
|
87
|
* new text format to be created
|
88
|
* @param label the string identifying the new text format to be created
|
89
|
* @param labelAbbrev the string identifying (in abbreviated form) the
|
90
|
* new text format to be created
|
91
|
* @see #TextFormat()
|
92
|
*/
|
93
|
private TextFormat(String term, String label, String labelAbbrev) {
|
94
|
super(TermType.TextFormat, term, label, labelAbbrev);
|
95
|
}
|
96
|
|
97
|
//********* METHODS **************************************/
|
98
|
|
99
|
|
100
|
@Override
|
101
|
public void resetTerms(){
|
102
|
termMap = null;
|
103
|
}
|
104
|
|
105
|
@Override
|
106
|
protected void setDefaultTerms(TermVocabulary<TextFormat> termVocabulary){
|
107
|
termMap = new HashMap<>();
|
108
|
for (TextFormat term : termVocabulary.getTerms()){
|
109
|
termMap.put(term.getUuid(), term);
|
110
|
}
|
111
|
}
|
112
|
|
113
|
}
|