a6bfe92c922504cb7348029eec93696096aa5d47
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.description
;
13 import java
.util
.HashMap
;
15 import java
.util
.UUID
;
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
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.hibernate
.envers
.Audited
;
26 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
27 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
28 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
31 * The class representing kinds of formats used for structuring text
32 * (like "xml schema namespace", "rdf", or any other format).
35 * @since 08-Nov-2007 13:06:59
37 @XmlAccessorType(XmlAccessType
.FIELD
)
38 @XmlType(name
= "TextFormat")
39 @XmlRootElement(name
= "TextFormat")
41 //@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")
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);
49 protected static Map
<UUID
, TextFormat
> termMap
= null;
52 * Creates a new empty text format instance.
54 * @see #NewInstance(String, String, String, boolean, boolean)
56 public static TextFormat
NewInstance(){
57 return new TextFormat();
60 * Creates a new text format instance with a description, a label
61 * and a label abbreviation.
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
70 public static TextFormat
NewInstance(String term
, String label
, String labelAbbrev
){
71 return new TextFormat(term
, label
, labelAbbrev
);
74 //********************************** Constructor *******************************************************************/
76 //for hibernate use only
78 protected TextFormat() {
79 super(TermType
.TextFormat
);
83 * Class constructor: creates a new text format instance with a description,
84 * a label and a label abbreviation.
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
93 private TextFormat(String term
, String label
, String labelAbbrev
) {
94 super(TermType
.TextFormat
, term
, label
, labelAbbrev
);
97 //********* METHODS **************************************/
101 public void resetTerms(){
106 protected void setDefaultTerms(TermVocabulary
<TextFormat
> termVocabulary
){
107 termMap
= new HashMap
<>();
108 for (TextFormat term
: termVocabulary
.getTerms()){
109 termMap
.put(term
.getUuid(), term
);