Revision fefbc963
Added by Andreas Kohlbecker almost 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java | ||
---|---|---|
85 | 85 |
|
86 | 86 |
private BeanInstantiator<Reference> newReferenceInstantiator; |
87 | 87 |
|
88 |
private BeanInstantiator<TaxonName> newBasionymNameInstantiator; |
|
89 |
|
|
90 | 88 |
private AbstractField<TaxonName> basionymSourceField; |
91 | 89 |
|
92 | 90 |
/** |
... | ... | |
233 | 231 |
} |
234 | 232 |
} |
235 | 233 |
|
236 |
@Override |
|
237 |
protected TaxonNameDTO handleTransientProperties(TaxonNameDTO dto) { |
|
238 |
|
|
239 |
|
|
240 |
logger.trace(this._toString() + ".onEditorSaveEvent - handling transient properties"); |
|
241 |
|
|
242 |
/* |
|
243 |
dto.updateTargetEntity(); |
|
244 |
|
|
245 |
TaxonName bean = cdmEntity(dto); |
|
246 |
List<TaxonName> newBasionymNames = getView().getBasionymComboboxSelect().getValueFromNestedFields(); |
|
247 |
Set<TaxonName> oldBasionyms = bean.getBasionyms(); |
|
248 |
Set<TaxonName> updateBasionyms = new HashSet<>(); |
|
249 |
Set<TaxonName> removeBasionyms = new HashSet<>(); |
|
250 |
|
|
251 |
for(TaxonName newB : newBasionymNames){ |
|
252 |
if(!oldBasionyms.contains(newB)){ |
|
253 |
updateBasionyms.add(newB); |
|
254 |
} |
|
255 |
} |
|
256 |
|
|
257 |
for(TaxonName oldB : oldBasionyms){ |
|
258 |
if(!newBasionymNames.contains(oldB)){ |
|
259 |
removeBasionyms.add(oldB); |
|
260 |
} |
|
261 |
} |
|
262 |
for(TaxonName removeBasionym :removeBasionyms){ |
|
263 |
Set<NameRelationship> removeRelations = new HashSet<NameRelationship>(); |
|
264 |
for (NameRelationship nameRelation : bean.getRelationsToThisName()){ |
|
265 |
if (nameRelation.getType().isBasionymRelation() && nameRelation.getFromName().equals(removeBasionym)){ |
|
266 |
removeRelations.add(nameRelation); |
|
267 |
} |
|
268 |
} |
|
269 |
for (NameRelationship relation : removeRelations){ |
|
270 |
bean.removeNameRelationship(relation); |
|
271 |
} |
|
272 |
} |
|
273 |
getRepo().getSession().clear(); |
|
274 |
for(TaxonName addBasionymName :updateBasionyms){ |
|
275 |
if(addBasionymName != null){ |
|
276 |
bean.addBasionym(addBasionymName); |
|
277 |
} |
|
278 |
} |
|
279 |
*/ |
|
280 |
return dto; |
|
281 |
} |
|
282 |
|
|
283 | 234 |
/** |
284 | 235 |
* {@inheritDoc} |
285 | 236 |
*/ |
Also available in: Unified diff
ref #7386 removing obsolete handleTransientProperties() method