diff --git a/CHANGELOG.md b/CHANGELOG.md index 81d801e29f3..0b4add8726d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Fixed +- We fixed an issue where the content of a big shared database library is not shown [#8788](https://github.com/JabRef/jabref/issues/8788) - We fixed the unnecessary horizontal scroll bar in group panel [#8467](https://github.com/JabRef/jabref/issues/8467) - We fixed an issue where the notification bar message, icon and actions appeared to be invisible. [#8761](https://github.com/JabRef/jabref/issues/8761) - We fixed an issue where deprecated fields tab is shown when the fields don't contain any values. [#8396](https://github.com/JabRef/jabref/issues/8396) diff --git a/src/main/java/org/jabref/logic/shared/DBMSProcessor.java b/src/main/java/org/jabref/logic/shared/DBMSProcessor.java index f904d25100f..81e775a5ff2 100644 --- a/src/main/java/org/jabref/logic/shared/DBMSProcessor.java +++ b/src/main/java/org/jabref/logic/shared/DBMSProcessor.java @@ -26,6 +26,7 @@ import org.jabref.model.entry.field.FieldFactory; import org.jabref.model.entry.types.EntryTypeFactory; +import com.google.common.collect.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -477,6 +478,22 @@ public Optional getSharedEntry(int sharedID) { } } + /** + * Queries the database for shared entries in 500 element batches. + * Optionally, they are filtered by the given list of sharedIds + * + * @param sharedIDs the list of Ids to filter. If list is empty, then no filter is applied + */ + public List partitionAndGetSharedEntries(List sharedIDs) { + List> partitions = Lists.partition(sharedIDs, 500); + List result = new ArrayList<>(); + + for (List sublist : partitions) { + result.addAll(getSharedEntries(sublist)); + } + return result; + } + /** * Queries the database for shared entries. Optionally, they are filtered by the given list of sharedIds * diff --git a/src/main/java/org/jabref/logic/shared/DBMSSynchronizer.java b/src/main/java/org/jabref/logic/shared/DBMSSynchronizer.java index e4b7e0294c3..1aa8b438d18 100644 --- a/src/main/java/org/jabref/logic/shared/DBMSSynchronizer.java +++ b/src/main/java/org/jabref/logic/shared/DBMSSynchronizer.java @@ -221,7 +221,7 @@ public void synchronizeLocalDatabase() { if (!entriesToInsertIntoLocalDatabase.isEmpty()) { // in case entries should be added into the local database, insert them - bibDatabase.insertEntries(dbmsProcessor.getSharedEntries(entriesToInsertIntoLocalDatabase), EntriesEventSource.SHARED); + bibDatabase.insertEntries(dbmsProcessor.partitionAndGetSharedEntries(entriesToInsertIntoLocalDatabase), EntriesEventSource.SHARED); } }