Revision 2b942f17
Added by Katja Luther over 2 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/RowWrapperDTO.java | ||
---|---|---|
87 | 87 |
public QuantitativeDataDto addQuantitativeData(FeatureDto feature){ |
88 | 88 |
QuantitativeDataDto data = new QuantitativeDataDto(feature); |
89 | 89 |
description.addElement(data); |
90 |
removeElementForFeature(feature.getUuid()); |
|
90 | 91 |
addToFeatureToElementMap(feature.getUuid(), data); |
91 | 92 |
return data; |
92 | 93 |
} |
... | ... | |
105 | 106 |
public CategoricalDataDto addCategoricalData(FeatureDto feature){ |
106 | 107 |
CategoricalDataDto data = new CategoricalDataDto(feature); |
107 | 108 |
description.addElement(data); |
109 |
removeElementForFeature(feature.getUuid()); |
|
108 | 110 |
addToFeatureToElementMap(feature.getUuid(), data); |
109 | 111 |
return data; |
110 | 112 |
} |
... | ... | |
209 | 211 |
return; |
210 | 212 |
} |
211 | 213 |
CategoricalDataDto categoricalData = null; |
212 |
if(descriptionElementBase!=null && descriptionElementBase instanceof CategoricalDataDto){ |
|
213 |
categoricalData = (CategoricalDataDto)descriptionElementBase; |
|
214 |
categoricalData.setStateDataOnly(states); |
|
214 |
if(descriptionElementBase!=null){ |
|
215 |
if (descriptionElementBase.size() == 1){ |
|
216 |
DescriptionElementDto dto = descriptionElementBase.iterator().next(); |
|
217 |
if (dto instanceof CategoricalDataDto){ |
|
218 |
categoricalData = (CategoricalDataDto)dto; |
|
219 |
categoricalData.setStateDataOnly(states); |
|
220 |
} |
|
221 |
} |
|
215 | 222 |
|
216 | 223 |
}else{ |
217 | 224 |
Feature feature = DefinedTermBase.getTermByClassAndUUID(Feature.class, featureUuid); |
... | ... | |
244 | 251 |
|
245 | 252 |
} |
246 | 253 |
description.getElements().remove(oldElement); |
254 |
featureToElementMap.remove(featureUuid); |
|
255 |
featureToDisplayDataMap.remove(featureUuid); |
|
247 | 256 |
} |
248 | 257 |
|
249 | 258 |
private void removeFeature(UUID featureUuid, Set<DescriptionElementDto> descriptionElementBases) { |
... | ... | |
285 | 294 |
quantitativeData = new QuantitativeDataDto(FeatureDto.fromFeature(feature)); |
286 | 295 |
} |
287 | 296 |
|
288 |
if(descriptionElementBase != null && descriptionElementBase instanceof QuantitativeDataDto){ |
|
289 |
quantitativeData = (QuantitativeDataDto)descriptionElementBase; |
|
290 |
//clear values |
|
297 |
if(descriptionElementBase!=null){ |
|
298 |
if (descriptionElementBase.size() == 1){ |
|
299 |
DescriptionElementDto dto = descriptionElementBase.iterator().next(); |
|
300 |
if (dto instanceof QuantitativeDataDto){ |
|
301 |
quantitativeData = (QuantitativeDataDto)dto; |
|
302 |
} |
|
303 |
} |
|
304 |
|
|
291 | 305 |
|
306 |
} |
|
307 |
if (quantitativeData == null){ |
|
308 |
//TODO: check whether this is possible |
|
309 |
return; |
|
292 | 310 |
} |
293 | 311 |
quantitativeData.getValues().clear(); |
294 | 312 |
quantitativeData.setMeasurementUnit(unit); |
Also available in: Unified diff
ref #9816: adapt rowWrapperDto to more than one description element