Hello community,
I have a editor screen with a list of related entities and I need to delete the existing entities before I add new entities into the list programmatic.
current entity and related entities are based on StandardEntity and the datasource for the related entities is a nested collection-datasource.
I have an import button which loads the new entities into the list with:
itemsDs.addItem(pli);
at the end I do an:
itemsDs.refresh();
The adding works and the screen will be refreshed afterwards, but even I try to delete the old entities before, I have both (old and new) entities in the list when I do a second import.
For deleting I have tried to remove the existing entities before I add the new ones with:
for (PartlistItem delPli : itemsDs.getItems()) {
itemsDs.removeItem(delPli);
}
But got the following exception:
java.util.ConcurrentModificationException
at java.util.Vector$Itr.checkForComodification(Vector.java:1210)
at java.util.Vector$Itr.next(Vector.java:1163)
at org.eclipse.persistence.internal.indirection.jdk8.IndirectList$1.next(IndirectList.java:82)
at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1042)
at de.smkc.cuba.fdl.web.partlist.PartlistEdit.loadPartlistItems(PartlistEdit.java:223)
at de.smkc.cuba.fdl.web.partlist.PartlistEdit.onButtonImportClick(PartlistEdit.java:166)
Looks I doing it wrong…
Any suggestions and hints are desirable.
Studio: 6.8.5 - Platform: 6.8.8
Thanks in advance
Steven