Conversation
Additionally: Rename lookup to look up (see http://notaverb.com/lookup)
| NamedCompound namedCompound = new NamedCompound(Localization.lang("Look up DOIs")); | ||
| int count = 0; | ||
| int foundCount = 0; | ||
| for (BibEntry bibEntry : bibEntries) { |
There was a problem hiding this comment.
Wouldn't it make sense to directly filter out the bibtex fields which have a DOI here with a stream?
e.g bibentries.stream().filter(x->hasField(FielName.DOI).....
There was a problem hiding this comment.
I have no idea how to create a progress bar there.
I found http://stackoverflow.com/a/26814087/873282, but that code looks much more complicated than the current code. Should I change it?
| frame.output(Localization.lang("Looking up DOIs... - entry %0 out of %1 - found %2", Integer.toString(count), totalCount, Integer.toString(foundCount))); | ||
| if (!bibEntry.hasField(FieldName.DOI)) { | ||
| Optional<DOI> doi = DOI.fromBibEntry(bibEntry); | ||
| if (doi.isPresent()) { |
There was a problem hiding this comment.
You could chain the optionals with flatmap, avoid the ifPresent cascading...
http://www.nurkiewicz.com/2013/08/optional-in-java-8-cheat-sheet.html
There was a problem hiding this comment.
No clue how I can do that with progress...
There was a problem hiding this comment.
Okay, was just an idea. If it does not make it easier forget about it
Siedlerchr
left a comment
There was a problem hiding this comment.
Some minor changes and its okay from my side
|
|
||
| private static final Log LOGGER = LogFactory.getLog(LookupDOIsWorker.class); | ||
|
|
||
| public LookupDOIsWorker(JabRefFrame frame) { |
There was a problem hiding this comment.
For maximal reusability, could you please make this class independent on DOI. There are many other identifier for which such an automatic look-up makes sense.
There was a problem hiding this comment.
- Language: Either
IDor let the caller set the DOI name - lines 43 to 46 somehow extract. Interface: CanCompleteEntry
There was a problem hiding this comment.
@koppor can you please rebase and I will implement then the rest. Deal?
# Conflicts: # CHANGELOG.md # src/main/java/org/jabref/gui/BasePanel.java # src/main/java/org/jabref/gui/JabRefFrame.java
|
@koppor thanks for rebased. I generalized it now to also work for other identifiers so this PR is now ready for review. |
| @@ -0,0 +1,8 @@ | |||
| package org.jabref.model.entry.identifier; | |||
|
|
|||
| public interface Identifier { | |||
There was a problem hiding this comment.
Should we call this class HasIdentifier?
|
LGTM 😇 I get multiple errors when using it. I don't get the information which entry is affected. But this is not an issue of this PR. Just wanted to note it down somewhere.
|
* upstream/master: Localization: General: French: Translation of new entries Localization: Menu: French: Translation of an entry (#2685) Fix #2680 and fix #2667: Swing errors are catched properly and without freezing (#2681) Do not log AND throw Replace misleading error message for fetcher connection error Document CrossRef test Fix subtitle detection for CrossRef fetcher Revert "Invoke LogMessages.add in JavaFX thread" Use global user agent Update mockito from 2.7.17 to 2.7.18 Move GuiAppender to GUI package Invoke LogMessages.add in JavaFX thread [WIP] Put the PDFAnnotationImporter under Test, enhance FileAnnotationTab (#2640) Fix for "Paying off technical debt: almost all utility classes have a private constructor now." (#2672) Revert "Paying off technical debt: almost all utility classes have a private constructor now. (#2649)" (#2670) Paying off technical debt: almost all utility classes have a private constructor now. (#2649) Changed codeformatting for better fxml annotation (#2668) Disalbe Google Scholar tests on all CI environments (#2654) Fix JSONException in Crossref fetcher as mentioned in #2442
This adds "Lookup DOIs" to the quality menu. Additionally: Rename lookup to look up (see http://notaverb.com/lookup)
With an updating status bar:
gradle localizationUpdate?