Verified Owner
Top Fields Constructors Methods
org.jabref.logic.relatedwork

public Class RelatedWorkInserter

extends Object
Class Inheritance
Annotations
@NullMarked
Imports
java.util.ArrayList, .List, .Optional, java.util.regex.Pattern, org.jabref.logic.os.OS, org.jabref.logic.util.strings.StringUtil, org.jabref.model.FieldChange, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.UserSpecificCommentField, org.jspecify.annotations.NullMarked, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private static final Pattern
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Optional<FieldChange>

Returns:

FieldChange represents if the field is changed
appendRelatedWorkComment
(String sourceCitationKey, String contextText, BibEntry matchedLibraryEntry, UserSpecificCommentField
comment-{username}
userSpecificCommentField
)

Insert "comment-{username}" to target bib entry If "comment-{username}" not exists, then create a new field; Otherwise append it and separate by an empty line.

public List<RelatedWorkInsertionResult>

Returns:

List of insertion result
insertMatchedRelatedWork
(BibEntry sourceEntry, List<RelatedWorkMatchResult> matchResults, String userName)

This method appends a “comment” to each matched bib entry unless the same “comment” already exists Specifically, related work text is inserted into the comment-{username} field of the matched bib entries

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COMMENT_LINE_SEPARATOR_PATTERNback to summary
private static final Pattern COMMENT_LINE_SEPARATOR_PATTERN
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

RelatedWorkInserterback to summary
public RelatedWorkInserter()

Method Detail

appendRelatedWorkCommentback to summary
private Optional<FieldChange> appendRelatedWorkComment(String sourceCitationKey, String contextText, BibEntry matchedLibraryEntry, UserSpecificCommentField userSpecificCommentField)

Insert "comment-{username}" to target bib entry If "comment-{username}" not exists, then create a new field; Otherwise append it and separate by an empty line.

Parameters
userSpecificCommentField:UserSpecificCommentField

comment-{username}

Returns:Optional<FieldChange>

FieldChange represents if the field is changed

insertMatchedRelatedWorkback to summary
public List<RelatedWorkInsertionResult> insertMatchedRelatedWork(BibEntry sourceEntry, List<RelatedWorkMatchResult> matchResults, String userName)

This method appends a “comment” to each matched bib entry unless the same “comment” already exists Specifically, related work text is inserted into the comment-{username} field of the matched bib entries

Returns:List<RelatedWorkInsertionResult>

List of insertion result