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

public Class ScienceDirect

extends Object
implements FulltextFetcher, CustomizableKeyFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.CustomizableKeyFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.FulltextFetcher
Imports
java.io.IOException, java.net.MalformedURLException, .URL, java.util.Optional, java.util.stream.Collectors, org.jabref.logic.importer.FulltextFetcher, .ImporterPreferences, org.jabref.logic.net.URLDownload, org.jabref.logic.util.URLUtil, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.identifier.DOI, kong.unirest.core.HttpResponse, kong.unirest.core.JsonNode, kong.unirest.core.Unirest, kong.unirest.core.UnirestException, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONException, kong.unirest.core.json.JSONObject, org.jsoup.Jsoup, org.jsoup.nodes.Document, .Node, org.jsoup.select.Elements, org.jspecify.annotations.NonNull, org.slf4j.Logger, .LoggerFactory

FulltextFetcher implementation that attempts to find a PDF URL at ScienceDirect. See https://dev.elsevier.com/.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface

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
ScienceDirect(ImporterPreferences importerPreferences)

Method Summary

Modifier and TypeMethod and Description
public Optional<URL>
public 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 ScienceDirect.DoiResolution
private @NonNull Optional<URL>
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

ScienceDirectback to summary
public ScienceDirect(ImporterPreferences importerPreferences)

Method Detail

findFullTextback to summary
public Optional<URL> findFullText(@NonNull BibEntry entry) throws IOException
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
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
getUrlByDoiback to summary
private ScienceDirect.DoiResolution getUrlByDoi(String doi) throws kong.unirest.core.UnirestException
parseArticlePageback to summary
private @NonNull Optional<URL> parseArticlePage(String url) throws IOException
org.jabref.logic.importer.fetcher back to summary

private sealed Interface ScienceDirect.DoiResolution

permits ArticlePage, NotFound, Pdf
Known Direct Implementers
org.jabref.logic.importer.fetcher.ScienceDirect.DoiResolution.Pdf, org.jabref.logic.importer.fetcher.ScienceDirect.DoiResolution.ArticlePage, org.jabref.logic.importer.fetcher.ScienceDirect.DoiResolution.NotFound

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record
public static record
public static record
org.jabref.logic.importer.fetcher back to summary

public final Record ScienceDirect.DoiResolution.ArticlePage

extends Record
implements DoiResolution
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.ScienceDirect.DoiResolution
Record Components
url:String 

Field Summary

Modifier and TypeField and Description
private final String
url

Record Component accessed by url().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public String
url()

Record Component getter of url.

Field Detail

urlback to summary
private final String url

Record Component accessed by url().

Constructor Detail

ArticlePageback to summary
public ArticlePage(String url)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

urlback to summary
public String url()

Record Component getter of url.

org.jabref.logic.importer.fetcher back to summary

public final Record ScienceDirect.DoiResolution.NotFound

extends Record
implements DoiResolution
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.ScienceDirect.DoiResolution
Record Components
no record components

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Constructor Detail

NotFoundback to summary
public NotFound()

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

org.jabref.logic.importer.fetcher back to summary

public final Record ScienceDirect.DoiResolution.Pdf

extends Record
implements DoiResolution
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.ScienceDirect.DoiResolution
Record Components
url:String 

Field Summary

Modifier and TypeField and Description
private final String
url

Record Component accessed by url().

Constructor Summary

AccessConstructor and Description
public
Pdf(String url)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public String
url()

Record Component getter of url.

Field Detail

urlback to summary
private final String url

Record Component accessed by url().

Constructor Detail

Pdfback to summary
public Pdf(String url)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

urlback to summary
public String url()

Record Component getter of url.