1 |
9479da48
|
Andreas Müller
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
c70a7f0f
|
Andreas Kohlbecker
|
* European Distributed Institute of Taxonomy
|
4 |
9479da48
|
Andreas Müller
|
* http://www.e-taxonomy.eu
|
5 |
c70a7f0f
|
Andreas Kohlbecker
|
*
|
6 |
9479da48
|
Andreas Müller
|
* 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 |
d11e2ca0
|
a.babadshanjan
|
import java.util.HashMap;
|
14 |
|
|
import java.util.Map;
|
15 |
|
|
import java.util.UUID;
|
16 |
|
|
|
17 |
03abbcde
|
Andreas Müller
|
import javax.persistence.Entity;
|
18 |
68f70701
|
a.babadshanjan
|
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 |
9479da48
|
Andreas Müller
|
|
23 |
03abbcde
|
Andreas Müller
|
import org.apache.log4j.Logger;
|
24 |
ee91bcd9
|
ben.clark
|
import org.hibernate.envers.Audited;
|
25 |
03abbcde
|
Andreas Müller
|
|
26 |
|
|
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
|
27 |
533cbb43
|
Andreas Müller
|
import eu.etaxonomy.cdm.model.common.TermType;
|
28 |
f6765014
|
ben.clark
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
29 |
03abbcde
|
Andreas Müller
|
|
30 |
9479da48
|
Andreas Müller
|
/**
|
31 |
ae6212a2
|
m.geoffroy
|
* The class representing kinds of formats used for structuring text
|
32 |
|
|
* (like "xml schema namespace", "rdf", or any other format).
|
33 |
c70a7f0f
|
Andreas Kohlbecker
|
*
|
34 |
9479da48
|
Andreas Müller
|
* @author m.doering
|
35 |
|
|
* @created 08-Nov-2007 13:06:59
|
36 |
|
|
*/
|
37 |
68f70701
|
a.babadshanjan
|
@XmlAccessorType(XmlAccessType.FIELD)
|
38 |
|
|
@XmlType(name = "TextFormat")
|
39 |
|
|
@XmlRootElement(name = "TextFormat")
|
40 |
9479da48
|
Andreas Müller
|
@Entity
|
41 |
c70a7f0f
|
Andreas Kohlbecker
|
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
|
42 |
|
|
//@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
|
43 |
ee91bcd9
|
ben.clark
|
@Audited
|
44 |
03abbcde
|
Andreas Müller
|
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 |
c70a7f0f
|
Andreas Kohlbecker
|
|
49 |
d11e2ca0
|
a.babadshanjan
|
protected static Map<UUID, TextFormat> termMap = null;
|
50 |
c70a7f0f
|
Andreas Kohlbecker
|
|
51 |
|
|
/**
|
52 |
8cc82a87
|
Andreas Müller
|
* Creates a new empty text format instance.
|
53 |
c70a7f0f
|
Andreas Kohlbecker
|
*
|
54 |
8cc82a87
|
Andreas Müller
|
* @see #NewInstance(String, String, String, boolean, boolean)
|
55 |
ae6212a2
|
m.geoffroy
|
*/
|
56 |
8cc82a87
|
Andreas Müller
|
public static TextFormat NewInstance(){
|
57 |
|
|
return new TextFormat();
|
58 |
9479da48
|
Andreas Müller
|
}
|
59 |
c70a7f0f
|
Andreas Kohlbecker
|
/**
|
60 |
8cc82a87
|
Andreas Müller
|
* Creates a new text format instance with a description, a label
|
61 |
|
|
* and a label abbreviation.
|
62 |
c70a7f0f
|
Andreas Kohlbecker
|
*
|
63 |
ae6212a2
|
m.geoffroy
|
* @param term the string (in the default language) describing the
|
64 |
c70a7f0f
|
Andreas Kohlbecker
|
* new text format to be created
|
65 |
ae6212a2
|
m.geoffroy
|
* @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 |
8cc82a87
|
Andreas Müller
|
* @see #NewInstance()
|
69 |
ae6212a2
|
m.geoffroy
|
*/
|
70 |
8cc82a87
|
Andreas Müller
|
public static TextFormat NewInstance(String term, String label, String labelAbbrev){
|
71 |
|
|
return new TextFormat(term, label, labelAbbrev);
|
72 |
9479da48
|
Andreas Müller
|
}
|
73 |
c70a7f0f
|
Andreas Kohlbecker
|
|
74 |
|
|
//********************************** Constructor *******************************************************************/
|
75 |
ae6212a2
|
m.geoffroy
|
|
76 |
9e3239f6
|
Andreas Müller
|
//for hibernate use only
|
77 |
|
|
@Deprecated
|
78 |
|
|
protected TextFormat() {
|
79 |
|
|
super(TermType.TextFormat);
|
80 |
ae6212a2
|
m.geoffroy
|
}
|
81 |
8cc82a87
|
Andreas Müller
|
|
82 |
c70a7f0f
|
Andreas Kohlbecker
|
/**
|
83 |
8cc82a87
|
Andreas Müller
|
* Class constructor: creates a new text format instance with a description,
|
84 |
|
|
* a label and a label abbreviation.
|
85 |
c70a7f0f
|
Andreas Kohlbecker
|
*
|
86 |
ae6212a2
|
m.geoffroy
|
* @param term the string (in the default language) describing the
|
87 |
c70a7f0f
|
Andreas Kohlbecker
|
* new text format to be created
|
88 |
ae6212a2
|
m.geoffroy
|
* @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 |
8cc82a87
|
Andreas Müller
|
* @see #TextFormat()
|
92 |
ae6212a2
|
m.geoffroy
|
*/
|
93 |
9e3239f6
|
Andreas Müller
|
private TextFormat(String term, String label, String labelAbbrev) {
|
94 |
533cbb43
|
Andreas Müller
|
super(TermType.TextFormat, term, label, labelAbbrev);
|
95 |
8cc82a87
|
Andreas Müller
|
}
|
96 |
|
|
|
97 |
|
|
//********* METHODS **************************************/
|
98 |
|
|
|
99 |
c70a7f0f
|
Andreas Kohlbecker
|
|
100 |
8cc82a87
|
Andreas Müller
|
/* (non-Javadoc)
|
101 |
|
|
* @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
|
102 |
|
|
*/
|
103 |
|
|
@Override
|
104 |
|
|
public void resetTerms(){
|
105 |
|
|
termMap = null;
|
106 |
ae6212a2
|
m.geoffroy
|
}
|
107 |
f6765014
|
ben.clark
|
|
108 |
|
|
@Override
|
109 |
d11e2ca0
|
a.babadshanjan
|
protected void setDefaultTerms(TermVocabulary<TextFormat> termVocabulary){
|
110 |
|
|
termMap = new HashMap<UUID, TextFormat>();
|
111 |
|
|
for (TextFormat term : termVocabulary.getTerms()){
|
112 |
c70a7f0f
|
Andreas Kohlbecker
|
termMap.put(term.getUuid(), term);
|
113 |
d11e2ca0
|
a.babadshanjan
|
}
|
114 |
f6765014
|
ben.clark
|
}
|
115 |
c70a7f0f
|
Andreas Kohlbecker
|
|
116 |
9479da48
|
Andreas Müller
|
}
|