Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui.mergeentries

public final Class MergeEntriesHelper

extends Object
Class Inheritance
Imports
java.util.LinkedHashSet, .Optional, .Set, org.jabref.logic.bibtex.comparator.ComparisonResult, org.jabref.logic.bibtex.comparator.plausibility.PlausibilityComparatorFactory, org.jabref.model.FieldChange, org.jabref.model.entry.BibEntry, .KeywordList, org.jabref.model.entry.field.Field, .FieldFactory, .StandardField, org.jabref.model.entry.types.EntryType, org.jabref.model.undo.CompoundEdit, .UndoableChangeType, .UndoableFieldChange, org.slf4j.Logger, .LoggerFactory

Helper class for merging bibliography entries with undo support. Source entry data is merged into the library entry, with longer field values preferred and obsolete fields removed.

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
mergeCitationKey(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit)

Adopts the fetcher-provided citation key (e.g. an INSPIRE texkey) onto the library entry, but only if the library entry doesn't already have one — an existing, possibly user-chosen key is never overwritten by this merge.

public static boolean
mergeEntries(BibEntry
The entry containing new information (source, from the fetcher)
entryFromFetcher
,
BibEntry
The entry to be updated (target, from the library)
entryFromLibrary
,
CompoundEdit
Compound edit to collect undo information
compoundEdit
,
char
Separator character used for union-merging the groups field
keywordSeparator
)

Merges two BibEntry objects with undo support.

private static boolean
mergeEntryType(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit)

private static boolean
mergeFields(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit, char keywordSeparator)

private static boolean
removeFieldsNotPresentInFetcher(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit)

private static boolean
shouldUpdateField(Field field, String fetcherValue, Optional<String> libraryValue)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

MergeEntriesHelperback to summary
private MergeEntriesHelper()

Method Detail

mergeCitationKeyback to summary
private static boolean mergeCitationKey(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit)

Adopts the fetcher-provided citation key (e.g. an INSPIRE texkey) onto the library entry, but only if the library entry doesn't already have one — an existing, possibly user-chosen key is never overwritten by this merge.

mergeEntriesback to summary
public static boolean mergeEntries(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit, char keywordSeparator)

Merges two BibEntry objects with undo support.

Parameters
entryFromFetcher:BibEntry

The entry containing new information (source, from the fetcher)

entryFromLibrary:BibEntry

The entry to be updated (target, from the library)

compoundEdit:CompoundEdit

Compound edit to collect undo information

keywordSeparator:char

Separator character used for union-merging the groups field

mergeEntryTypeback to summary
private static boolean mergeEntryType(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit)
mergeFieldsback to summary
private static boolean mergeFields(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit, char keywordSeparator)
removeFieldsNotPresentInFetcherback to summary
private static boolean removeFieldsNotPresentInFetcher(BibEntry entryFromFetcher, BibEntry entryFromLibrary, CompoundEdit compoundEdit)
shouldUpdateFieldback to summary
private static boolean shouldUpdateField(Field field, String fetcherValue, Optional<String> libraryValue)