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

public Class BiodiversityLibrary

extends Object
implements SearchBasedParserFetcher, CustomizableKeyFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.CustomizableKeyFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.SearchBasedParserFetcher, org.jabref.logic.importer.ParserFetcher, org.jabref.logic.importer.SearchBasedFetcher
Imports
java.io.IOException, java.net.HttpURLConnection, .MalformedURLException, .URISyntaxException, .URL, java.util.ArrayList, .List, .Optional, java.util.stream.IntStream, org.jabref.logic.help.HelpFile, org.jabref.logic.importer.FetcherException, .ImporterPreferences, .ParseException, .Parser, .SearchBasedParserFetcher, org.jabref.logic.importer.fetcher.transformers.BiodiversityLibraryTransformer, org.jabref.logic.importer.util.JsonReader, org.jabref.logic.net.URLDownload, org.jabref.model.entry.Author, .AuthorList, .BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.types.StandardEntryType, org.jabref.model.search.query.BaseQueryNode, com.google.common.annotations.VisibleForTesting, kong.unirest.core.UnirestException, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONException, kong.unirest.core.json.JSONObject, org.apache.hc.core5.net.URIBuilder, org.jspecify.annotations.NonNull, org.slf4j.Logger, .LoggerFactory

Fetches data from the Biodiversity Heritage Library
See Also
API documentation

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public URL
public kong.unirest.core.json.JSONObject
public Optional<HelpFile>
getHelpPage()

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

Returns the help page for this fetcher.

public URL
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.

pack-priv URL
private String
public URL
getURLForQuery(BaseQueryNode query)

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getURLForQuery.

Constructs a URL based on the lucene query.

public boolean
isValidKey(@NonNull String apiKey)

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

Returns whether the API key is valid

public BibEntry
jsonResultToBibEntry(kong.unirest.core.json.JSONObject item)

public BibEntry
parseBibJSONtoBibtex(kong.unirest.core.json.JSONObject item, BibEntry entry)

private String
toAuthors(kong.unirest.core.json.JSONArray authors)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BASE_URLback to summary
private static final String BASE_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
RESPONSE_FORMATback to summary
private static final String RESPONSE_FORMAT

Constructor Detail

BiodiversityLibraryback to summary
public BiodiversityLibrary(ImporterPreferences importerPreferences)

Method Detail

getBaseURLback to summary
public URL getBaseURL() throws URISyntaxException, MalformedURLException
getDetailsback to summary
public kong.unirest.core.json.JSONObject getDetails(URL url) throws FetcherException
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
getItemMetadataURLback to summary
public URL getItemMetadataURL(String identifier) throws URISyntaxException, MalformedURLException
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
getPartMetadataURLback to summary
pack-priv URL getPartMetadataURL(String identifier) throws URISyntaxException, MalformedURLException
Annotations
@VisibleForTesting
getTestUrlback to summary
private String getTestUrl(String apiKey)
getURLForQueryback to summary
public URL getURLForQuery(BaseQueryNode query) throws URISyntaxException, MalformedURLException

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getURLForQuery.

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

Constructs a URL based on the lucene query.

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
jsonResultToBibEntryback to summary
public BibEntry jsonResultToBibEntry(kong.unirest.core.json.JSONObject item)
parseBibJSONtoBibtexback to summary
public BibEntry parseBibJSONtoBibtex(kong.unirest.core.json.JSONObject item, BibEntry entry) throws FetcherException
toAuthorsback to summary
private String toAuthors(kong.unirest.core.json.JSONArray authors)