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

public Class DatabaseFileLookup

extends Object
Class Inheritance
Imports
java.io.File, java.nio.file.Path, java.util.ArrayList, .HashSet, .List, .Objects, .Optional, .Set, java.util.stream.Collectors, org.jabref.model.database.BibDatabase, .BibDatabaseContext, org.jabref.model.entry.BibEntry, org.jabref.preferences.FilePreferences

Search class for files.

This class provides some functionality to search in a 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(BibDatabaseContext databaseContext, FilePreferences filePreferences)

Creates an instance by passing a BibDatabase which will be used for the searches.

Method Summary

Modifier and TypeMethod and Description
public Path

Returns:

"" if the path does not exist
getPathOfDatabase
()

public boolean

Returns:

true, if the file Object is stored in at least one entry in the database, otherwise false.
lookupDatabase
(Path
A File Object.
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(BibDatabaseContext databaseContext, FilePreferences filePreferences)

Creates an instance by passing a 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.

Parameters
pathname:Path

A File Object.

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