Copy linked files on entry transfer#13535
Conversation
| FilePreferences filePreferences | ||
| ) { | ||
|
|
||
| Set<BibEntry> modifiedEntries = new HashSet<>(); |
There was a problem hiding this comment.
Using constructor for HashSet instead of modern Java collection factory method Set.of(). Modern Java practices recommend using factory methods for cleaner and more maintainable code.
There was a problem hiding this comment.
could not find a quick solution. would have to refactor the logic then.
|
|
||
| for (BibEntry entry : targetContext.getEntries()) { | ||
| boolean entryChanged = false; | ||
| List<LinkedFile> linkedFiles = new ArrayList<>(); |
There was a problem hiding this comment.
Using ArrayList constructor instead of modern Java collection factory methods. Should use List.of() for empty list initialization following JabRef's conventions.
There was a problem hiding this comment.
could not find a quick solution. would have to refactor the logic then.
|
@UmutAkbayin Please read the bot comment - one week old Fix the tests
|
|
I converted the PR to draft, because a) merge conflicts b) tests failing. |
|
"Steps to test" seems to be AI generated. It is not a step-by-step guide. Please refine. |
|
I noticed that one unit test is affected by the changes in LibraryTab#pasteEntry. I’ll look into it tomorrow or over the weekend. I’ll also review the other things like code style. |
3f155a7 to
3ee3b08
Compare
Allows tracking the source BibDatabaseContext for later use in pasteEntry()
…er and setter Enables tracking the source database context for use in pasteEntry()
… CopyTo#copyEntriesWithFeedback and LibraryTab#pasteEntry
Add filePreferences parameter to CopyTo.java to enable LinkedFile#findIn functionality
… primary directory
…sferHelperTest#isReachableFromPrimaryDirectory method
Cloning the BibEntry in importEntryWithDuplicateCheck to ensure that any file path adjustments during the copy/paste process do not affect the original entry in the source database. This avoids side effects when imported entries are modified (e.g. file links), especially when the same BibEntry instance is shared between databases.
…ls in LibraryTab and CopyTo to align with new method signature
…pying logic during entry transfer
|
Log output of current version: |
|
jackson.databind is not visible |



Closes #12267
Adds a requirements specification file
files.mddocumenting the linked file transfer logic between BibTeX entries in JabRef.The document captures three key scenarios for when linked files are reachable or not in the target context and the expected behavior regarding path adjustment and file copying.
This improves traceability by formally specifying requirements that are linked to implementation and tests via OpenFastTrace.
Steps to test
Verify that the new requirements specification file
docs/requirements/files.mdis present, properly formatted, and follows JabRef conventions.Run all existing and new unit tests in
LinkedFileTransferHelperTestto ensure the linked file transfer logic behaves correctly across all covered scenarios.Manually verify the business logic in JabRef, especially for the scenario where the linked file is not reachable and a nested directory structure must be created. Reviewers should confirm that the path adjustments and file copying behavior conform to the requirements.
Provide feedback if the handling of the last case (unreachable file with differing paths) aligns with project expectations.
Mandatory checks