Project

General

Profile

Download (20.7 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.cdm.model.common;
12

    
13
import java.io.Serializable;
14
import java.util.Set;
15
import java.util.UUID;
16

    
17
import javax.lang.model.element.Modifier;
18
import javax.xml.bind.annotation.XmlEnum;
19
import javax.xml.bind.annotation.XmlEnumValue;
20

    
21
import org.apache.log4j.Logger;
22

    
23
import eu.etaxonomy.cdm.model.agent.Institution;
24
import eu.etaxonomy.cdm.model.description.CategoricalData;
25
import eu.etaxonomy.cdm.model.description.DescriptionBase;
26
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
27
import eu.etaxonomy.cdm.model.description.Distribution;
28
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
29
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
30
import eu.etaxonomy.cdm.model.description.StateData;
31
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
32
import eu.etaxonomy.cdm.model.description.TaxonDescription;
33
import eu.etaxonomy.cdm.model.description.TextData;
34
import eu.etaxonomy.cdm.model.location.NamedArea;
35
import eu.etaxonomy.cdm.model.location.Point;
36
import eu.etaxonomy.cdm.model.media.Rights;
37
import eu.etaxonomy.cdm.model.molecular.Amplification;
38
import eu.etaxonomy.cdm.model.name.HybridRelationship;
39
import eu.etaxonomy.cdm.model.name.NameRelationship;
40
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
41
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
42
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
43
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
44
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
45
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
46
import eu.etaxonomy.cdm.model.taxon.Synonym;
47
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
48
import eu.etaxonomy.cdm.model.taxon.Taxon;
49
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
50
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
51

    
52

    
53

    
54
/**
55
 * The term type is used to define the type of a {@link TermBase term}, may it be a vocabulary or a defined term.<BR>
56
 * It is used to define in which context a term may be used. From v3.3 on this replaces the semantic part of the subclasses
57
 * of the class {@link DefinedTermBase}. E.g. before v3.3 a term defining a sex and a term defining a stage had to different
58
 * classes Sex and Stage. With v3.3 they both became {@link DefinedTerm}s but with different types.<BR>
59
 * The type of a term and the type of its vocabulary should be the same. Before v3.3 it was not always possible to define
60
 * what the context of an (empty) vocabulary is.
61
 * In future versions this enum may also be expressed as a term, not an enum. For now the general policy is to
62
 * transform former classes to general classes with enums as their types.
63
 *
64
 * @author a.mueller
65
 * @created 11.06.2013
66
 */
67
@XmlEnum
68
public enum TermType implements IEnumTerm<TermType>, Serializable{
69

    
70
    //0
71
    /**
72
     * Unknown term type is the type to be used if no information is available about the type.
73
     * In the current model this type should never be used. However, it is a placeholder in case
74
     * we find an appropriate usage in future.
75
     */
76
    @XmlEnumValue("Unknown")
77
    Unknown(UUID.fromString("b2836c89-3b1d-4758-ba6d-568ef8d6fbc4"), "Unknown term type","UNK", null),
78

    
79
    //1
80
    /**
81
     * Term type to represent languages.
82
     */
83
    @XmlEnumValue("Language")
84
    Language(UUID.fromString("5591dc6c-ad1f-4abd-b6c2-4852ea8e46df"), "Language", "LA", null),
85

    
86
    //2
87
    /**
88
     * Term type for areas.
89
     */
90
    @XmlEnumValue("NamedArea")
91
    NamedArea(UUID.fromString("8c9a0bc9-da91-478d-bc8b-44b11565e160"), "Named area", "NA", null),
92

    
93
    //3
94
    /**
95
     * Term type for taxonomic ranks.
96
     */
97
    @XmlEnumValue("Rank")
98
    Rank(UUID.fromString("8d26b6a9-8a89-45d5-8358-49c3e4f30ade"), "Rank", "RK", null),
99

    
100
    //4
101
    /**
102
     * Term type for descriptive features.
103
     * @see DescriptionElementBase
104
     */
105
    @XmlEnumValue("Feature")
106
    Feature(UUID.fromString("b866a1d6-f962-4c23-bb8e-a3b66d33aedc"), "Feature", "FE", null),
107

    
108
    //5
109
    /**
110
     * Term type for annotation types.
111
     * @see Annotation
112
     */
113
    @XmlEnumValue("AnnotationType")
114
    AnnotationType(UUID.fromString("c3aabb64-6174-4152-95b1-7cec57e485cf"), "Annotation type", "ANT", null),
115

    
116
    //6
117
    /**
118
     * Term type for marker types.
119
     * @see Marker
120
     */
121
    @XmlEnumValue("MarkerType")
122
    MarkerType(UUID.fromString("d28a1bf8-95ed-483a-8f02-3515b14998e0"), "MarkerType", "MKT", null),
123

    
124
    //7
125
    /**
126
     * Term type for extension types.
127
     * @see Extension
128
     */
129
    @XmlEnumValue("ExtensionType")
130
    ExtensionType(UUID.fromString("12f5c03b-528a-4909-b81b-e525feabc97c"), "Extension type", "EXT", null),
131

    
132
    //8
133
    /**
134
     * Term type for derivation event types.
135
     * @see DerivationEvent
136
     */
137
    @XmlEnumValue("DerivationEventType")
138
    DerivationEventType(UUID.fromString("ba8e4b10-c792-42e7-a3f5-874708f10094"), "Derivation event type", "DET", null),
139

    
140
    //9
141
    /**
142
     * Term type for presence or absence status
143
     * @see Distribution
144
     */
145
    @XmlEnumValue("PresenceAbsenceTerm")
146
    PresenceAbsenceTerm(UUID.fromString("f6b80f88-c8c5-456b-bbd6-d63ecf35606e"), "Presence or absence term", "PAT", null),
147

    
148
    //10
149
    /**
150
     * Term type for the taxonomic nomenclatural status of a {@link TaxonNameBase taxon name}.
151
     * @see NomenclaturalStatus
152
     */
153
    @XmlEnumValue("NomenclaturalStatusType")
154
    NomenclaturalStatusType(UUID.fromString("c1acb71a-1d11-4305-8818-c2268d341742"), "Nomenclatural status type", "NST", null),
155

    
156
    //11
157
    /**
158
     * Term type for the type of a name relationship between {@link TaxonNameBase taxon names}
159
     * @see NameRelationship
160
     */
161
    @XmlEnumValue("NameRelationshipType")
162
    NameRelationshipType(UUID.fromString("acd8189a-23b9-4a53-8f48-1d2aa270a6ba"), "Name relationship type", "NRT"),
163

    
164
    //12
165
    /**
166
     * Term type for the type of a hybrid relationship between {@link TaxonNameBase taxon names}
167
     * @see HybridRelationship
168
     */
169
    @XmlEnumValue("HybridRelationshipType")
170
    HybridRelationshipType(UUID.fromString("aade9e61-eaa1-40fe-9eb1-40f9e8ae1114"), "Hybrid relationship type", "HRT"),
171

    
172
    //13
173
    /**
174
     * Term type for the type of a synonym relationship between 2 {@link TaxonBase taxa}
175
     * @see SynonymRelationship
176
     * @see Synonym
177
     * @see TaxonBase
178
     */
179
    @XmlEnumValue("SynonymRelationshipType")
180
    SynonymRelationshipType(UUID.fromString("1eb4fee0-7716-4531-a9ed-a95327f1f4bb"), "Synonym relationship type", "SRT"),
181

    
182
    //14
183
    /**
184
     * Term type for the type of a taxonomic concept relationship between
185
     * 2 {@link Taxon accepted taxa}  with different secundum referece.
186
     * @see TaxonRelationship
187
     * @see Taxon
188
     */
189
    @XmlEnumValue("TaxonRelationshipType")
190
    TaxonRelationshipType(UUID.fromString("2d4b281c-142e-42c5-8eb5-1747592b54d8"), "Taxon relationship type", "TRT"),
191

    
192
    //15
193
    /**
194
     * Term type for the type of a typification of a taxonomic name
195
     * with a rank higher then species.
196
     * @see eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus
197
     * @see NameTypeDesignation
198
     */
199
    @XmlEnumValue("NameTypeDesignationStatus")
200
    NameTypeDesignationStatus(UUID.fromString("d3860be6-8a08-4fff-984a-6ee8b42937c9"), "Name type designation status", "NTD"),
201

    
202
    //16
203
    /**
204
     * Term type for the type of a typification of a taxonomic name
205
     * with a rank equal or lower then species.
206
     * @see {@link eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus}
207
     * @see SpecimenTypeDesignation
208
     */
209
    @XmlEnumValue("SpecimenTypeDesignationStatus")
210
    SpecimenTypeDesignationStatus(UUID.fromString("4014d7d4-f2dd-4328-8015-357a1a77c1ed"), "Specimen type designation status", "STD"),
211

    
212
    //17
213
    /**
214
     * Term type for an institution type.
215
     * @see Institution
216
     */
217
    @XmlEnumValue("InstitutionType")
218
    InstitutionType(UUID.fromString("09d78265-18b5-4352-b154-d2f39e84d3f3"), "Institution type", "IT", null),
219

    
220
    //18
221
    /**
222
     * Term type for a named area type.
223
     * @see NamedArea
224
     * @see eu.etaxonomy.cdm.model.location.NamedAreaType
225
     */
226
    @XmlEnumValue("NamedAreaType")
227
    NamedAreaType(UUID.fromString("6a9aba35-6272-4373-8386-000cf95b729e"), "Named area type", "NAT", null),
228

    
229
    //19
230
    /**
231
     * Term type for a named area level.
232
     * @see NamedArea
233
     * @see eu.etaxonomy.cdm.model.location.NamedAreaLevel
234
     */
235
    @XmlEnumValue("NamedAreaLevel")
236
    NamedAreaLevel(UUID.fromString("62c16c74-dc79-4970-9031-bb1504be46f5"), "Named area level", "NAL", null),
237

    
238
    //20
239
    /**
240
     * Term type for rights.
241
     * @see Rights
242
     */
243
    @XmlEnumValue("RightsType")
244
    RightsType(UUID.fromString("80e06b04-8d0d-4bd5-bcd6-d35f73c24d55"), "Rights type", "RT", null),
245

    
246
    //21
247
    /**
248
     * Term type for a measurement unit.
249
     * @see MeasurementUnit
250
     */
251
    @XmlEnumValue("MeasurementUnit")
252
    MeasurementUnit(UUID.fromString("f9e6c44f-f0d6-428b-9bc0-bb00a6514883"), "Measurement unit", "MU", null),
253

    
254
    //22
255
    /**
256
     * Term type for a statistical measure.
257
     * @see eu.etaxonomy.cdm.model.description.StatisticalMeasure
258
     * @see StatisticalMeasurementValue
259
     */
260
    @XmlEnumValue("StatisticalMeasure")
261
    StatisticalMeasure(UUID.fromString("a22d19cd-a342-4af2-b156-d688a7aa8a6b"), "Statistical measure", "SM", null),
262

    
263
    //23
264
    @XmlEnumValue("MaterialOrMethod")
265
    MaterialOrMethod(UUID.fromString("285a1406-a606-46b9-b0a4-717748296e50"), "Material or Method", "MOM"),
266

    
267
    //23a
268
    @XmlEnumValue("Material")
269
    Material(UUID.fromString("58499bc1-9808-4e03-861c-4325ca889515"), "Material", "MAT", MaterialOrMethod),
270

    
271
    //23b
272
    @XmlEnumValue("Method")
273
    Method(UUID.fromString("527fc141-7fdf-43c1-9d46-20be13c2590c"), "Method", "MET", MaterialOrMethod),
274

    
275

    
276
//	//23c TODO required??
277
//	@XmlEnumValue("PreservationMethod")   --> Method
278
//	PreservationMethod(UUID.fromString("9cadbee4-22b5-40f5-bb37-e4f5340d246e"), "Preservation method", "PRM", MaterialOrMethod),
279
//
280
//	//23d TODO required??  --> Material
281
//	@XmlEnumValue("PreservationMedium")
282
//	PreservationMedium(UUID.fromString("c6269a06-6954-4838-a7a7-7f94ba372f3d"), "Preservation medium", "PME", MaterialOrMethod),
283

    
284

    
285
    //24
286
    /**
287
     * This type represents possible modulations for the validity of
288
     * information pieces ({@link DescriptionElementBase} description elements).
289
     * It can cover probability ("perhaps"), frequency ("often") intensity ("very"),
290
     * timing ("spring") and other domains. Its instances can be grouped to build
291
     * different controlled {@link TermVocabulary term vocabularies}.
292
     * <P>
293
     * This class corresponds to GeneralModifierNLDType according to
294
     * the SDD schema.
295
     * This class is a generalization of {@link #Scope} and {@link #DeterminationModifier}
296
     *
297
     * @see DescriptionElementBase#getModifiers()
298
     * @see StateData#getModifiers()
299
     */
300
    @XmlEnumValue("Modifier")
301
    Modifier(UUID.fromString("97c4db67-ccf5-40bf-9fb8-83fb7446a364"), "Modifier", "MO", null),
302

    
303
    //25
304
    /**
305
     * The type representing restrictions for the validity of
306
     * {@link TaxonDescription taxon descriptions} and others.
307
     * This could include not only Stage (life stage) and Sex
308
     * but also for instance particular organism parts or seasons.<BR>
309
     * Scope is a specialization of {@link #Modifier} and a generalization of
310
     * {@link #Sex} and {@link #Stage}
311
     *
312
     * @see Modifier
313
     * @see DescriptionElementBase
314
     * @see TaxonDescription
315
     * @see TaxonDescription#getScopes()
316
     */
317
    @XmlEnumValue("Scope")
318
    Scope(UUID.fromString("8862b66e-9059-4ea4-885e-47a373357075"), "Scope", "SCO", Modifier),
319

    
320
    //26
321
    /** The stage type represents the restriction (scope) concerning the life stage for
322
     * the applicability of {@link TaxonDescription taxon descriptions}. The life stage of a
323
     * {@link SpecimenOrObservationBase specimen or observation}
324
     * does not belong to a {@link SpecimenDescription specimen description} but is an attribute of
325
     * the specimen itself.<BR>
326
     *
327
     * Stage is a specialization of {@link #Scope}.
328
     */
329
    @XmlEnumValue("Stage")
330
    Stage(UUID.fromString("cf411ef0-8eee-4461-99e9-c03f4f0a1656"), "Stage", "STG", Scope),
331

    
332
    //26a
333
    /** The kind-of-unit type represents the restriction (scope) concerning the part(s) of an
334
     * organism or the class of materials represented by a specimen or observation or described
335
     * by a {@link DescriptionBase taxon or specimen description}.<BR>
336
     * In a {@link DescriptionBase description} it can be used as a {@link #Modifier} or
337
     * a {@link #Scope} and therefore it is a specialization of {@link #Scope}.<BR>
338
     * The kind-of-unit of a {@link SpecimenOrObservationBase specimen or observation}
339
     * should be added as an {@link SpecimenOrObservationBase#getKindOfUnit() kindOfUnit} attribute
340
     * if the specimen is only a part of an organism and this part is described by the part-of-unit.
341
     * If only a part of a specimen is described in a {@link SpecimenDescription specimen description}
342
     * the kind-of-unit should be used as a {@link DescriptionBase description} scope
343
     * (not yet implemented for specimen descriptions) or as a modifier in a
344
     * {@link DescriptionElementBase description item}.<BR><BR>
345
     *
346
     * Value examples are: fruits, seeds, tissue, gDNA, leaves, ... <BR>
347
     *
348
     * KindOfUnit is a Specialization of {@link #Scope}.
349
     *
350
     * @see SpecimenOrObservationBase#getKindOfUnit()
351
     * @see TaxonDescription#getScopes()
352
     * @see DescriptionElementBase#getModifiers()
353
     * @see StateData#getModifiers()
354
     */
355
    @XmlEnumValue("KindOfUnit")
356
    KindOfUnit(UUID.fromString("e3edf086-ff7b-4e58-ab1c-d509352fe5f4"), "Kind of Unit", "KOU", Scope),
357

    
358

    
359
    //27
360
    /**
361
     * The type represents the restriction concerning the sex for
362
     * the applicability of {@link TaxonDescription taxon descriptions} or others. The sex of a
363
     * {@link SpecimenOrObservationBase specimen or observation}
364
     * does not belong to a {@link SpecimenDescription specimen description} but is an attribute of
365
     * the specimen itself.<BR>
366
     *
367
     * Sex is a specialization of {@link #Scope}.
368
     */
369
    @XmlEnumValue("Sex")
370
    Sex(UUID.fromString("4046f91f-063b-4b84-b34a-6245c2abc06f"), "Sex", "SEX", Scope),
371

    
372
    //28
373
    /**
374
     * Term type for a reference system of a geographic information.
375
     * @see Point
376
     * @see Point#getReferenceSystem()
377
     */
378
    @XmlEnumValue("ReferenceSystem")
379
    ReferenceSystem(UUID.fromString("b8cfa986-ef90-465e-9609-1dadae2a0f5b"), "Reference system", "RS", null),
380

    
381
    //29
382
    /**
383
     * Term type for a term representing a state for {@link CategoricalData categorical data}
384
     * @see CategoricalData#getStateData()
385
     * @see StateData#getState()
386
     */
387
    @XmlEnumValue("State")
388
    State(UUID.fromString("5e5b8b60-7300-440a-8706-72fbf31a594f"), "State", "STA", null),
389

    
390
    //30
391
    /**
392
     * Term type representing a natural language term.
393
     */
394
    @XmlEnumValue("NaturalLanguageTerm")
395
    NaturalLanguageTerm(UUID.fromString("9a42ac4e-c175-4633-8b31-74ba8203566a"), "Natural language term", "NLT", null),
396

    
397

    
398
    //31
399
    /**
400
     * Term type for a text format.
401
     * @see TextData
402
     */
403
    @XmlEnumValue("TextFormat")
404
    TextFormat(UUID.fromString("d26cfdb4-baeb-43d0-a51b-a3428d838790"), "Text format", "TF", null),
405

    
406
    //32
407
    /**
408
     * TODO
409
     *
410
     * Determination modifier is a specialization of {@link #Modifier}.
411
     */
412
    @XmlEnumValue("DeterminationModifier")
413
    DeterminationModifier(UUID.fromString("ce910516-bc5d-4ac5-be4d-f3c14c27dd85"), "Determination modifier", "DMO", Modifier),
414

    
415
    //33
416
    /**
417
     * A marker is a region on a DNA which is addressed in an {@link Amplification amplification process}.
418
     * It is very similar to a locus, a term which is often used as a synonym. However, a locus is correctly
419
     * defining one concrete place on a given DNA and therefore is more specific. As this specific information
420
     * is usually not available the marker information is provided instead.
421
     * Sometimes marker information includes multiple markers. To handle this it was decided that for such
422
     * combined markers we need to create a new "parent" marker which includes the single markers as "partOf" marker.
423
     * However, this works only if you have a distinct marker hierarchy, so futuere
424
     * @see Amplification
425
     * @see Amplification#getMarker()
426
     * @see Sequencing
427
     * @see Sequencing#getMarker()
428
     */
429
    @XmlEnumValue("DnaMarker")
430
    DnaMarker(UUID.fromString("7fdddb4f-b0ec-4ce0-bc28-dc94e30e8252"), "DNA Marker", "DMA", null),
431
    
432
    
433
    /**
434
     * An Identifier Type which can be used as a type in {@link Identifier#type} . It may often be a global unique identifier such as DOI, LSID, Barcode ....
435
     * But also local identifier types such Sample Designation, Catalog Number, 
436
     * Accession Number, ... are allowed.
437
     * {@link Identifier#type}
438
     */
439
    @XmlEnumValue("IdentifierType")
440
    IdentifierType(UUID.fromString("d24eda99-0716-467f-aa1e-4c0f2b6c3922"), "Identifier", "IDE", null),
441
    ;
442

    
443
    @SuppressWarnings("unused")
444
    private static final Logger logger = Logger.getLogger(TermType.class);
445

    
446
    private TermType(UUID uuid, String defaultString, String key){
447
        this(uuid, defaultString, key, null);
448
    }
449

    
450
    private TermType(UUID uuid, String defaultString, String key, TermType parent){
451
        delegateVocTerm = EnumeratedTermVoc.addTerm(getClass(), this, uuid, defaultString, key, parent);
452
    }
453

    
454

    
455
// *************************** DELEGATE **************************************/
456

    
457
    private static EnumeratedTermVoc<TermType> delegateVoc;
458
    private IEnumTerm<TermType> delegateVocTerm;
459

    
460
    static {
461
        delegateVoc = EnumeratedTermVoc.getVoc(TermType.class);
462
    }
463

    
464
    @Override
465
    public String getKey(){return delegateVocTerm.getKey();}
466

    
467
    @Override
468
    public String getMessage(){return delegateVocTerm.getMessage();}
469

    
470
    @Override
471
    public String getMessage(Language language){return delegateVocTerm.getMessage(language);}
472

    
473
    @Override
474
    public UUID getUuid() {return delegateVocTerm.getUuid();}
475

    
476
    @Override
477
    public TermType getKindOf() {return delegateVocTerm.getKindOf();}
478

    
479
    @Override
480
    public Set<TermType> getGeneralizationOf() {return delegateVocTerm.getGeneralizationOf();}
481

    
482
    @Override
483
    public boolean isKindOf(TermType ancestor) {return delegateVocTerm.isKindOf(ancestor);	}
484

    
485
    @Override
486
    public Set<TermType> getGeneralizationOf(boolean recursive) {return delegateVocTerm.getGeneralizationOf(recursive);}
487

    
488
    public static TermType getByKey(String key){return delegateVoc.getByKey(key);}
489
    public static TermType getByUuid(UUID uuid) {return delegateVoc.getByUuid(uuid);}
490

    
491
    /**
492
     * Returns a defined term base object corresponding to this term type object
493
     *
494
     * @return a defined term base object
495
     */
496
    public DefinedTermBase getEmptyDefinedTermBase() {
497
        switch(this) {
498
            case DeterminationModifier:
499
            case Modifier:
500
            case Scope:
501
            case Sex:
502
            case Stage:
503
            case KindOfUnit:
504
            case PresenceAbsenceTerm:
505
            case IdentifierType:
506
            case DnaMarker:
507
                return DefinedTerm.NewInstance(this, null, "Untitled", null);
508
            case Feature:
509
                return eu.etaxonomy.cdm.model.description.Feature.NewInstance(null, "Untitled", null);
510
            case State:
511
                return eu.etaxonomy.cdm.model.description.State.NewInstance(null, "Untitled", null);
512
            case MarkerType:
513
                return eu.etaxonomy.cdm.model.common.MarkerType.NewInstance(null, "Untitled", null);
514
            case ExtensionType:
515
                return eu.etaxonomy.cdm.model.common.ExtensionType.NewInstance(null, "Untitled", null);
516
            case NamedArea:
517
                return eu.etaxonomy.cdm.model.location.NamedArea.NewInstance(null, "Untitled", null);
518
            case NamedAreaLevel:
519
                return eu.etaxonomy.cdm.model.location.NamedAreaLevel.NewInstance(null, "Untitled", null);
520
            case NamedAreaType:
521
                return eu.etaxonomy.cdm.model.location.NamedAreaType.NewInstance(null, "Untitled", null);
522
            default:
523
                return null;
524
        }
525
    }
526

    
527

    
528
}
(60-60/69)