-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize data fetching #4520
Merged
+94
−75
Merged
Optimize data fetching #4520
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3c31a3d
optimize data fetching from database
e97e346
delete time measure code
041b5e5
revert code style
825fc9d
fix checkstyle
7e73d2b
put columns name instead of *
534c188
revert checkstyle
84e0f5f
change for to stream
67a84f3
refactor variable name
1cae782
create simple test
58c91aa
fix test
b10bc03
Merge branch 'master' into optimize-data-fetching
3ced52b
rename method name
7dccfe5
refactor
e3ebbdb
create test
18cf256
Fix formatting
tobiasdiez ee4db9b
Remove obsolete method by slight refactoring
tobiasdiez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
@@ -175,7 +176,7 @@ public void synchronizeLocalDatabase() { | |
|
||
// remove old entries locally | ||
removeNotSharedEntries(localEntries, idVersionMap.keySet()); | ||
|
||
List<Integer> entryToDrag = new ArrayList<>(); | ||
tobiasdiez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// compare versions and update local entry if needed | ||
for (Map.Entry<Integer, Integer> idVersionEntry : idVersionMap.entrySet()) { | ||
boolean match = false; | ||
|
@@ -205,12 +206,13 @@ public void synchronizeLocalDatabase() { | |
} | ||
} | ||
if (!match) { | ||
Optional<BibEntry> bibEntry = dbmsProcessor.getSharedEntry(idVersionEntry.getKey()); | ||
tobiasdiez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (bibEntry.isPresent()) { | ||
bibDatabase.insertEntry(bibEntry.get(), EntryEventSource.SHARED); | ||
} | ||
entryToDrag.add(idVersionEntry.getKey()); | ||
tobiasdiez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
||
for (BibEntry bibEntry : dbmsProcessor.getSharedEntriesByIdList(entryToDrag)) { | ||
tobiasdiez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bibDatabase.insertEntry(bibEntry, EntryEventSource.SHARED); | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -322,10 +324,10 @@ public void pullChanges() { | |
} | ||
|
||
/** | ||
* Checks whether the current SQL connection is valid. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original formatting looked right to me. |
||
* In case that the connection is not valid a new {@link ConnectionLostEvent} is going to be sent. | ||
*Checks whether the current SQL connection is valid. | ||
*In case that the connection is not valid a new {@link ConnectionLostEvent} is going to be sent. | ||
* | ||
* @return <code>true</code> if the connection is valid, else <code>false</code>. | ||
*@return <code>true</code> if the connection is valid, else <code>false</code>. | ||
*/ | ||
public boolean checkCurrentConnection() { | ||
try { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this method should also replace
getSharedEntryList
below, right?