Skip to content

Commit 5f30d81

Browse files
authored
Fix Springer Fetcher names (#13770)
* Refine JavaDoc for CustomizableKeyFetcher * Fix typo * Fix Springer fetcher class names
1 parent 440a79b commit 5f30d81

File tree

10 files changed

+34
-27
lines changed

10 files changed

+34
-27
lines changed

jabgui/src/main/java/org/jabref/gui/slr/ManageStudyDefinitionViewModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.jabref.logic.importer.fetcher.CompositeSearchBasedFetcher;
2929
import org.jabref.logic.importer.fetcher.DBLPFetcher;
3030
import org.jabref.logic.importer.fetcher.IEEE;
31-
import org.jabref.logic.importer.fetcher.SpringerFetcher;
31+
import org.jabref.logic.importer.fetcher.SpringerNatureWebFetcher;
3232
import org.jabref.logic.l10n.Localization;
3333
import org.jabref.model.study.Study;
3434
import org.jabref.model.study.StudyDatabase;
@@ -48,7 +48,7 @@ public class ManageStudyDefinitionViewModel {
4848
private static final Set<String> DEFAULT_SELECTION = Set.of(
4949
ACMPortalFetcher.FETCHER_NAME,
5050
IEEE.FETCHER_NAME,
51-
SpringerFetcher.FETCHER_NAME,
51+
SpringerNatureWebFetcher.FETCHER_NAME,
5252
DBLPFetcher.FETCHER_NAME);
5353

5454
private final StringProperty title = new SimpleStringProperty();

jablib/src/main/java/org/jabref/logic/importer/FulltextFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface FulltextFetcher {
2020
* @return The fulltext PDF URL Optional, if found, or an empty Optional if not found.
2121
* @throws NullPointerException if no BibTex entry is given
2222
* @throws java.io.IOException if an IO operation has failed
23-
* @throws FetcherException if a fetcher specific error occurred
23+
* @throws FetcherException if a fetcher-specific error occurred
2424
*/
2525
Optional<URL> findFullText(BibEntry entry) throws IOException, FetcherException;
2626

jablib/src/main/java/org/jabref/logic/importer/WebFetchers.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
import org.jabref.logic.importer.fetcher.ScholarArchiveFetcher;
4545
import org.jabref.logic.importer.fetcher.ScienceDirect;
4646
import org.jabref.logic.importer.fetcher.SemanticScholar;
47-
import org.jabref.logic.importer.fetcher.SpringerFetcher;
48-
import org.jabref.logic.importer.fetcher.SpringerLink;
47+
import org.jabref.logic.importer.fetcher.SpringerNatureFullTextFetcher;
48+
import org.jabref.logic.importer.fetcher.SpringerNatureWebFetcher;
4949
import org.jabref.logic.importer.fetcher.TitleFetcher;
5050
import org.jabref.logic.importer.fetcher.ZbMATH;
5151
import org.jabref.logic.importer.fetcher.isbntobibtex.IsbnFetcher;
@@ -118,7 +118,7 @@ public static SortedSet<SearchBasedFetcher> getSearchBasedFetchers(ImportFormatP
118118
set.add(new ACMPortalFetcher());
119119
// set.add(new GoogleScholar(importFormatPreferences));
120120
set.add(new DBLPFetcher(importFormatPreferences));
121-
set.add(new SpringerFetcher(importerPreferences));
121+
set.add(new SpringerNatureWebFetcher(importerPreferences));
122122
set.add(new CrossRef());
123123
set.add(new CiteSeer());
124124
set.add(new DOAJFetcher(importFormatPreferences));
@@ -209,7 +209,7 @@ public static Set<FulltextFetcher> getFullTextFetchers(ImportFormatPreferences i
209209

210210
// Publishers
211211
fetchers.add(new ScienceDirect(importerPreferences));
212-
fetchers.add(new SpringerLink(importerPreferences));
212+
fetchers.add(new SpringerNatureFullTextFetcher(importerPreferences));
213213
fetchers.add(new ACS());
214214
fetchers.add(new ArXivFetcher(importFormatPreferences));
215215
fetchers.add(new IEEE(importFormatPreferences, importerPreferences));
@@ -232,7 +232,7 @@ public static Set<FulltextFetcher> getFullTextFetchers(ImportFormatPreferences i
232232
public static Set<CustomizableKeyFetcher> getCustomizableKeyFetchers(ImportFormatPreferences importFormatPreferences, ImporterPreferences importerPreferences) {
233233
Set<CustomizableKeyFetcher> fetchers = new HashSet<>();
234234
fetchers.add(new IEEE(importFormatPreferences, importerPreferences));
235-
fetchers.add(new SpringerFetcher(importerPreferences));
235+
fetchers.add(new SpringerNatureWebFetcher(importerPreferences));
236236
fetchers.add(new ScienceDirect(importerPreferences));
237237
fetchers.add(new AstrophysicsDataSystem(importFormatPreferences, importerPreferences));
238238
fetchers.add(new BiodiversityLibrary(importerPreferences));

jablib/src/main/java/org/jabref/logic/importer/fetcher/CustomizableKeyFetcher.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
import org.jabref.logic.importer.WebFetcher;
44

5+
/// Fetchers implementing this interface support customizable keys
56
public interface CustomizableKeyFetcher extends WebFetcher {
7+
8+
/// Returns an URL for testing a key
9+
///
10+
/// The key is appended at the URL
11+
///
12+
/// @return null if key validity checking is not supported
613
default String getTestUrl() {
714
return null;
815
}

jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerLink.java renamed to jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureFullTextFetcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
* <p>
2727
* Uses Springer API, see <a href="https://dev.springer.com">https://dev.springer.com</a>
2828
*/
29-
public class SpringerLink implements FulltextFetcher, CustomizableKeyFetcher {
29+
public class SpringerNatureFullTextFetcher implements FulltextFetcher, CustomizableKeyFetcher {
3030
public static final String FETCHER_NAME = "Springer";
3131

32-
private static final Logger LOGGER = LoggerFactory.getLogger(SpringerLink.class);
32+
private static final Logger LOGGER = LoggerFactory.getLogger(SpringerNatureFullTextFetcher.class);
3333

3434
private static final String API_URL = "https://api.springer.com/meta/v1/json";
3535
private static final String CONTENT_HOST = "link.springer.com";
3636

3737
private final ImporterPreferences importerPreferences;
3838

39-
public SpringerLink(ImporterPreferences importerPreferences) {
39+
public SpringerNatureFullTextFetcher(ImporterPreferences importerPreferences) {
4040
this.importerPreferences = importerPreferences;
4141
}
4242

jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java renamed to jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureWebFetcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@
3737
*
3838
* @see <a href="https://dev.springernature.com/">API documentation</a> for more details
3939
*/
40-
public class SpringerFetcher implements PagedSearchBasedParserFetcher, CustomizableKeyFetcher {
40+
public class SpringerNatureWebFetcher implements PagedSearchBasedParserFetcher, CustomizableKeyFetcher {
4141
public static final String FETCHER_NAME = "Springer";
4242

43-
private static final Logger LOGGER = LoggerFactory.getLogger(SpringerFetcher.class);
43+
private static final Logger LOGGER = LoggerFactory.getLogger(SpringerNatureWebFetcher.class);
4444

4545
private static final String API_URL = "https://api.springernature.com/meta/v1/json";
4646
// Springer query using the parameter 'q=doi:10.1007/s11276-008-0131-4s=1' will respond faster
4747
private static final String TEST_URL_WITHOUT_API_KEY = "https://api.springernature.com/meta/v1/json?q=doi:10.1007/s11276-008-0131-4s=1&p=1&api_key=";
4848

4949
private final ImporterPreferences importerPreferences;
5050

51-
public SpringerFetcher(ImporterPreferences importerPreferences) {
51+
public SpringerNatureWebFetcher(ImporterPreferences importerPreferences) {
5252
this.importerPreferences = importerPreferences;
5353
}
5454

jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
import org.jabref.logic.importer.fetcher.IEEE;
6262
import org.jabref.logic.importer.fetcher.MrDlibPreferences;
6363
import org.jabref.logic.importer.fetcher.ScienceDirect;
64-
import org.jabref.logic.importer.fetcher.SpringerFetcher;
64+
import org.jabref.logic.importer.fetcher.SpringerNatureWebFetcher;
6565
import org.jabref.logic.importer.fetcher.citation.semanticscholar.SemanticScholarCitationFetcher;
6666
import org.jabref.logic.importer.fileformat.CustomImporter;
6767
import org.jabref.logic.importer.plaincitation.PlainCitationParserChoice;
@@ -520,7 +520,7 @@ public JabRefCliPreferences() {
520520
defaults.put(SEARCH_WINDOW_DIVIDER_POS, 0.5);
521521
defaults.put(SEARCH_CATALOGS, convertListToString(List.of(
522522
ACMPortalFetcher.FETCHER_NAME,
523-
SpringerFetcher.FETCHER_NAME,
523+
SpringerNatureWebFetcher.FETCHER_NAME,
524524
DBLPFetcher.FETCHER_NAME,
525525
IEEE.FETCHER_NAME)));
526526
defaults.put(DEFAULT_PLAIN_CITATION_PARSER, PlainCitationParserChoice.RULE_BASED.name());
@@ -2322,7 +2322,7 @@ private Map<String, String> getDefaultFetcherKeys() {
23222322
keys.put(AstrophysicsDataSystem.FETCHER_NAME, buildInfo.astrophysicsDataSystemAPIKey);
23232323
keys.put(BiodiversityLibrary.FETCHER_NAME, buildInfo.biodiversityHeritageApiKey);
23242324
keys.put(ScienceDirect.FETCHER_NAME, buildInfo.scienceDirectApiKey);
2325-
keys.put(SpringerFetcher.FETCHER_NAME, buildInfo.springerNatureAPIKey);
2325+
keys.put(SpringerNatureWebFetcher.FETCHER_NAME, buildInfo.springerNatureAPIKey);
23262326
// SpringerLink uses the same key and fetcher name as SpringerFetcher
23272327

23282328
return keys;

jablib/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static Stream<Arguments> performSearchParameters() {
116116
when(importerPreferences.getApiKey(eq(SemanticScholarCitationFetcher.FETCHER_NAME))).thenReturn(Optional.of(buildInfo.semanticScholarApiKey));
117117
when(importerPreferences.getApiKey(eq(BiodiversityLibrary.FETCHER_NAME))).thenReturn(Optional.of(buildInfo.biodiversityHeritageApiKey));
118118
when(importerPreferences.getApiKey(eq(ScienceDirect.FETCHER_NAME))).thenReturn(Optional.of(buildInfo.scienceDirectApiKey));
119-
when(importerPreferences.getApiKey(eq(SpringerFetcher.FETCHER_NAME))).thenReturn(Optional.of(buildInfo.springerNatureAPIKey));
119+
when(importerPreferences.getApiKey(eq(SpringerNatureWebFetcher.FETCHER_NAME))).thenReturn(Optional.of(buildInfo.springerNatureAPIKey));
120120
when(importerPreferences.getApiKey(eq(IEEE.FETCHER_NAME))).thenReturn(Optional.of(buildInfo.ieeeAPIKey));
121121

122122
List<Set<SearchBasedFetcher>> fetcherParameters = new ArrayList<>();
@@ -130,7 +130,7 @@ static Stream<Arguments> performSearchParameters() {
130130
new ZbMATH(importFormatPreferences),
131131
new GoogleScholar(importFormatPreferences),
132132
new DBLPFetcher(importFormatPreferences),
133-
new SpringerFetcher(importerPreferences),
133+
new SpringerNatureWebFetcher(importerPreferences),
134134
new CrossRef(),
135135
new CiteSeer(),
136136
new DOAJFetcher(importFormatPreferences),

jablib/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java renamed to jablib/src/test/java/org/jabref/logic/importer/fetcher/SpringerNatureFullTextFetcherTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222
import static org.mockito.Mockito.when;
2323

2424
@FetcherTest
25-
class SpringerLinkTest {
25+
class SpringerNatureFullTextFetcherTest {
2626

2727
private final ImporterPreferences importerPreferences = mock(ImporterPreferences.class);
28-
private SpringerLink finder;
28+
private SpringerNatureFullTextFetcher finder;
2929
private BibEntry entry;
3030

3131
@BeforeEach
3232
void setUp() {
3333
Optional<String> apiKey = Optional.of(new BuildInfo().springerNatureAPIKey);
34-
when(importerPreferences.getApiKey(SpringerLink.FETCHER_NAME)).thenReturn(apiKey);
34+
when(importerPreferences.getApiKey(SpringerNatureFullTextFetcher.FETCHER_NAME)).thenReturn(apiKey);
3535
when(importerPreferences.getApiKeys()).thenReturn(FXCollections.emptyObservableSet());
36-
finder = new SpringerLink(importerPreferences);
36+
finder = new SpringerNatureFullTextFetcher(importerPreferences);
3737
entry = new BibEntry();
3838
}
3939

jablib/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java renamed to jablib/src/test/java/org/jabref/logic/importer/fetcher/SpringerNatureWebFetcherTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
import static org.mockito.Mockito.when;
2828

2929
@FetcherTest
30-
class SpringerFetcherTest implements SearchBasedFetcherCapabilityTest, PagedSearchFetcherTest {
30+
class SpringerNatureWebFetcherTest implements SearchBasedFetcherCapabilityTest, PagedSearchFetcherTest {
3131

3232
ImporterPreferences importerPreferences = mock(ImporterPreferences.class);
33-
SpringerFetcher fetcher;
33+
SpringerNatureWebFetcher fetcher;
3434

3535
@BeforeEach
3636
void setUp() {
3737
BuildInfo buildInfo = Injector.instantiateModelOrService(BuildInfo.class);
38-
fetcher = new SpringerFetcher(importerPreferences);
38+
fetcher = new SpringerNatureWebFetcher(importerPreferences);
3939
when(importerPreferences.getApiKeys()).thenReturn(FXCollections.emptyObservableSet());
4040
when(importerPreferences.getApiKey(fetcher.getName())).thenReturn(Optional.of(buildInfo.springerNatureAPIKey));
4141
}
@@ -159,7 +159,7 @@ void springerJSONToBibtex() {
159159
}""";
160160

161161
JSONObject jsonObject = new JSONObject(jsonString);
162-
BibEntry bibEntry = SpringerFetcher.parseSpringerJSONtoBibtex(jsonObject);
162+
BibEntry bibEntry = SpringerNatureWebFetcher.parseSpringerJSONtoBibtex(jsonObject);
163163
assertEquals(Optional.of("1992"), bibEntry.getField(StandardField.YEAR));
164164
assertEquals(Optional.of("5"), bibEntry.getField(StandardField.NUMBER));
165165
assertEquals(Optional.of("#sep#"), bibEntry.getField(StandardField.MONTH));

0 commit comments

Comments
 (0)