Verified Owner
Top Description Inners Fields Constructors Methods
org.jabref.gui.externalfiles

public Class DownloadFullTextAction

extends SimpleCommand
Class Inheritance
Imports
java.util.ArrayList, .List, .Optional, java.util.function.Function, org.jabref.gui.DialogService, .StateManager, org.jabref.gui.actions.ActionHelper, .SimpleCommand, org.jabref.gui.fieldeditors.LinkedFileViewModel, org.jabref.gui.preferences.GuiPreferences, org.jabref.gui.util.UiTaskExecutor, org.jabref.logic.importer.FetcherResult, .FulltextFetchers, org.jabref.logic.l10n.Localization, org.jabref.logic.util.BackgroundTask, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, .LinkedFile, org.jspecify.annotations.NullMarked, org.slf4j.Logger, .LoggerFactory

Try to download fulltext PDF for selected entry(s) by following URL or DOI link.

impl->req~fetchers.fulltext-background-search~1

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record

Field Summary

Modifier and TypeField and Description
private final DialogService
private final Function<BibEntry, Optional<FetcherResult>>
private static final Logger
private final GuiPreferences
private final StateManager
private final UiTaskExecutor
private static final int
Inherited from org.jabref.gui.actions.SimpleCommand:
statusMessage

Constructor Summary

AccessConstructor and Description
public
DownloadFullTextAction(DialogService dialogService, StateManager stateManager, GuiPreferences preferences, UiTaskExecutor taskExecutor)

pack-priv
DownloadFullTextAction(DialogService dialogService, StateManager stateManager, GuiPreferences preferences, UiTaskExecutor taskExecutor, Function<BibEntry, Optional<FetcherResult>> fullTextFinder)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addLinkedFileFromURL(BibDatabaseContext
the active database
databaseContext
,
FetcherResult
the fetcher result containing the URL and any required download headers
result
,
BibEntry
the entry "value"
entry
)

This method attaches a linked file from a URL (if not already linked) to an entry using the key and value pair from the findFullTexts map and then downloads the file into the given targetDirectory

private void
public void
private void
execute(BibDatabaseContext databaseContext)

Inherited from org.jabref.gui.actions.SimpleCommand:
getProgressprogressPropertysetExecutablestatusMessageProperty

Field Detail

dialogServiceback to summary
private final DialogService dialogService
fullTextFinderback to summary
private final Function<BibEntry, Optional<FetcherResult>> fullTextFinder
LOGGERback to summary
private static final Logger LOGGER
preferencesback to summary
private final GuiPreferences preferences
stateManagerback to summary
private final StateManager stateManager
taskExecutorback to summary
private final UiTaskExecutor taskExecutor
WARNING_LIMITback to summary
private static final int WARNING_LIMIT

Constructor Detail

DownloadFullTextActionback to summary
public DownloadFullTextAction(DialogService dialogService, StateManager stateManager, GuiPreferences preferences, UiTaskExecutor taskExecutor)
DownloadFullTextActionback to summary
pack-priv DownloadFullTextAction(DialogService dialogService, StateManager stateManager, GuiPreferences preferences, UiTaskExecutor taskExecutor, Function<BibEntry, Optional<FetcherResult>> fullTextFinder)

Method Detail

addLinkedFileFromURLback to summary
pack-priv void addLinkedFileFromURL(BibDatabaseContext databaseContext, FetcherResult result, BibEntry entry)

This method attaches a linked file from a URL (if not already linked) to an entry using the key and value pair from the findFullTexts map and then downloads the file into the given targetDirectory

Parameters
databaseContext:BibDatabaseContext

the active database

result:FetcherResult

the fetcher result containing the URL and any required download headers

entry:BibEntry

the entry "value"

downloadFullTextsback to summary
private void downloadFullTexts(List<DownloadFullTextAction.EntryDownload> downloads, BibDatabaseContext databaseContext)
executeback to summary
public void execute()
Annotations
@Override
executeback to summary
private void execute(BibDatabaseContext databaseContext)
org.jabref.gui.externalfiles back to summary

private final Record DownloadFullTextAction.EntryDownload

extends Record
Class Inheritance
Annotations
@NullMarked
Record Components
entry:BibEntry 
lookupSnapshot:BibEntry 
result:Optional<FetcherResult> 

Field Summary

Modifier and TypeField and Description
private final BibEntry
entry

Record Component accessed by entry().

private final BibEntry
lookupSnapshot

Record Component accessed by lookupSnapshot().

private final Optional<FetcherResult>
result

Record Component accessed by result().

Constructor Summary

AccessConstructor and Description
private
EntryDownload(BibEntry entry, BibEntry lookupSnapshot, Optional<FetcherResult> result)

Method Summary

Modifier and TypeMethod and Description
public BibEntry
entry()

Record Component getter of entry.

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 BibEntry
lookupSnapshot()

Record Component getter of lookupSnapshot.

public Optional<FetcherResult>
result()

Record Component getter of result.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

entryback to summary
private final BibEntry entry

Record Component accessed by entry().

lookupSnapshotback to summary
private final BibEntry lookupSnapshot

Record Component accessed by lookupSnapshot().

resultback to summary
private final Optional<FetcherResult> result

Record Component accessed by result().

Constructor Detail

EntryDownloadback to summary
private EntryDownload(BibEntry entry, BibEntry lookupSnapshot, Optional<FetcherResult> result)

Method Detail

entryback to summary
public BibEntry entry()

Record Component getter of entry.

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.

lookupSnapshotback to summary
public BibEntry lookupSnapshot()

Record Component getter of lookupSnapshot.

resultback to summary
public Optional<FetcherResult> result()

Record Component getter of result.

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.