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

public Class LOBIDFetcher

extends Object
implements PagedSearchBasedParserFetcher, IdBasedParserFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.IdBasedParserFetcher, org.jabref.logic.importer.ParserFetcher, org.jabref.logic.importer.IdBasedFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.PagedSearchBasedParserFetcher, org.jabref.logic.importer.PagedSearchBasedFetcher, org.jabref.logic.importer.SearchBasedFetcher, org.jabref.logic.importer.SearchBasedParserFetcher
Imports
java.io.BufferedReader, .InputStreamReader, java.net.MalformedURLException, .URISyntaxException, .URL, java.util.ArrayList, .List, .Objects, .Optional, java.util.stream.Collectors, .IntStream, org.jabref.logic.importer.IdBasedParserFetcher, .PagedSearchBasedParserFetcher, .Parser, org.jabref.logic.importer.fetcher.transformers.LOBIDQueryTransformer, org.jabref.logic.os.OS, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.Field, .StandardField, org.jabref.model.entry.types.EntryType, .StandardEntryType, org.jabref.model.search.query.BaseQueryNode, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONObject, org.apache.hc.core5.net.URIBuilder, org.slf4j.Logger, .LoggerFactory

Fetches data from the LOBID API
See Also
API documentation for more details

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private URL
buildSearchURL(String query, int pageNumber)

Builds the search URL for the given query string.

private static List<String>
getAuthorNames(kong.unirest.core.json.JSONArray authors)

private static String
getFirstArrayElement(kong.unirest.core.json.JSONObject jsonEntry, String key)

public String
getName()

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

Returns the localized name of this fetcher.

public Parser
public URL
getUrlForIdentifier(String identifier)

Implements org.jabref.logic.importer.IdBasedParserFetcher.getUrlForIdentifier.

Constructs a URL based on the query.

public URL

Returns:

URL
getURLForQuery
(BaseQueryNode
the first parsed node
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.

Constructs a URL that sends the raw, catalog-native query verbatim to the catalog (bypassing the query transformer).

private BibEntry
parseJSONtoBibtex(kong.unirest.core.json.JSONObject jsonEntry)

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
LOGGERback to summary
private static final Logger LOGGER

Hides org.jabref.logic.importer.IdBasedParserFetcher.LOGGER.

Constructor Detail

LOBIDFetcherback to summary
public LOBIDFetcher()

Method Detail

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

Builds the search URL for the given query string.

The query is sent verbatim as the q parameter, so raw queries bypass LOBIDQueryTransformer and are passed unchanged to the catalog.

getAuthorNamesback to summary
private static List<String> getAuthorNames(kong.unirest.core.json.JSONArray authors)
getFirstArrayElementback to summary
private static String getFirstArrayElement(kong.unirest.core.json.JSONObject jsonEntry, String key)
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, org.jabref.logic.importer.IdBasedParserFetcher.getParser.

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

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

Annotations
@Override
getUrlForIdentifierback to summary
public URL getUrlForIdentifier(String identifier) throws URISyntaxException, MalformedURLException

Implements org.jabref.logic.importer.IdBasedParserFetcher.getUrlForIdentifier.

Doc from org.jabref.logic.importer.IdBasedParserFetcher.getUrlForIdentifier.

Constructs a URL based on the query.

Annotations
@Override
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 first parsed node

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.

Doc from org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForRawQuery.

Constructs a URL that sends the raw, catalog-native query verbatim to the catalog (bypassing the query transformer).

Annotations
@Override
parseJSONtoBibtexback to summary
private BibEntry parseJSONtoBibtex(kong.unirest.core.json.JSONObject jsonEntry)