Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.util.io

public Class DatabaseFileLookup

extends Object
Class Inheritance
Imports
java.nio.file.Path, java.util.ArrayList, .HashSet, .List, .Optional, .Set, java.util.stream.Collectors, org.jabref.logic.FilePreferences, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, org.jspecify.annotations.NonNull

Search class for files.

This class provides some functionality to search in a org.jabref.model.database.BibDatabase for files.

Field Summary

Modifier and TypeField and Description
private final Set<Path>
private final Path
private final List<Path>

Constructor Summary

AccessConstructor and Description
public
DatabaseFileLookup(@NonNull BibDatabaseContext databaseContext, FilePreferences filePreferences)

Creates an instance by passing a org.jabref.model.database.BibDatabase which will be used for the searches.

Method Summary

Modifier and TypeMethod and Description
public Path
getPathOfDatabase()

Returns: "" if the path does not exist

public boolean

Returns:

true, if the file Object is stored in at least one entry in the database, otherwise false.
lookupDatabase
(Path pathname)

Returns whether the File file is present in the database as an attached File to an BibEntry.

private List<Path>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileCacheback to summary
private final Set<Path> fileCache
pathOfDatabaseback to summary
private final Path pathOfDatabase
possibleFilePathsback to summary
private final List<Path> possibleFilePaths

Constructor Detail

DatabaseFileLookupback to summary
public DatabaseFileLookup(@NonNull BibDatabaseContext databaseContext, FilePreferences filePreferences)

Creates an instance by passing a org.jabref.model.database.BibDatabase which will be used for the searches.

Method Detail

getPathOfDatabaseback to summary
public Path getPathOfDatabase()
Returns:Path

"" if the path does not exist

lookupDatabaseback to summary
public boolean lookupDatabase(Path pathname)

Returns whether the File file is present in the database as an attached File to an BibEntry.

To do this, the field specified by the key file will be searched for the provided file for every BibEntry in the database.

For the matching, the absolute file paths will be used.

Returns:boolean

true, if the file Object is stored in at least one entry in the database, otherwise false.

parseFileFieldback to summary
private List<Path> parseFileField(@NonNull BibEntry entry)