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

public Class UnpaywallFetcher

extends Object
implements SearchBasedFetcher, CustomizableKeyFetcher, FulltextFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.FulltextFetcher, org.jabref.logic.importer.fetcher.CustomizableKeyFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.SearchBasedFetcher
Imports
java.io.IOException, .InputStream, java.net.HttpURLConnection, .URL, java.util.List, .Optional, org.jabref.logic.importer.FetcherException, .FulltextFetcher, .ImporterPreferences, .SearchBasedFetcher, org.jabref.logic.net.URLDownload, org.jabref.logic.util.URLUtil, org.jabref.logic.util.strings.StringUtil, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.search.query.BaseQueryNode, kong.unirest.core.UnirestException, org.jspecify.annotations.NonNull, org.slf4j.Logger, .LoggerFactory, tools.jackson.databind.JsonNode, .ObjectMapper

Fetcher for Unpaywall

Currently only used for storing an "API key" to be able to cope with URLs appearing at web server answers such as Paper or abstract available at https://api.unpaywall.org/v2/10.47397/tb/44-3/tb138kopp-jabref?email=<INSERT_YOUR_EMAIL>

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Optional<URL>
public @NonNull String
getName()

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

Returns the localized name of this fetcher.

public TrustLevel
getTrustLevel()

Implements org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Returns the level of trust for this fetcher.

private static @NonNull String
getUrl(String doi, String email)

public boolean
isValidKey(String apiKey)

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

Returns whether the API key is valid

public List<BibEntry>
performSearch(BaseQueryNode queryList)

Implements org.jabref.logic.importer.SearchBasedFetcher.performSearch.

This method is used to send complex queries using fielded search.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

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
mapperback to summary
private final ObjectMapper mapper
URL_PATTERNback to summary
private static final String URL_PATTERN

Constructor Detail

UnpaywallFetcherback to summary
public UnpaywallFetcher(ImporterPreferences importerPreferences)

Method Detail

findFullTextback to summary
public Optional<URL> findFullText(@NonNull BibEntry entry) throws IOException, FetcherException
Annotations
@Override
getNameback to summary
public @NonNull 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
getTrustLevelback to summary
public TrustLevel getTrustLevel()

Implements org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Doc from org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Returns the level of trust for this fetcher. We distinguish between publishers and meta search engines for example.

Annotations
@Override
getUrlback to summary
private static @NonNull String getUrl(String doi, String email)
isValidKeyback to summary
public boolean isValidKey(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
performSearchback to summary
public List<BibEntry> performSearch(BaseQueryNode queryList) throws FetcherException

Implements org.jabref.logic.importer.SearchBasedFetcher.performSearch.

Doc from org.jabref.logic.importer.SearchBasedFetcher.performSearch.

This method is used to send complex queries using fielded search.

Annotations
@Override