Revision 892efc69
Added by Andreas Kohlbecker almost 14 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HybridRelationshipType.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.cdm.model.name; |
11 | 11 |
|
12 |
import java.util.HashMap; |
|
12 | 13 |
import java.util.List; |
13 | 14 |
import java.util.Map; |
14 | 15 |
import java.util.UUID; |
15 | 16 |
|
17 |
import eu.etaxonomy.cdm.model.common.AnnotationType; |
|
16 | 18 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
17 | 19 |
import eu.etaxonomy.cdm.model.common.Language; |
18 | 20 |
import eu.etaxonomy.cdm.model.common.RelationshipTermBase; |
... | ... | |
62 | 64 |
@SuppressWarnings("unused") |
63 | 65 |
private static final Logger logger = Logger.getLogger(HybridRelationshipType.class); |
64 | 66 |
|
65 |
private static HybridRelationshipType FIRST_PARENT; |
|
66 |
private static HybridRelationshipType SECOND_PARENT; |
|
67 |
private static HybridRelationshipType FEMALE_PARENT; |
|
68 |
private static HybridRelationshipType MALE_PARENT; |
|
67 |
protected static Map<UUID, HybridRelationshipType> termMap = null; |
|
69 | 68 |
|
70 | 69 |
private static final UUID uuidFirstParent = UUID.fromString("83ae9e56-18f2-46b6-b211-45cdee775bf3"); |
71 | 70 |
private static final UUID uuidSecondParent = UUID.fromString("0485fc3d-4755-4f53-8832-b82774484c43"); |
... | ... | |
99 | 98 |
super(term, label, labelAbbrev, false, false); |
100 | 99 |
} |
101 | 100 |
|
102 |
|
|
103 |
//********* METHODS **************************************/ |
|
104 |
|
|
101 |
|
|
102 |
//************************** METHODS ******************************** |
|
103 |
|
|
104 |
protected static HybridRelationshipType getTermByUuid(UUID uuid){ |
|
105 |
if (termMap == null){ |
|
106 |
return null; //better return null then initialize the termMap in an unwanted way |
|
107 |
} |
|
108 |
return (HybridRelationshipType)termMap.get(uuid); |
|
109 |
} |
|
110 |
|
|
105 | 111 |
/** |
106 | 112 |
* Returns the "first parent" hybrid relationship type. The elements of the |
107 | 113 |
* {@link BotanicalName botanical taxon name} used as "first parent" affect the |
... | ... | |
110 | 116 |
* @see #SECOND_PARENT() |
111 | 117 |
*/ |
112 | 118 |
public static final HybridRelationshipType FIRST_PARENT(){ |
113 |
return FIRST_PARENT;
|
|
119 |
return getTermByUuid(uuidFirstParent);
|
|
114 | 120 |
} |
115 | 121 |
|
116 | 122 |
/** |
... | ... | |
121 | 127 |
* @see #FIRST_PARENT() |
122 | 128 |
*/ |
123 | 129 |
public static final HybridRelationshipType SECOND_PARENT(){ |
124 |
return SECOND_PARENT;
|
|
130 |
return getTermByUuid(uuidSecondParent);
|
|
125 | 131 |
} |
126 | 132 |
|
127 | 133 |
/** |
... | ... | |
134 | 140 |
* @see #FIRST_PARENT() |
135 | 141 |
*/ |
136 | 142 |
public static final HybridRelationshipType FEMALE_PARENT(){ |
137 |
return FEMALE_PARENT;
|
|
143 |
return getTermByUuid(uuidFemaleParent);
|
|
138 | 144 |
} |
139 | 145 |
|
140 | 146 |
/** |
... | ... | |
147 | 153 |
* @see #SECOND_PARENT() |
148 | 154 |
*/ |
149 | 155 |
public static final HybridRelationshipType MALE_PARENT(){ |
150 |
return MALE_PARENT;
|
|
156 |
return getTermByUuid(uuidMaleParent);
|
|
151 | 157 |
} |
152 | 158 |
|
153 | 159 |
@Override |
154 | 160 |
protected void setDefaultTerms(TermVocabulary<HybridRelationshipType> termVocabulary) { |
155 |
HybridRelationshipType.FEMALE_PARENT = termVocabulary.findTermByUuid(HybridRelationshipType.uuidFemaleParent);
|
|
156 |
HybridRelationshipType.FIRST_PARENT = termVocabulary.findTermByUuid(HybridRelationshipType.uuidFirstParent);
|
|
157 |
HybridRelationshipType.MALE_PARENT = termVocabulary.findTermByUuid(HybridRelationshipType.uuidMaleParent);
|
|
158 |
HybridRelationshipType.SECOND_PARENT = termVocabulary.findTermByUuid(HybridRelationshipType.uuidSecondParent);
|
|
161 |
termMap = new HashMap<UUID, HybridRelationshipType>();
|
|
162 |
for (HybridRelationshipType term : termVocabulary.getTerms()){
|
|
163 |
termMap.put(term.getUuid(), (HybridRelationshipType)term);
|
|
164 |
}
|
|
159 | 165 |
} |
160 | 166 |
|
161 | 167 |
@Override |
Also available in: Unified diff
merging /branches/cdmlib/SPRINT-Chichorieae1/ to trunk