Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.importer.fetcher

public Class SpringerNatureWebFetcher

extends Object
implements PagedSearchBasedParserFetcher, CustomizableKeyFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.CustomizableKeyFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.PagedSearchBasedParserFetcher, org.jabref.logic.importer.ParserFetcher, org.jabref.logic.importer.PagedSearchBasedFetcher, org.jabref.logic.importer.SearchBasedFetcher, org.jabref.logic.importer.SearchBasedParserFetcher
Imports
java.io.BufferedReader, .IOException, .InputStreamReader, java.net.HttpURLConnection, .MalformedURLException, .URISyntaxException, .URL, java.util.ArrayList, .List, .Optional, java.util.stream.Collectors, org.jabref.logic.help.HelpFile, org.jabref.logic.importer.ImporterPreferences, .PagedSearchBasedParserFetcher, .Parser, org.jabref.logic.importer.fetcher.transformers.SpringerQueryTransformer, org.jabref.logic.net.URLDownload, org.jabref.logic.os.OS, org.jabref.logic.util.URLUtil, org.jabref.model.entry.BibEntry, .LinkedFile, .Month, org.jabref.model.entry.field.Field, .StandardField, org.jabref.model.entry.types.StandardEntryType, org.jabref.model.search.query.BaseQueryNode, com.google.common.base.Strings, kong.unirest.core.UnirestException, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONObject, org.apache.hc.core5.net.URIBuilder, org.jspecify.annotations.NonNull, org.slf4j.Logger, .LoggerFactory

Fetches data from Springer Nature

See https://dev.springernature.com/docs/api-endpoints/meta-api/?source=jabref for more information

Field Summary

Modifier and TypeField and Description
private static final String
public static final String
private final ImporterPreferences
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private URL
buildSearchURL(String
the query string to pass directly as the q parameter
rawQuery
,
int
zero based page number; converted to a one based s start value.
pageNumber
)

Builds the Springer Nature search API URL for the given raw query string and page number.

private String
public Optional<HelpFile>
getHelpPage()

Overrides default org.jabref.logic.importer.WebFetcher.getHelpPage.

Returns the help page for this fetcher.

public String
getName()

Implements org.jabref.logic.importer.WebFetcher.getName.

Returns the localized name of this fetcher.

public Parser
getParser()

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getParser.

Returns the parser used to convert the response to a list of BibEntry.

private String
public URL

Returns:

URL
getURLForQuery
(BaseQueryNode
the search query
queryNode
,
int
the number of the page indexed from 0
pageNumber
)

Implements org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForQuery.

Gets the query URL

public URL
getURLForRawQuery(String rawQuery, int pageNumber)

Overrides default org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForRawQuery.

Builds the Springer search URL for a raw, catalog-native query, sent verbatim as the q parameter.

public boolean
isValidKey(@NonNull String apiKey)

Overrides default org.jabref.logic.importer.fetcher.CustomizableKeyFetcher.isValidKey.

Returns whether the API key is valid

public static BibEntry

Returns:

the converted BibEntry
parseSpringerJSONtoBibtex
(kong.unirest.core.json.JSONObject
the JSONObject from search results
springerJsonEntry
)

Convert a JSONObject obtained from the Metadata API to a BibEntry

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

API_URLback to summary
private static final String API_URL
FETCHER_NAMEback to summary
public static final String FETCHER_NAME
importerPreferencesback to summary
private final ImporterPreferences importerPreferences
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

SpringerNatureWebFetcherback to summary
public SpringerNatureWebFetcher(ImporterPreferences importerPreferences)

Method Detail

buildSearchURLback to summary
private URL buildSearchURL(String rawQuery, int pageNumber) throws URISyntaxException, MalformedURLException

Builds the Springer Nature search API URL for the given raw query string and page number. The raw query is sent verbatim as the q parameter, bypassing SpringerQueryTransformer.

Parameters
rawQuery:String

the query string to pass directly as the q parameter

pageNumber:int

zero based page number; converted to a one based s start value.

constructComplexQueryStringback to summary
private String constructComplexQueryString(ComplexSearchQuery complexSearchQuery)
getHelpPageback to summary
public Optional<HelpFile> getHelpPage()

Overrides default org.jabref.logic.importer.WebFetcher.getHelpPage.

Doc from org.jabref.logic.importer.WebFetcher.getHelpPage.

Returns the help page for this fetcher.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.jabref.logic.importer.WebFetcher.getName.

Doc from org.jabref.logic.importer.WebFetcher.getName.

Returns the localized name of this fetcher. The title can be used to display the fetcher in the menu and in the side pane.

Todo

This name is also used for identifying the fetcher in preferences for API keys. Thus, any switch of the language will "remove" API keys.

Annotations
@Override
getParserback to summary
public Parser getParser()

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getParser.

Doc from org.jabref.logic.importer.SearchBasedParserFetcher.getParser.

Returns the parser used to convert the response to a list of BibEntry.

Annotations
@Override
getTestUrlback to summary
private String getTestUrl(String apiKey)
getURLForQueryback to summary
public URL getURLForQuery(BaseQueryNode queryNode, int pageNumber) throws URISyntaxException, MalformedURLException

Implements org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForQuery.

Gets the query URL

Parameters
queryNode:BaseQueryNode

the search query

pageNumber:int

the number of the page indexed from 0

Returns:URL

URL

Annotations
@Override
getURLForRawQueryback to summary
public URL getURLForRawQuery(String rawQuery, int pageNumber) throws URISyntaxException, MalformedURLException

Overrides default org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForRawQuery.

Builds the Springer search URL for a raw, catalog-native query, sent verbatim as the q parameter.

Annotations
@Override
isValidKeyback to summary
public boolean isValidKey(@NonNull String apiKey)

Overrides default org.jabref.logic.importer.fetcher.CustomizableKeyFetcher.isValidKey.

Doc from org.jabref.logic.importer.fetcher.CustomizableKeyFetcher.isValidKey.

Returns whether the API key is valid

Annotations
@Override
parseSpringerJSONtoBibtexback to summary
public static BibEntry parseSpringerJSONtoBibtex(kong.unirest.core.json.JSONObject springerJsonEntry)

Convert a JSONObject obtained from the Metadata API to a BibEntry

Parameters
springerJsonEntry:kong.unirest.core.json.JSONObject

the JSONObject from search results

Returns:BibEntry

the converted BibEntry