1
|
/**
|
2
|
* Copyright (C) 2009 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.occurrence;
|
11
|
|
12
|
import java.util.HashMap;
|
13
|
import java.util.Map;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import javax.persistence.Entity;
|
17
|
import javax.xml.bind.annotation.XmlAccessType;
|
18
|
import javax.xml.bind.annotation.XmlAccessorType;
|
19
|
import javax.xml.bind.annotation.XmlRootElement;
|
20
|
import javax.xml.bind.annotation.XmlType;
|
21
|
|
22
|
import org.apache.log4j.Logger;
|
23
|
import org.hibernate.envers.Audited;
|
24
|
|
25
|
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
|
26
|
import eu.etaxonomy.cdm.model.common.TermType;
|
27
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
28
|
import eu.etaxonomy.cdm.model.description.DescriptionBase;
|
29
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
30
|
|
31
|
/**
|
32
|
* @author m.doering
|
33
|
*/
|
34
|
@XmlAccessorType(XmlAccessType.FIELD)
|
35
|
@XmlType(name = "DerivationEventType")
|
36
|
@XmlRootElement(name = "DerivationEventType")
|
37
|
@Entity
|
38
|
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
|
39
|
//@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
|
40
|
@Audited
|
41
|
public class DerivationEventType extends DefinedTermBase<DerivationEventType> {
|
42
|
private static final long serialVersionUID = 6895093454763415279L;
|
43
|
@SuppressWarnings("unused")
|
44
|
private static final Logger logger = Logger.getLogger(DerivationEventType.class);
|
45
|
|
46
|
private static final UUID uuidAccessioning = UUID.fromString("3c7c0929-0528-493e-9e5f-15e0d9585fa1");
|
47
|
private static final UUID uuidDnaExtraction = UUID.fromString("f9f957b6-88c0-4531-9a7f-b5fb1c9daf66");
|
48
|
private static final UUID uuidDuplicate = UUID.fromString("8f54c7cc-eb5e-4652-a6e4-3a4ba429b327");
|
49
|
private static final UUID uuidDuplicateSegregation = UUID.fromString("661e7292-6bcb-495d-a3cc-140024ae3471");
|
50
|
private static final UUID uuidGatheringInSitu = UUID.fromString("1cb2bd40-5c9c-459b-89c7-4d9c2fca7432");
|
51
|
private static final UUID uuidGrouping = UUID.fromString("f7fbfbbb-86c6-4a1f-afb8-028becd2987f");
|
52
|
private static final UUID uuidIndividualSelection = UUID.fromString("90a1062f-fa5b-4971-9990-4382e4ff70ba");
|
53
|
private static final UUID uuidIndividualCultivation = UUID.fromString("f8febad5-4b4d-40fa-80e0-d1f82d4f510c");
|
54
|
private static final UUID uuidTissueSampling = UUID.fromString("9dc1df08-1f31-4008-a4e2-1ddf7c9115da");
|
55
|
private static final UUID uuidVegetativPropagation = UUID.fromString("a4a8e4ce-0e58-462a-be67-a7f567d96da1");
|
56
|
private static final UUID uuidSexualReproduction = UUID.fromString("aa79baac-165d-47ad-9e80-52a03776d8ae");
|
57
|
private static final UUID uuidPreparation = UUID.fromString("c868c472-4b60-4299-920a-a5698e4c26f4");
|
58
|
private static final UUID uuidCultivationExSitu = UUID.fromString("39d6d69c-17aa-4ece-a137-5ac47ed5d737");
|
59
|
|
60
|
protected static Map<UUID, DerivationEventType> termMap = null;
|
61
|
|
62
|
|
63
|
|
64
|
/**
|
65
|
* Factory method
|
66
|
* @return
|
67
|
*/
|
68
|
public static DerivationEventType NewInstance(){
|
69
|
return new DerivationEventType();
|
70
|
}
|
71
|
|
72
|
|
73
|
/**
|
74
|
* Factory method
|
75
|
* @return
|
76
|
*/
|
77
|
public static DerivationEventType NewInstance(String term, String label, String labelAbbrev){
|
78
|
return new DerivationEventType(term, label, labelAbbrev);
|
79
|
}
|
80
|
|
81
|
//********************************** Constructor *********************************/
|
82
|
|
83
|
//for hibernate use only
|
84
|
@Deprecated
|
85
|
protected DerivationEventType() {
|
86
|
super(TermType.DerivationEventType);
|
87
|
}
|
88
|
|
89
|
|
90
|
private DerivationEventType(String term, String label, String labelAbbrev) {
|
91
|
super(TermType.DerivationEventType, term, label, labelAbbrev);
|
92
|
}
|
93
|
|
94
|
|
95
|
//************************** METHODS ********************************
|
96
|
|
97
|
|
98
|
@Override
|
99
|
public void resetTerms(){
|
100
|
termMap = null;
|
101
|
}
|
102
|
|
103
|
|
104
|
protected static DerivationEventType getTermByUuid(UUID uuid){
|
105
|
if (termMap == null || termMap.isEmpty()){
|
106
|
return getTermByClassAndUUID(DerivationEventType.class, uuid);
|
107
|
} else {
|
108
|
return termMap.get(uuid);
|
109
|
}
|
110
|
}
|
111
|
|
112
|
/**
|
113
|
* TODO distinguish from {@link #DUPLICATE_SEGREGATEION()}
|
114
|
* @return
|
115
|
*/
|
116
|
public static final DerivationEventType DUPLICATE(){
|
117
|
return getTermByUuid(uuidDuplicate);
|
118
|
}
|
119
|
public static final DerivationEventType GATHERING_IN_SITU(){
|
120
|
return getTermByUuid(uuidGatheringInSitu);
|
121
|
}
|
122
|
public static final DerivationEventType TISSUE_SAMPLING(){
|
123
|
return getTermByUuid(uuidTissueSampling);
|
124
|
}
|
125
|
public static final DerivationEventType DNA_EXTRACTION(){
|
126
|
return getTermByUuid(uuidDnaExtraction);
|
127
|
}
|
128
|
public static final DerivationEventType VEGETATIVE_PROPAGATION(){
|
129
|
return getTermByUuid(uuidVegetativPropagation);
|
130
|
}
|
131
|
/**
|
132
|
* TODO distinguish from {@link #DUPLICATE()}
|
133
|
* @return
|
134
|
*/
|
135
|
public static final DerivationEventType DUPLICATE_SEGREGATEION(){
|
136
|
return getTermByUuid(uuidDuplicateSegregation);
|
137
|
}
|
138
|
/**
|
139
|
* The accessioning in a collection which usually results in an accession number.
|
140
|
* @return
|
141
|
*/
|
142
|
public static final DerivationEventType ACCESSIONING(){
|
143
|
return getTermByUuid(uuidAccessioning);
|
144
|
}
|
145
|
public static final DerivationEventType SEXUAL_REPRODUCTION(){
|
146
|
return getTermByUuid(uuidSexualReproduction);
|
147
|
}
|
148
|
/**
|
149
|
* Event which groups units (specimen, observations, samples).<BR>
|
150
|
* This may be used if the deriving
|
151
|
* unit is a composition of multiple single units (e.g. a specimen is based on mulitple
|
152
|
* herbaria sheets, which may be the case according to the {@link NomenclaturalCode#ICNAFP}).<BR>
|
153
|
* Another important usage is the grouping of specimen to create a common {@link DescriptionBase description} of this specimen group.
|
154
|
* This is a standard part of the scientific workflow when one works on a certain taxonomic group and examines
|
155
|
* the specimen.<BR>
|
156
|
* Also it may be used if a larger specimen (e.g. a dinosaur skeleton) is composed of multiple {@link FieldUnit field units}.
|
157
|
* @return
|
158
|
*/
|
159
|
public static final DerivationEventType GROUPING(){
|
160
|
return getTermByUuid(uuidGrouping);
|
161
|
}
|
162
|
/**
|
163
|
* The extraction of 1 individual out of a sample including many individuals not necessarily all representing the
|
164
|
* same taxon. Example: individualization of 1 algae from of a water sample for further reasearch and determination)
|
165
|
*
|
166
|
* The extraction of 1 individual/organism out of any kind of sample (usually mixed samples with >1 taxa).
|
167
|
* The resulting individual may be used for a diversity of purposes like pure identification,
|
168
|
* image creation, further derivation, property assignment, ...)
|
169
|
* @return The indidivualization event
|
170
|
*/
|
171
|
public static final DerivationEventType INDIVIDUAL_SELECTION(){
|
172
|
return getTermByUuid(uuidIndividualSelection);
|
173
|
}
|
174
|
/**
|
175
|
* Extraction of 1 individual out of a sample and cultivation of this individual
|
176
|
* (usually resulting in sample of many similar individuals).
|
177
|
* The individual cultivation event includes an {@link #INDIVIDUAL_SELECTION()} event
|
178
|
* @return The individual cultivation event
|
179
|
*/
|
180
|
public static final DerivationEventType INDIVIDUAL_CULTIVATION(){
|
181
|
return getTermByUuid(uuidIndividualCultivation);
|
182
|
}
|
183
|
/**
|
184
|
* The preparation of e.g. a living culture into a preparation which can be stored in a collection
|
185
|
* (using certain preparation methods)
|
186
|
* @return
|
187
|
*/
|
188
|
public static final DerivationEventType PREPARATION(){
|
189
|
return getTermByUuid(uuidPreparation);
|
190
|
}
|
191
|
/**
|
192
|
* Ex-situ cultivation.
|
193
|
* @return
|
194
|
*/
|
195
|
public static final DerivationEventType CULTIVATION_EX_SITU(){
|
196
|
return getTermByUuid(uuidCultivationExSitu);
|
197
|
}
|
198
|
|
199
|
|
200
|
@Override
|
201
|
protected void setDefaultTerms(TermVocabulary<DerivationEventType> termVocabulary) {
|
202
|
termMap = new HashMap<UUID, DerivationEventType>();
|
203
|
for (DerivationEventType term : termVocabulary.getTerms()){
|
204
|
termMap.put(term.getUuid(), term);
|
205
|
}
|
206
|
}
|
207
|
|
208
|
}
|