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
.common
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.hibernate
.envers
.Audited
;
15 import org
.hibernate
.search
.annotations
.Field
;
16 import org
.hibernate
.search
.annotations
.Index
;
17 import org
.hibernate
.search
.annotations
.Indexed
;
22 import javax
.persistence
.*;
23 import javax
.xml
.bind
.annotation
.XmlAccessType
;
24 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
25 import javax
.xml
.bind
.annotation
.XmlAttribute
;
26 import javax
.xml
.bind
.annotation
.XmlType
;
29 * Marker types similar to dynamically defined attributes. These content types
30 * like "IS_DOUBTFUL", "COMPLETE" or specific local flags.
33 * @created 08-Nov-2007 13:06:33
35 @XmlAccessorType(XmlAccessType
.FIELD
)
36 @XmlType(name
= "MarkerType")
38 @Indexed(index
= "eu.etaxonomy.cdm.model.common.DefinedTermBase")
40 public class MarkerType
extends DefinedTermBase
<MarkerType
> {
41 private static final long serialVersionUID
= -9117424749919907396L;
42 public static final Logger logger
= Logger
.getLogger(MarkerType
.class);
44 private static final UUID uuidImported
= UUID
.fromString("96878790-4ceb-42a2-9738-a2242079b679");
45 private static final UUID uuidToBeChecked
= UUID
.fromString("34204192-b41d-4857-a1d4-28992bef2a2a");
46 private static final UUID uuidIsDoubtful
= UUID
.fromString("b51325c8-05fe-421a-832b-d86fc249ef6e");
47 private static final UUID uuidComplete
= UUID
.fromString("b4b1b2ab-89a8-4ce6-8110-d60b8b1bc433");
48 private static final UUID uuidPublish
= UUID
.fromString("0522c2b3-b21c-400c-80fc-a251c3501dbc");
49 private static final UUID uuidInBibliography
= UUID
.fromString("2cdb492e-3b8b-4784-8c26-25159835231d");
50 private static final UUID uuidEndemic
= UUID
.fromString("efe95ade-8a6c-4a0e-800e-437c8b50c45e");
52 protected static Map
<UUID
, MarkerType
> termMap
= null;
54 public static MarkerType
NewInstance(String term
, String label
, String labelAbbrev
){
55 return new MarkerType(term
, label
, labelAbbrev
);
60 @XmlAttribute(name
= "isTechnical")
61 @Field(index
=Index
.UN_TOKENIZED
)
62 private boolean isTechnical
=false;
76 * A flag indicating if markers of this type are user content or technical information
77 * to be used by applications only. E.g. a FeatureTree may have a marker that defines
78 * the role of this FeatureTree ("for ordering") whereas a {@link eu.etaxonomy.cdm.model.taxon.Taxon taxon}
79 * may have a user defined marker "completed" that indicates that this taxon does not
80 * need further investigation. The earlier will be flagged isTechnical=true whereas
81 * the later will be flagged as isTechnical=false
82 * @return the isTechnical
84 public boolean isTechnical() {
89 * @param isTechnical the isTechnical to set
91 public void setTechnical(boolean isTechnical
) {
92 this.isTechnical
= isTechnical
;
95 //***************************** CONSTRUCTOR **************************************/
102 protected MarkerType(String term
, String label
, String labelAbbrev
) {
103 super(term
, label
, labelAbbrev
);
106 //***************************** TERMS **************************************/
110 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
113 public void resetTerms(){
118 protected static MarkerType
getTermByUuid(UUID uuid
){
119 if (termMap
== null){
120 DefaultTermInitializer vocabularyStore
= new DefaultTermInitializer();
121 vocabularyStore
.initialize();
123 return (MarkerType
)termMap
.get(uuid
);
126 public static final MarkerType
IMPORTED(){
127 return getTermByUuid(uuidImported
);
130 public static final MarkerType
TO_BE_CHECKED(){
131 return getTermByUuid(uuidToBeChecked
);
134 public static final MarkerType
IS_DOUBTFUL(){
135 return getTermByUuid(uuidIsDoubtful
);
138 public static final MarkerType
COMPLETE(){
139 return getTermByUuid(uuidComplete
);
142 public static final MarkerType
PUBLISH(){
143 return getTermByUuid(uuidPublish
);
146 public static final MarkerType
IN_BIBLIOGRAPHY(){
147 return getTermByUuid(uuidInBibliography
);
150 public static final MarkerType
ENDEMIC(){
151 return getTermByUuid(uuidEndemic
);
155 protected void setDefaultTerms(TermVocabulary
<MarkerType
> termVocabulary
) {
156 termMap
= new HashMap
<UUID
, MarkerType
>();
157 for (MarkerType term
: termVocabulary
.getTerms()){
158 termMap
.put(term
.getUuid(), (MarkerType
)term
);