1 |
62d28a57
|
Katja Luther
|
/**
|
2 |
|
|
* Copyright (C) 2020 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.persistence.dto;
|
10 |
|
|
|
11 |
5edd1fbf
|
Katja Luther
|
import java.net.URI;
|
12 |
|
|
import java.util.ArrayList;
|
13 |
|
|
import java.util.EnumSet;
|
14 |
|
|
import java.util.HashMap;
|
15 |
|
|
import java.util.HashSet;
|
16 |
|
|
import java.util.List;
|
17 |
|
|
import java.util.Map;
|
18 |
62d28a57
|
Katja Luther
|
import java.util.Set;
|
19 |
|
|
import java.util.UUID;
|
20 |
|
|
|
21 |
5edd1fbf
|
Katja Luther
|
import eu.etaxonomy.cdm.model.common.CdmClass;
|
22 |
62d28a57
|
Katja Luther
|
import eu.etaxonomy.cdm.model.description.Feature;
|
23 |
4d68581f
|
Katja Luther
|
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
|
24 |
|
|
import eu.etaxonomy.cdm.model.description.State;
|
25 |
|
|
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
|
26 |
5edd1fbf
|
Katja Luther
|
import eu.etaxonomy.cdm.model.media.Media;
|
27 |
4d68581f
|
Katja Luther
|
import eu.etaxonomy.cdm.model.term.DefinedTerm;
|
28 |
62d28a57
|
Katja Luther
|
import eu.etaxonomy.cdm.model.term.Representation;
|
29 |
|
|
import eu.etaxonomy.cdm.model.term.TermType;
|
30 |
4d68581f
|
Katja Luther
|
import eu.etaxonomy.cdm.model.term.TermVocabulary;
|
31 |
62d28a57
|
Katja Luther
|
|
32 |
|
|
/**
|
33 |
|
|
* @author k.luther
|
34 |
|
|
* @since Jun 11, 2020
|
35 |
|
|
*/
|
36 |
|
|
public class FeatureDto extends TermDto {
|
37 |
|
|
|
38 |
|
|
private static final long serialVersionUID = 5123011385890020838L;
|
39 |
|
|
|
40 |
|
|
boolean isAvailableForTaxon = true;
|
41 |
|
|
boolean isAvailableForTaxonName = true;
|
42 |
|
|
boolean isAvailableForOccurrence = true;
|
43 |
4d68581f
|
Katja Luther
|
boolean isSupportsCategoricalData = false;
|
44 |
|
|
boolean isSupportsQuantitativeData = false;
|
45 |
|
|
|
46 |
|
|
Set<TermDto> recommendedMeasurementUnits = new HashSet<>();
|
47 |
|
|
Set<TermDto> recommendedStatisticalMeasures = new HashSet<>();
|
48 |
|
|
Set<TermVocabularyDto> supportedCategoricalEnumerations = new HashSet<>();
|
49 |
|
|
Set<TermVocabularyDto> recommendedModifierEnumeration = new HashSet<>();
|
50 |
62d28a57
|
Katja Luther
|
|
51 |
|
|
public FeatureDto(UUID uuid, Set<Representation> representations, UUID partOfUuid, UUID kindOfUuid,
|
52 |
4d68581f
|
Katja Luther
|
UUID vocabularyUuid, Integer orderIndex, String idInVocabulary, Set<Representation> vocRepresentations, boolean isAvailableForTaxon,
|
53 |
|
|
boolean isAvailableForTaxonName, boolean isAvailableForOccurrence, String titleCache, boolean isSupportsCategoricalData, boolean isSupportsQuantitativeData,
|
54 |
|
|
Set<TermVocabularyDto> supportedCategoricalEnumerations, Set<TermVocabularyDto> recommendedModifierEnumeration, Set<TermDto> recommendedMeasurementUnits, Set<TermDto> recommendedStatisticalMeasures){
|
55 |
62d28a57
|
Katja Luther
|
super(uuid, representations, TermType.Feature, partOfUuid, kindOfUuid,
|
56 |
3037370e
|
Katja Luther
|
vocabularyUuid, orderIndex, idInVocabulary, vocRepresentations, titleCache);
|
57 |
62d28a57
|
Katja Luther
|
this.isAvailableForOccurrence = isAvailableForOccurrence;
|
58 |
|
|
this.isAvailableForTaxon = isAvailableForTaxon;
|
59 |
|
|
this.isAvailableForTaxonName = isAvailableForTaxonName;
|
60 |
|
|
|
61 |
4d68581f
|
Katja Luther
|
this.isSupportsCategoricalData = isSupportsCategoricalData;
|
62 |
|
|
this.isSupportsQuantitativeData = isSupportsQuantitativeData;
|
63 |
|
|
|
64 |
|
|
this.recommendedMeasurementUnits = recommendedMeasurementUnits;
|
65 |
|
|
this.recommendedStatisticalMeasures = recommendedStatisticalMeasures;
|
66 |
|
|
this.supportedCategoricalEnumerations = supportedCategoricalEnumerations;
|
67 |
|
|
this.recommendedModifierEnumeration = recommendedModifierEnumeration;
|
68 |
|
|
|
69 |
62d28a57
|
Katja Luther
|
}
|
70 |
|
|
|
71 |
|
|
static public FeatureDto fromTerm(Feature term) {
|
72 |
|
|
FeatureDto result = (FeatureDto) fromTerm(term, null, false);
|
73 |
|
|
result.isAvailableForOccurrence = term.isAvailableForOccurrence();
|
74 |
|
|
result.isAvailableForTaxon = term.isAvailableForTaxon();
|
75 |
|
|
result.isAvailableForTaxonName = term.isAvailableForTaxonName();
|
76 |
4d68581f
|
Katja Luther
|
result.isSupportsCategoricalData = term.isSupportsCategoricalData();
|
77 |
|
|
result.isSupportsQuantitativeData = term.isSupportsQuantitativeData();
|
78 |
|
|
if (term.getRecommendedMeasurementUnits() != null && !term.getRecommendedMeasurementUnits().isEmpty()){
|
79 |
|
|
result.recommendedMeasurementUnits = new HashSet<>();
|
80 |
|
|
}
|
81 |
|
|
for (MeasurementUnit unit: term.getRecommendedMeasurementUnits()){
|
82 |
|
|
result.recommendedMeasurementUnits.add(TermDto.fromTerm(unit));
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
if (term.getRecommendedStatisticalMeasures() != null && !term.getRecommendedStatisticalMeasures().isEmpty()){
|
86 |
|
|
result.recommendedStatisticalMeasures = new HashSet<>();
|
87 |
|
|
}
|
88 |
|
|
for (StatisticalMeasure unit: term.getRecommendedStatisticalMeasures()){
|
89 |
|
|
result.recommendedStatisticalMeasures.add(TermDto.fromTerm(unit));
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
if (term.getSupportedCategoricalEnumerations() != null && !term.getSupportedCategoricalEnumerations().isEmpty()){
|
93 |
|
|
result.supportedCategoricalEnumerations = new HashSet<>();
|
94 |
|
|
}
|
95 |
|
|
for (TermVocabulary<State> voc: term.getSupportedCategoricalEnumerations()){
|
96 |
|
|
result.supportedCategoricalEnumerations.add(new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType(), voc.getTitleCache(), voc.isAllowDuplicates(), voc.isOrderRelevant(), voc.isFlat()));
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
if (term.getRecommendedModifierEnumeration() != null && !term.getRecommendedModifierEnumeration().isEmpty()){
|
100 |
|
|
result.recommendedModifierEnumeration = new HashSet<>();
|
101 |
|
|
}
|
102 |
|
|
for (TermVocabulary<DefinedTerm> voc: term.getRecommendedModifierEnumeration()){
|
103 |
|
|
result.recommendedModifierEnumeration.add(new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType(), voc.getTitleCache(), voc.isAllowDuplicates(), voc.isOrderRelevant(), voc.isFlat()));
|
104 |
|
|
}
|
105 |
62d28a57
|
Katja Luther
|
return result;
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
/**
|
109 |
|
|
* @return the isAvailableForTaxon
|
110 |
|
|
*/
|
111 |
|
|
public boolean isAvailableForTaxon() {
|
112 |
|
|
return isAvailableForTaxon;
|
113 |
|
|
}
|
114 |
|
|
|
115 |
|
|
/**
|
116 |
|
|
* @param isAvailableForTaxon the isAvailableForTaxon to set
|
117 |
|
|
*/
|
118 |
|
|
public void setAvailableForTaxon(boolean isAvailableForTaxon) {
|
119 |
|
|
this.isAvailableForTaxon = isAvailableForTaxon;
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
/**
|
123 |
|
|
* @return the isAvailableForTaxonName
|
124 |
|
|
*/
|
125 |
|
|
public boolean isAvailableForTaxonName() {
|
126 |
|
|
return isAvailableForTaxonName;
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
/**
|
130 |
|
|
* @param isAvailableForTaxonName the isAvailableForTaxonName to set
|
131 |
|
|
*/
|
132 |
|
|
public void setAvailableForTaxonName(boolean isAvailableForTaxonName) {
|
133 |
|
|
this.isAvailableForTaxonName = isAvailableForTaxonName;
|
134 |
|
|
}
|
135 |
|
|
|
136 |
|
|
/**
|
137 |
|
|
* @return the isAvailableForOccurrence
|
138 |
|
|
*/
|
139 |
|
|
public boolean isAvailableForOccurrence() {
|
140 |
|
|
return isAvailableForOccurrence;
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
/**
|
144 |
|
|
* @param isAvailableForOccurrence the isAvailableForOccurrence to set
|
145 |
|
|
*/
|
146 |
|
|
public void setAvailableForOccurrence(boolean isAvailableForOccurrence) {
|
147 |
|
|
this.isAvailableForOccurrence = isAvailableForOccurrence;
|
148 |
|
|
}
|
149 |
|
|
|
150 |
4d68581f
|
Katja Luther
|
/**
|
151 |
|
|
* @return the isSupportsCategoricalData
|
152 |
|
|
*/
|
153 |
|
|
public boolean isSupportsCategoricalData() {
|
154 |
|
|
return isSupportsCategoricalData;
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
/**
|
158 |
|
|
* @param isSupportsCategoricalData the isSupportsCategoricalData to set
|
159 |
|
|
*/
|
160 |
|
|
public void setSupportsCategoricalData(boolean isSupportsCategoricalData) {
|
161 |
|
|
this.isSupportsCategoricalData = isSupportsCategoricalData;
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
/**
|
165 |
|
|
* @return the isSupportsQuantitativeData
|
166 |
|
|
*/
|
167 |
|
|
public boolean isSupportsQuantitativeData() {
|
168 |
|
|
return isSupportsQuantitativeData;
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
/**
|
172 |
|
|
* @param isSupportsQuantitativeData the isSupportsQuantitativeData to set
|
173 |
|
|
*/
|
174 |
|
|
public void setSupportsQuantitativeData(boolean isSupportsQuantitativeData) {
|
175 |
|
|
this.isSupportsQuantitativeData = isSupportsQuantitativeData;
|
176 |
|
|
}
|
177 |
|
|
|
178 |
|
|
/**
|
179 |
|
|
* @return the recommendedMeasurementUnits
|
180 |
|
|
*/
|
181 |
|
|
public Set<TermDto> getRecommendedMeasurementUnits() {
|
182 |
|
|
return recommendedMeasurementUnits;
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
/**
|
186 |
|
|
* @param recommendedMeasurementUnits the recommendedMeasurementUnits to set
|
187 |
|
|
*/
|
188 |
|
|
public void setRecommendedMeasurementUnits(Set<TermDto> recommendedMeasurementUnits) {
|
189 |
|
|
this.recommendedMeasurementUnits = recommendedMeasurementUnits;
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
/**
|
193 |
|
|
* @return the recommendedStatisticalMeasures
|
194 |
|
|
*/
|
195 |
|
|
public Set<TermDto> getRecommendedStatisticalMeasures() {
|
196 |
|
|
return recommendedStatisticalMeasures;
|
197 |
|
|
}
|
198 |
|
|
|
199 |
|
|
/**
|
200 |
|
|
* @param recommendedStatisticalMeasures the recommendedStatisticalMeasures to set
|
201 |
|
|
*/
|
202 |
|
|
public void setRecommendedStatisticalMeasures(Set<TermDto> recommendedStatisticalMeasures) {
|
203 |
|
|
this.recommendedStatisticalMeasures = recommendedStatisticalMeasures;
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
/**
|
207 |
|
|
* @return the supportedCategoricalEnumerations
|
208 |
|
|
*/
|
209 |
|
|
public Set<TermVocabularyDto> getSupportedCategoricalEnumerations() {
|
210 |
|
|
return supportedCategoricalEnumerations;
|
211 |
|
|
}
|
212 |
|
|
|
213 |
|
|
/**
|
214 |
|
|
* @param supportedCategoricalEnumerations the supportedCategoricalEnumerations to set
|
215 |
|
|
*/
|
216 |
|
|
public void setSupportedCategoricalEnumerations(Set<TermVocabularyDto> supportedCategoricalEnumerations) {
|
217 |
|
|
this.supportedCategoricalEnumerations = supportedCategoricalEnumerations;
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
/**
|
221 |
|
|
* @return the recommendedModifierEnumeration
|
222 |
|
|
*/
|
223 |
|
|
public Set<TermVocabularyDto> getRecommendedModifierEnumeration() {
|
224 |
|
|
return recommendedModifierEnumeration;
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
/**
|
228 |
|
|
* @param recommendedModifierEnumeration the recommendedModifierEnumeration to set
|
229 |
|
|
*/
|
230 |
|
|
public void setRecommendedModifierEnumeration(Set<TermVocabularyDto> recommendedModifierEnumeration) {
|
231 |
|
|
this.recommendedModifierEnumeration = recommendedModifierEnumeration;
|
232 |
|
|
}
|
233 |
|
|
|
234 |
5edd1fbf
|
Katja Luther
|
public static String getTermDtoSelect(){
|
235 |
|
|
String[] result = createSqlParts("DefinedTermBase");
|
236 |
|
|
|
237 |
|
|
return result[0]+result[1]+result[2];
|
238 |
|
|
}
|
239 |
|
|
|
240 |
|
|
private static String[] createSqlParts(String fromTable) {
|
241 |
|
|
String sqlSelectString = ""
|
242 |
|
|
+ "select a.uuid, "
|
243 |
|
|
+ "r, "
|
244 |
|
|
+ "p.uuid, "
|
245 |
|
|
+ "k.uuid, "
|
246 |
|
|
+ "v.uuid, "
|
247 |
|
|
+ "a.orderIndex, "
|
248 |
|
|
+ "a.idInVocabulary, "
|
249 |
|
|
+ "voc_rep, "
|
250 |
|
|
+ "a.termType, "
|
251 |
|
|
+ "a.uri, "
|
252 |
|
|
+ "m, "
|
253 |
3037370e
|
Katja Luther
|
+ "a.availableFor, "
|
254 |
4d68581f
|
Katja Luther
|
+ "a.titleCache, "
|
255 |
|
|
+ "a.supportedDataTypes, "
|
256 |
|
|
+ "recommendedModifierEnumeration, "
|
257 |
|
|
+ "recommendedStatisticalMeasures, "
|
258 |
|
|
+ "supportedCategoricalEnumerations, "
|
259 |
|
|
+ "recommendedMeasurementUnits ";
|
260 |
5edd1fbf
|
Katja Luther
|
|
261 |
3037370e
|
Katja Luther
|
String sqlFromString = " from "+fromTable+" as a ";
|
262 |
5edd1fbf
|
Katja Luther
|
|
263 |
|
|
String sqlJoinString = "LEFT JOIN a.partOf as p "
|
264 |
|
|
+ "LEFT JOIN a.kindOf as k "
|
265 |
|
|
+ "LEFT JOIN a.media as m "
|
266 |
|
|
+ "LEFT JOIN a.representations AS r "
|
267 |
|
|
+ "LEFT JOIN a.vocabulary as v "
|
268 |
|
|
+ "LEFT JOIN v.representations as voc_rep "
|
269 |
4d68581f
|
Katja Luther
|
+ "LEFT JOIN a.recommendedModifierEnumeration as recommendedModifierEnumeration "
|
270 |
|
|
+ "LEFT JOIN a.recommendedStatisticalMeasures as recommendedStatisticalMeasures "
|
271 |
|
|
+ "LEFT JOIN a.supportedCategoricalEnumerations as supportedCategoricalEnumerations "
|
272 |
|
|
+ "LEFT JOIN a.recommendedMeasurementUnits as recommendedMeasurementUnits "
|
273 |
5edd1fbf
|
Katja Luther
|
;
|
274 |
|
|
|
275 |
|
|
String[] result = new String[3];
|
276 |
|
|
result[0] = sqlSelectString;
|
277 |
|
|
result[1] = sqlFromString;
|
278 |
|
|
result[2] = sqlJoinString;
|
279 |
|
|
return result;
|
280 |
|
|
}
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
public static List<TermDto> termDtoListFrom(List<Object[]> results) {
|
284 |
|
|
List<TermDto> dtos = new ArrayList<>(); // list to ensure order
|
285 |
|
|
// map to handle multiple representations/media/vocRepresentation because of LEFT JOIN
|
286 |
|
|
Map<UUID, TermDto> dtoMap = new HashMap<>(results.size());
|
287 |
|
|
for (Object[] elements : results) {
|
288 |
|
|
UUID uuid = (UUID)elements[0];
|
289 |
|
|
if(dtoMap.containsKey(uuid)){
|
290 |
|
|
// multiple results for one term -> multiple (voc) representation/media
|
291 |
|
|
if(elements[1]!=null){
|
292 |
|
|
dtoMap.get(uuid).addRepresentation((Representation)elements[1]);
|
293 |
|
|
}
|
294 |
|
|
if(elements[7]!=null){
|
295 |
|
|
dtoMap.get(uuid).addVocRepresentation((Representation)elements[7]);
|
296 |
|
|
}
|
297 |
|
|
if(elements[10]!=null){
|
298 |
|
|
dtoMap.get(uuid).addMedia(((Media) elements[10]).getUuid());
|
299 |
|
|
}
|
300 |
|
|
} else {
|
301 |
|
|
// term representation
|
302 |
|
|
Set<Representation> representations = new HashSet<>();
|
303 |
|
|
if(elements[1] instanceof Representation) {
|
304 |
|
|
representations = new HashSet<Representation>(1);
|
305 |
|
|
representations.add((Representation)elements[1]);
|
306 |
|
|
}
|
307 |
|
|
// term media
|
308 |
|
|
Set<UUID> mediaUuids = new HashSet<>();
|
309 |
|
|
if(elements[10] instanceof Media) {
|
310 |
|
|
mediaUuids.add(((Media) elements[10]).getUuid());
|
311 |
|
|
}
|
312 |
|
|
// voc representation
|
313 |
|
|
Set<Representation> vocRepresentations = new HashSet<>();
|
314 |
|
|
if(elements[7] instanceof Representation) {
|
315 |
|
|
vocRepresentations = new HashSet<Representation>(7);
|
316 |
|
|
vocRepresentations.add((Representation)elements[7]);
|
317 |
|
|
}
|
318 |
|
|
boolean isAvailableForTaxon = false;
|
319 |
|
|
boolean isAvailableForTaxonName = false;
|
320 |
|
|
boolean isAvailableForOccurrence = false;
|
321 |
|
|
|
322 |
|
|
EnumSet<CdmClass> availableForString = (EnumSet<CdmClass>)elements[11];
|
323 |
|
|
|
324 |
4d68581f
|
Katja Luther
|
if (availableForString.contains(CdmClass.TAXON)){
|
325 |
|
|
isAvailableForTaxon = true;
|
326 |
|
|
}
|
327 |
|
|
if (availableForString.contains(CdmClass.TAXON_NAME)){
|
328 |
|
|
isAvailableForTaxonName = true;
|
329 |
|
|
}
|
330 |
|
|
if (availableForString.contains(CdmClass.OCCURRENCE)){
|
331 |
|
|
isAvailableForOccurrence = true;
|
332 |
|
|
}
|
333 |
|
|
boolean isSupportsCategoricalData = false;
|
334 |
|
|
boolean isSupportsQuantitativeData = false;
|
335 |
|
|
|
336 |
|
|
EnumSet<CdmClass> supportsString = (EnumSet<CdmClass>)elements[13];
|
337 |
|
|
|
338 |
|
|
if (supportsString.contains(CdmClass.CATEGORICAL_DATA)){
|
339 |
|
|
isSupportsCategoricalData = true;
|
340 |
|
|
}
|
341 |
|
|
if (supportsString.contains(CdmClass.QUANTITATIVE_DATA)){
|
342 |
|
|
isSupportsQuantitativeData = true;
|
343 |
|
|
}
|
344 |
|
|
|
345 |
|
|
Object o = elements[14];
|
346 |
|
|
Set<TermVocabularyDto> recommendedModifierDtos = new HashSet<>();
|
347 |
|
|
if (o instanceof TermVocabulary){
|
348 |
|
|
recommendedModifierDtos.add(TermVocabularyDto.fromVocabulary((TermVocabulary)o));
|
349 |
|
|
}else if (o instanceof Set){
|
350 |
|
|
Set<TermVocabulary<DefinedTerm>> recommendedModifierEnumeration = (Set<TermVocabulary<DefinedTerm>>) o;
|
351 |
|
|
if (recommendedModifierEnumeration != null){
|
352 |
|
|
for (TermVocabulary<DefinedTerm> voc: recommendedModifierEnumeration){
|
353 |
|
|
recommendedModifierDtos.add(TermVocabularyDto.fromVocabulary(voc));
|
354 |
|
|
}
|
355 |
5edd1fbf
|
Katja Luther
|
}
|
356 |
4d68581f
|
Katja Luther
|
}
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
|
360 |
|
|
o = elements[15];
|
361 |
|
|
Set<TermDto> recommendedStatisticalMeasuresDtos = new HashSet<>();
|
362 |
|
|
if (o instanceof StatisticalMeasure){
|
363 |
|
|
recommendedStatisticalMeasuresDtos.add(TermDto.fromTerm((StatisticalMeasure)o));
|
364 |
|
|
}else if (o instanceof Set){
|
365 |
|
|
Set<StatisticalMeasure> recommendedStatisticalMeasures = (Set<StatisticalMeasure>) o;
|
366 |
|
|
if (recommendedStatisticalMeasures != null) {
|
367 |
|
|
for (StatisticalMeasure term: recommendedStatisticalMeasures){
|
368 |
|
|
recommendedStatisticalMeasuresDtos.add(TermDto.fromTerm(term));
|
369 |
|
|
}
|
370 |
|
|
}
|
371 |
|
|
}
|
372 |
|
|
o = elements[16];
|
373 |
|
|
Set<TermVocabularyDto> supportedCategoricalDtos = new HashSet<>();
|
374 |
|
|
if (o instanceof TermVocabulary){
|
375 |
|
|
supportedCategoricalDtos.add(TermVocabularyDto.fromVocabulary((TermVocabulary)o));
|
376 |
|
|
}else if (o instanceof Set){
|
377 |
|
|
Set<TermVocabulary> supportedCategoricalEnumerations = (Set<TermVocabulary>)o;
|
378 |
|
|
for (TermVocabulary<State> voc: supportedCategoricalEnumerations){
|
379 |
|
|
supportedCategoricalDtos.add(TermVocabularyDto.fromVocabulary(voc));
|
380 |
5edd1fbf
|
Katja Luther
|
}
|
381 |
4d68581f
|
Katja Luther
|
}
|
382 |
|
|
|
383 |
|
|
// if (supportedCategoricalEnumerations != null){
|
384 |
|
|
// for (TermVocabulary<State> voc: supportedCategoricalEnumerations){
|
385 |
|
|
// supportedCategoricalDtos.add(TermVocabularyDto.fromVocabulary(voc));
|
386 |
|
|
// }
|
387 |
|
|
// }
|
388 |
|
|
o = elements[17];
|
389 |
|
|
Set<TermDto> recommendedMeasurementUnitsDtos = new HashSet<>();
|
390 |
|
|
if (o instanceof MeasurementUnit){
|
391 |
|
|
recommendedMeasurementUnitsDtos.add(TermDto.fromTerm((MeasurementUnit)o));
|
392 |
|
|
}else if (o instanceof Set){
|
393 |
|
|
Set<MeasurementUnit> recommendedMeasurementUnits = (Set<MeasurementUnit>) elements[17];
|
394 |
|
|
for (MeasurementUnit term: recommendedMeasurementUnits){
|
395 |
|
|
recommendedMeasurementUnitsDtos.add(TermDto.fromTerm(term));
|
396 |
5edd1fbf
|
Katja Luther
|
}
|
397 |
4d68581f
|
Katja Luther
|
}
|
398 |
|
|
|
399 |
|
|
// if (recommendedMeasurementUnits != null){
|
400 |
|
|
// for (MeasurementUnit term: recommendedMeasurementUnits){
|
401 |
|
|
// recommendedMeasurementUnitsDtos.add(TermDto.fromTerm(term));
|
402 |
|
|
// }
|
403 |
|
|
// }
|
404 |
5edd1fbf
|
Katja Luther
|
|
405 |
|
|
TermDto termDto = new FeatureDto(
|
406 |
|
|
uuid,
|
407 |
|
|
representations,
|
408 |
|
|
(UUID)elements[2],
|
409 |
|
|
(UUID)elements[3],
|
410 |
|
|
(UUID)elements[4],
|
411 |
|
|
(Integer)elements[5],
|
412 |
|
|
(String)elements[6],
|
413 |
|
|
vocRepresentations,
|
414 |
|
|
isAvailableForTaxon,
|
415 |
|
|
isAvailableForTaxonName,
|
416 |
3037370e
|
Katja Luther
|
isAvailableForOccurrence,
|
417 |
4d68581f
|
Katja Luther
|
(String)elements[12],
|
418 |
|
|
isSupportsCategoricalData,
|
419 |
|
|
isSupportsQuantitativeData,
|
420 |
|
|
supportedCategoricalDtos,
|
421 |
|
|
recommendedModifierDtos,
|
422 |
|
|
recommendedMeasurementUnitsDtos,
|
423 |
|
|
recommendedStatisticalMeasuresDtos)
|
424 |
5edd1fbf
|
Katja Luther
|
;
|
425 |
|
|
termDto.setUri((URI)elements[9]);
|
426 |
|
|
termDto.setMedia(mediaUuids);
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
dtoMap.put(uuid, termDto);
|
430 |
|
|
dtos.add(termDto);
|
431 |
|
|
}
|
432 |
|
|
}
|
433 |
|
|
return dtos;
|
434 |
|
|
}
|
435 |
|
|
|
436 |
62d28a57
|
Katja Luther
|
|
437 |
|
|
}
|