Fix "list does not match for different export order"
This commit is contained in:
parent
8245f31511
commit
9950a6c79c
1 changed files with 23 additions and 18 deletions
|
@ -121,34 +121,26 @@ public class SearchHistoryHelper {
|
|||
return helper;
|
||||
}
|
||||
|
||||
public void addItemsToHistory(List<HistoryEntry> entries) {
|
||||
for (HistoryEntry model : entries) {
|
||||
addNewItemToHistory(model, false);
|
||||
}
|
||||
updateEntriesList();
|
||||
}
|
||||
|
||||
private void addNewItemToHistory(HistoryEntry model) {
|
||||
addNewItemToHistory(model, true);
|
||||
updateEntriesList();
|
||||
}
|
||||
|
||||
private void addNewItemToHistory(HistoryEntry model, boolean markAsAccessed) {
|
||||
HistoryItemDBHelper helper = checkLoadedEntries();
|
||||
if (mp.containsKey(model.getName())) {
|
||||
model = mp.get(model.getName());
|
||||
if (markAsAccessed && model != null) {
|
||||
model.markAsAccessed(System.currentTimeMillis());
|
||||
}
|
||||
model.markAsAccessed(System.currentTimeMillis());
|
||||
helper.update(model);
|
||||
} else {
|
||||
loadedEntries.add(model);
|
||||
mp.put(model.getName(), model);
|
||||
if (markAsAccessed) {
|
||||
model.markAsAccessed(System.currentTimeMillis());
|
||||
}
|
||||
model.markAsAccessed(System.currentTimeMillis());
|
||||
helper.add(model);
|
||||
}
|
||||
updateEntriesList();
|
||||
}
|
||||
|
||||
public void addItemsToHistory(List<HistoryEntry> entries) {
|
||||
for (HistoryEntry model : entries) {
|
||||
addItemToHistoryWithReplacement(model);
|
||||
}
|
||||
updateEntriesList();
|
||||
}
|
||||
|
||||
public void updateEntriesList() {
|
||||
|
@ -161,6 +153,19 @@ public class SearchHistoryHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private void addItemToHistoryWithReplacement(HistoryEntry model) {
|
||||
HistoryItemDBHelper helper = checkLoadedEntries();
|
||||
PointDescription name = model.getName();
|
||||
if (mp.containsKey(name)) {
|
||||
HistoryEntry oldModel = mp.remove(name);
|
||||
loadedEntries.remove(oldModel);
|
||||
helper.remove(model);
|
||||
}
|
||||
loadedEntries.add(model);
|
||||
mp.put(name, model);
|
||||
helper.add(model);
|
||||
}
|
||||
|
||||
public HistoryEntry getEntryByName(PointDescription pd) {
|
||||
return mp != null && pd != null ? mp.get(pd) : null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue