Revision 892efc69
Added by Andreas Kohlbecker almost 14 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/occurrence/DerivationEventType.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.cdm.model.occurrence; |
11 | 11 |
|
12 |
import java.util.HashMap; |
|
13 |
import java.util.Map; |
|
12 | 14 |
import java.util.UUID; |
13 | 15 |
|
14 | 16 |
import javax.persistence.Entity; |
... | ... | |
21 | 23 |
import org.hibernate.envers.Audited; |
22 | 24 |
import org.hibernate.search.annotations.Indexed; |
23 | 25 |
|
26 |
import eu.etaxonomy.cdm.model.common.AnnotationType; |
|
24 | 27 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
28 |
import eu.etaxonomy.cdm.model.common.ExtensionType; |
|
25 | 29 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
26 | 30 |
|
27 | 31 |
@XmlAccessorType(XmlAccessType.FIELD) |
... | ... | |
44 | 48 |
private static final UUID uuidAccessioning = UUID.fromString("3c7c0929-0528-493e-9e5f-15e0d9585fa1"); |
45 | 49 |
private static final UUID uuidSexualReproduction = UUID.fromString("aa79baac-165d-47ad-9e80-52a03776d8ae"); |
46 | 50 |
|
47 |
private static DerivationEventType SEXUAL_REPRODUCTION; |
|
48 |
|
|
49 |
private static DerivationEventType ACCESSIONING; |
|
50 |
|
|
51 |
private static DerivationEventType DUPLICATE_SEGREGATEION; |
|
52 |
|
|
53 |
private static DerivationEventType VEGETATIVE_PROPAGATION; |
|
54 |
|
|
55 |
private static DerivationEventType DNA_EXTRACTION; |
|
56 |
|
|
57 |
private static DerivationEventType TISSUE_SAMPLING; |
|
58 |
|
|
59 |
private static DerivationEventType GATHERING_IN_SITU; |
|
60 |
|
|
61 |
private static DerivationEventType DUPLICATE; |
|
62 |
|
|
51 |
protected static Map<UUID, DerivationEventType> termMap = null; |
|
63 | 52 |
|
53 |
|
|
64 | 54 |
|
65 | 55 |
/** |
66 | 56 |
* Factory method |
... | ... | |
84 | 74 |
*/ |
85 | 75 |
public DerivationEventType() { |
86 | 76 |
} |
87 |
|
|
77 |
|
|
88 | 78 |
|
89 | 79 |
/** |
90 | 80 |
* Constructor |
... | ... | |
93 | 83 |
super(term, label, labelAbbrev); |
94 | 84 |
} |
95 | 85 |
|
86 |
|
|
87 |
//************************** METHODS ******************************** |
|
88 |
|
|
89 |
protected static DerivationEventType getTermByUuid(UUID uuid){ |
|
90 |
if (termMap == null){ |
|
91 |
return null; //better return null then initialize the termMap in an unwanted way |
|
92 |
} |
|
93 |
return (DerivationEventType)termMap.get(uuid); |
|
94 |
} |
|
95 |
|
|
96 | 96 |
public static final DerivationEventType DUPLICATE(){ |
97 |
return DUPLICATE;
|
|
97 |
return getTermByUuid(uuidDuplicate);
|
|
98 | 98 |
} |
99 | 99 |
public static final DerivationEventType GATHERING_IN_SITU(){ |
100 |
return GATHERING_IN_SITU;
|
|
100 |
return getTermByUuid(uuidGatheringInSitu);
|
|
101 | 101 |
} |
102 | 102 |
public static final DerivationEventType TISSUE_SAMPLING(){ |
103 |
return TISSUE_SAMPLING;
|
|
103 |
return getTermByUuid(uuidTissueSampling);
|
|
104 | 104 |
} |
105 | 105 |
public static final DerivationEventType DNA_EXTRACTION(){ |
106 |
return DNA_EXTRACTION;
|
|
106 |
return getTermByUuid(uuidDnaExtraction);
|
|
107 | 107 |
} |
108 | 108 |
public static final DerivationEventType VEGETATIVE_PROPAGATION(){ |
109 |
return VEGETATIVE_PROPAGATION;
|
|
109 |
return getTermByUuid(uuidVegetativPropagation);
|
|
110 | 110 |
} |
111 | 111 |
public static final DerivationEventType DUPLICATE_SEGREGATEION(){ |
112 |
return DUPLICATE_SEGREGATEION;
|
|
112 |
return getTermByUuid(uuidDuplicateSegregation);
|
|
113 | 113 |
} |
114 | 114 |
public static final DerivationEventType ACCESSIONING(){ |
115 |
return ACCESSIONING;
|
|
115 |
return getTermByUuid(uuidAccessioning);
|
|
116 | 116 |
} |
117 | 117 |
public static final DerivationEventType SEXUAL_REPRODUCTION(){ |
118 |
return SEXUAL_REPRODUCTION;
|
|
118 |
return getTermByUuid(uuidSexualReproduction);
|
|
119 | 119 |
} |
120 | 120 |
|
121 | 121 |
@Override |
122 | 122 |
protected void setDefaultTerms(TermVocabulary<DerivationEventType> termVocabulary) { |
123 |
DerivationEventType.ACCESSIONING = termVocabulary.findTermByUuid(DerivationEventType.uuidAccessioning); |
|
124 |
DerivationEventType.DNA_EXTRACTION = termVocabulary.findTermByUuid(DerivationEventType.uuidDnaExtraction); |
|
125 |
DerivationEventType.DUPLICATE = termVocabulary.findTermByUuid(DerivationEventType.uuidDuplicate); |
|
126 |
DerivationEventType.DUPLICATE_SEGREGATEION = termVocabulary.findTermByUuid(DerivationEventType.uuidDuplicateSegregation); |
|
127 |
DerivationEventType.GATHERING_IN_SITU = termVocabulary.findTermByUuid(DerivationEventType.uuidGatheringInSitu); |
|
128 |
DerivationEventType.SEXUAL_REPRODUCTION = termVocabulary.findTermByUuid(DerivationEventType.uuidSexualReproduction); |
|
129 |
DerivationEventType.TISSUE_SAMPLING = termVocabulary.findTermByUuid(DerivationEventType.uuidTissueSampling); |
|
130 |
DerivationEventType.VEGETATIVE_PROPAGATION = termVocabulary.findTermByUuid(DerivationEventType.uuidVegetativPropagation); |
|
123 |
termMap = new HashMap<UUID, DerivationEventType>(); |
|
124 |
for (DerivationEventType term : termVocabulary.getTerms()){ |
|
125 |
termMap.put(term.getUuid(), (DerivationEventType)term); |
|
126 |
} |
|
131 | 127 |
} |
132 | 128 |
|
133 | 129 |
} |
Also available in: Unified diff
merging /branches/cdmlib/SPRINT-Chichorieae1/ to trunk