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.common;
|
11
|
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
import org.hibernate.envers.Audited;
|
15
|
|
16
|
import java.util.*;
|
17
|
|
18
|
import javax.persistence.*;
|
19
|
import javax.xml.bind.annotation.XmlAccessType;
|
20
|
import javax.xml.bind.annotation.XmlAccessorType;
|
21
|
import javax.xml.bind.annotation.XmlType;
|
22
|
|
23
|
/**
|
24
|
* Marker types similar to dynamically defined attributes. These content types
|
25
|
* like "IS_DOUBTFUL", "COMPLETE" or specific local flags.
|
26
|
* @author m.doering
|
27
|
* @version 1.0
|
28
|
* @created 08-Nov-2007 13:06:33
|
29
|
*/
|
30
|
@XmlAccessorType(XmlAccessType.FIELD)
|
31
|
@XmlType(name = "MarkerType")
|
32
|
@Entity
|
33
|
@Audited
|
34
|
public class MarkerType extends DefinedTermBase<MarkerType> {
|
35
|
private static final long serialVersionUID = -9117424749919907396L;
|
36
|
public static final Logger logger = Logger.getLogger(MarkerType.class);
|
37
|
|
38
|
private static final UUID uuidImported = UUID.fromString("96878790-4ceb-42a2-9738-a2242079b679");
|
39
|
private static final UUID uuidToBeChecked = UUID.fromString("34204192-b41d-4857-a1d4-28992bef2a2a");
|
40
|
private static final UUID uuidIsDoubtful = UUID.fromString("b51325c8-05fe-421a-832b-d86fc249ef6e");
|
41
|
private static final UUID uuidComplete = UUID.fromString("b4b1b2ab-89a8-4ce6-8110-d60b8b1bc433");
|
42
|
private static final UUID uuidPublish = UUID.fromString("0522c2b3-b21c-400c-80fc-a251c3501dbc");
|
43
|
private static final UUID uuidInBibliography = UUID.fromString("2cdb492e-3b8b-4784-8c26-25159835231d");
|
44
|
|
45
|
protected static Map<UUID, MarkerType> termMap = null;
|
46
|
|
47
|
public static MarkerType NewInstance(String term, String label, String labelAbbrev){
|
48
|
return new MarkerType(term, label, labelAbbrev);
|
49
|
}
|
50
|
|
51
|
protected static MarkerType getTermByUuid(UUID uuid){
|
52
|
if (termMap == null){
|
53
|
DefaultTermInitializer vocabularyStore = new DefaultTermInitializer();
|
54
|
vocabularyStore.initialize();
|
55
|
}
|
56
|
return (MarkerType)termMap.get(uuid);
|
57
|
}
|
58
|
|
59
|
|
60
|
/**
|
61
|
* Constructor
|
62
|
* @param term
|
63
|
* @param label
|
64
|
*/
|
65
|
public MarkerType() {
|
66
|
super();
|
67
|
}
|
68
|
|
69
|
/**
|
70
|
* Constructor
|
71
|
* @param term
|
72
|
* @param label
|
73
|
*/
|
74
|
protected MarkerType(String term, String label, String labelAbbrev) {
|
75
|
super(term, label, labelAbbrev);
|
76
|
}
|
77
|
|
78
|
|
79
|
public static final MarkerType IMPORTED(){
|
80
|
return getTermByUuid(uuidImported);
|
81
|
}
|
82
|
|
83
|
public static final MarkerType TO_BE_CHECKED(){
|
84
|
return getTermByUuid(uuidToBeChecked);
|
85
|
}
|
86
|
|
87
|
public static final MarkerType IS_DOUBTFUL(){
|
88
|
return getTermByUuid(uuidIsDoubtful);
|
89
|
}
|
90
|
|
91
|
public static final MarkerType COMPLETE(){
|
92
|
return getTermByUuid(uuidComplete);
|
93
|
}
|
94
|
|
95
|
public static final MarkerType PUBLISH(){
|
96
|
return getTermByUuid(uuidPublish);
|
97
|
}
|
98
|
|
99
|
public static final MarkerType IN_BIBLIOGRAPHY(){
|
100
|
return getTermByUuid(uuidInBibliography);
|
101
|
}
|
102
|
|
103
|
@Override
|
104
|
protected void setDefaultTerms(TermVocabulary<MarkerType> termVocabulary) {
|
105
|
termMap = new HashMap<UUID, MarkerType>();
|
106
|
for (MarkerType term : termVocabulary.getTerms()){
|
107
|
termMap.put(term.getUuid(), (MarkerType)term);
|
108
|
}
|
109
|
}
|
110
|
|
111
|
}
|