if (isElementSnapshotList.pollLast()) {
List<Boolean> undoCreationList = undoSnapshotCreationList.pollLast();
List<Element> undoElement = undoSnapshots.pollLast();
String deleteList = "";
JSONArray changeList = new JSONArray();
IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
for (int i = 0; i < undoElement.size(); i++) {
if (undoCreationList.get(i)) {
elementMap.remove(undoElement.get(i).getId());
if (loadedElementMap.containsKey(undoElement.get(i).getId())) {
loadedContent = "";
whiteboardMap.get(whiteboardObjectId).setLoadedContent("");
loadedElementMap.remove(undoElement.get(i).getId());
}
if ("".equals(deleteList)) {
deleteList = "" + undoElement.get(i).getId();
} else {
deleteList += "," + undoElement.get(i).getId();
}
} else {
elementMap.put(undoElement.get(i).getId(), undoElement.get(i));
try {
changeList.put(undoElement.get(i).getJSON());
} catch (JSONException e) {
log.error("Unexpected error while getting JSON", e);
}
}
}