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
|
package eu.etaxonomy.cdm.model.common;
|
10
|
|
11
|
import java.util.HashMap;
|
12
|
import java.util.Map;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import javax.persistence.Entity;
|
16
|
import javax.xml.bind.annotation.XmlAccessType;
|
17
|
import javax.xml.bind.annotation.XmlAccessorType;
|
18
|
import javax.xml.bind.annotation.XmlRootElement;
|
19
|
import javax.xml.bind.annotation.XmlType;
|
20
|
|
21
|
import org.hibernate.envers.Audited;
|
22
|
|
23
|
|
24
|
/**
|
25
|
* @author a.mueller
|
26
|
* @created 2013-06-19
|
27
|
*
|
28
|
*/
|
29
|
@XmlAccessorType(XmlAccessType.FIELD)
|
30
|
@XmlType(name = "DefinedTerm")
|
31
|
@XmlRootElement(name = "DefinedTerm")
|
32
|
@Entity
|
33
|
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
|
34
|
//@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
|
35
|
@Audited
|
36
|
public class DefinedTerm extends DefinedTermBase<DefinedTerm> implements Comparable<DefinedTerm> {
|
37
|
private static final long serialVersionUID = -6965540410672076893L;
|
38
|
|
39
|
//Determination modifier
|
40
|
public static final UUID uuidConfer = UUID.fromString("20db670a-2db2-49cc-bbdd-eace33694b7f");
|
41
|
public static final UUID uuidAffinis = UUID.fromString("128f0b54-73e2-4efb-bfda-a6243185a562");
|
42
|
|
43
|
//Sex
|
44
|
private static final UUID uuidMale = UUID.fromString("600a5212-cc02-431d-8a80-2bf595bd1eab");
|
45
|
private static final UUID uuidFemale = UUID.fromString("b4cfe0cb-b35c-4f97-9b6b-2b3c096ea2c0");
|
46
|
private static final UUID uuidHermaphrodite = UUID.fromString("0deddc65-2505-4c77-91a7-17d0de24afcc");
|
47
|
private static final UUID uuidUnknown = UUID.fromString("4f5e4c51-a664-48ad-8238-2e9f49eaf8dd");
|
48
|
|
49
|
//Marker
|
50
|
private static final UUID uuidIts1 = UUID.fromString("3f2de4f6-d1a2-4c3a-be70-3c997ef92543");
|
51
|
|
52
|
//kindOfUnit
|
53
|
public static final UUID uuidSpecimenScan = UUID.fromString("acda15be-c0e2-4ea8-8783-b9b0c4ad7f03");
|
54
|
public static final UUID uuidDetailImage = UUID.fromString("31eb8d02-bf5d-437c-bcc6-87a626445f34");
|
55
|
|
56
|
|
57
|
//Identifier Type
|
58
|
public static final UUID uuidLsid = UUID.fromString("26729412-9df6-4cc3-9e5d-501531ca21f0");
|
59
|
public static final UUID uuidAlternativeFieldNumber = UUID.fromString("054fd3d1-1961-42f8-b024-b91184ac9e0c");
|
60
|
|
61
|
//TaxonNode Agent Relation Type
|
62
|
public static final UUID uuidLastScrutiny = UUID.fromString("b4495910-28e9-4a49-86cf-a0476c78f460");
|
63
|
public static final UUID uuidAuthorOfSubtree = UUID.fromString("c2c7e9b7-d6a7-48a0-b13f-a7a2e2a9b8c9");
|
64
|
|
65
|
protected static Map<UUID, DefinedTerm> termMap = null;
|
66
|
|
67
|
|
68
|
protected static DefinedTerm getTermByUuid(UUID uuid){
|
69
|
if (termMap == null || termMap.isEmpty()){
|
70
|
return getTermByClassAndUUID(DefinedTerm.class, uuid);
|
71
|
} else{
|
72
|
return termMap.get(uuid);
|
73
|
}
|
74
|
}
|
75
|
|
76
|
|
77
|
public static DefinedTerm NewInstance(TermType termType, String description, String label, String labelAbbrev){
|
78
|
return new DefinedTerm(termType, description, label, labelAbbrev);
|
79
|
}
|
80
|
|
81
|
|
82
|
public static DefinedTerm NewModifierInstance(String description, String label, String labelAbbrev){
|
83
|
return new DefinedTerm(TermType.Modifier, description, label, labelAbbrev);
|
84
|
}
|
85
|
|
86
|
public static DefinedTerm NewInstitutionTypeInstance(String description, String label, String labelAbbrev){
|
87
|
return new DefinedTerm(TermType.InstitutionType, description, label, labelAbbrev);
|
88
|
}
|
89
|
|
90
|
public static DefinedTerm NewStageInstance(String description, String label, String labelAbbrev){
|
91
|
return new DefinedTerm(TermType.Stage, description, label, labelAbbrev);
|
92
|
}
|
93
|
|
94
|
public static DefinedTerm NewSexInstance(String description, String label, String labelAbbrev){
|
95
|
return new DefinedTerm(TermType.Sex, description, label, labelAbbrev);
|
96
|
}
|
97
|
|
98
|
public static DefinedTerm NewScopeInstance(String description, String label, String labelAbbrev){
|
99
|
return new DefinedTerm(TermType.Scope, description, label, labelAbbrev);
|
100
|
}
|
101
|
|
102
|
public static DefinedTerm NewDnaMarkerInstance(String description, String label, String labelAbbrev){
|
103
|
return new DefinedTerm(TermType.DnaMarker, description, label, labelAbbrev);
|
104
|
}
|
105
|
|
106
|
public static DefinedTerm NewKindOfUnitInstance(String description, String label, String labelAbbrev){
|
107
|
return new DefinedTerm(TermType.KindOfUnit, description, label, labelAbbrev);
|
108
|
}
|
109
|
|
110
|
public static DefinedTerm NewIdentifierTypeInstance(String description, String label, String labelAbbrev){
|
111
|
return new DefinedTerm(TermType.IdentifierType, description, label, labelAbbrev);
|
112
|
}
|
113
|
|
114
|
public static DefinedTerm NewTaxonNodeAgentRelationTypeInstance(String description, String label, String labelAbbrev){
|
115
|
return new DefinedTerm(TermType.TaxonNodeAgentRelationType, description, label, labelAbbrev);
|
116
|
}
|
117
|
|
118
|
//******************* CONSTRUCTOR ***********************************/
|
119
|
|
120
|
//for hibernate/javassist use only
|
121
|
@Deprecated
|
122
|
protected DefinedTerm(){super(TermType.Unknown);}
|
123
|
|
124
|
public DefinedTerm(TermType type, String description, String label, String labelAbbrev) {
|
125
|
super(type, description, label, labelAbbrev);
|
126
|
}
|
127
|
|
128
|
//*************************** TERM MAP *********************/
|
129
|
|
130
|
|
131
|
public static final DefinedTerm DETERMINATION_MODIFIER_AFFINIS(){
|
132
|
return getTermByUuid(uuidAffinis);
|
133
|
}
|
134
|
|
135
|
public static final DefinedTerm DETERMINATION_MODIFIER_CONFER(){
|
136
|
return getTermByUuid(uuidConfer);
|
137
|
}
|
138
|
|
139
|
public static DefinedTerm SEX_MALE(){
|
140
|
return getTermByUuid(uuidMale);
|
141
|
}
|
142
|
|
143
|
public static DefinedTerm SEX_FEMALE(){
|
144
|
return getTermByUuid(uuidFemale);
|
145
|
}
|
146
|
|
147
|
public static DefinedTerm SEX_HERMAPHRODITE(){
|
148
|
return getTermByUuid(uuidHermaphrodite);
|
149
|
}
|
150
|
|
151
|
public static DefinedTerm SEX_UNKNOWN(){
|
152
|
return getTermByUuid(uuidUnknown);
|
153
|
}
|
154
|
|
155
|
public static DefinedTerm ITS1_MARKER(){
|
156
|
return getTermByUuid(uuidIts1);
|
157
|
}
|
158
|
|
159
|
|
160
|
@Override
|
161
|
public void resetTerms() {
|
162
|
termMap = null;
|
163
|
}
|
164
|
|
165
|
@Override
|
166
|
protected void setDefaultTerms(TermVocabulary<DefinedTerm> termVocabulary) {
|
167
|
if (termMap == null){
|
168
|
termMap = new HashMap<UUID, DefinedTerm>();
|
169
|
}
|
170
|
for (DefinedTerm term : termVocabulary.getTerms()){
|
171
|
termMap.put(term.getUuid(), term);
|
172
|
}
|
173
|
}
|
174
|
|
175
|
@Override
|
176
|
protected int partOfCsvLineIndex(){
|
177
|
return 5;
|
178
|
}
|
179
|
|
180
|
// @Override
|
181
|
// void readIsPartOf(DefinedTerm newInstance, List<String> csvLine, Map<UUID, DefinedTermBase> terms) {
|
182
|
// int index = 7;
|
183
|
// String partOfString = csvLine.get(index);
|
184
|
//
|
185
|
// if(StringUtils.isNotBlank(partOfString)) {
|
186
|
// UUID partOfUuid = UUID.fromString(partOfString);
|
187
|
// DefinedTerm partOf = (DefinedTerm)terms.get(partOfUuid);
|
188
|
// partOf.addIncludes(newInstance);
|
189
|
// }
|
190
|
//
|
191
|
// }
|
192
|
|
193
|
}
|