Skip to content

Add per library journal abbreviation type (LTWA) on save #15517

Open
faneeshh wants to merge 14 commits intoJabRef:mainfrom
faneeshh:fix-15495
Open

Add per library journal abbreviation type (LTWA) on save #15517
faneeshh wants to merge 14 commits intoJabRef:mainfrom
faneeshh:fix-15495

Conversation

@faneeshh
Copy link
Copy Markdown
Contributor

@faneeshh faneeshh commented Apr 8, 2026

Related issues and pull requests

Closes #15495

PR Description

The save actions system allows field level formatting on save but journal abbreviation via LTWA requires a JournalAbbreviationRepository which the zero arg Formatter registry can't accommodate. So instead of that this PR stores a per-library AbbreviationType preference in MetaData and runs AbbreviateJournalCleanup directly in SaveDatabaseAction when the preference is set.

There's a new dropdown in Library Properties. In the saving section users can choose an abbreviation style that applies automatically every time the library is saved. Selecting "None (use global setting)" clears the per-library preference.

Steps to test

  1. Add an article entry with journal = Annals of Mathematics and Pure and Applied Sciences
  2. Go to Library -> Library Proprties -> Saving Tab
  3. Select Abbreviate (LTWA) from the dropdown and apply
  4. Save the library
  5. Verify the journal field now changes to Ann. Math. Pure Appl. Sci.
  6. Open the .bib file in a text editor and confirm the line @comment{jabref-meta: libraryAbbreviationType:LTWA;} is present
2026-04-12.15-11-22.mp4

You can also change the dropdown back to None (use global setting), save and confirm the metadata line gets removed from the .bib file

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if change is visible to the user)
  • [/] I added a screenshot in the PR description showing a library with a single entry with me as author and as title the issue number
  • I described the change in CHANGELOG.md in a way that can be understood by the average user (if change is visible to the user)
  • I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

@github-actions github-actions Bot added good second issue Issues that involve a tour of two or three interweaved components in JabRef component: journal abbreviations component: library-specific-preferences status: changes-required Pull requests that are not yet complete labels Apr 8, 2026
Comment thread CHANGELOG.md Outdated
Comment on lines +41 to +42
⚠️ JabRef will recreate the index in a new folder for new files and this will take a long time for a huge library.
Moreover, switching back and forth JabRef versions and meanwhile adding PDFs also requires rebuilding the index now and then.
[#15220](https://github.com/JabRef/jabref/pull/15220)
Thus, the now created search index cannot be read from older versions of JabRef anylonger.
⚠️ JabRef will recreate the index in a new folder for new files and this will take a long time for a huge library.
Moreover, switching back and forth JabRef versions and meanwhile adding PDFs also requires rebuilding the index now and then.
[#15220](https://github.com/JabRef/jabref/pull/15220)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change Log file got glitched for me in InteliJ so I had to open it in VS code and when I saved it. I think the prettier extension ended up formatting it. Hope it doesn't cause any issues.

Comment on lines +67 to +77
return switch (type) {
case DEFAULT ->
Localization.lang("Abbreviate (default)");
case DOTLESS ->
Localization.lang("Abbreviate (dotless)");
case SHORTEST_UNIQUE ->
Localization.lang("Abbreviate (shortest unique)");
case LTWA ->
Localization.lang("Abbreviate (LTWA)");
};
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope these options sound correct.

@faneeshh faneeshh marked this pull request as ready for review April 12, 2026 22:15
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add per-library journal abbreviation preference on save

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add per-library journal abbreviation preference to Library Properties
• Store abbreviation type in metadata and apply on save automatically
• Integrate AbbreviateJournalCleanup into SaveDatabaseAction workflow
• Support LTWA and other abbreviation styles with dropdown UI
Diagram
flowchart LR
  A["Library Properties UI"] -->|User selects abbreviation type| B["SavingPropertiesViewModel"]
  B -->|Stores in MetaData| C["MetaData.libraryAbbreviationType"]
  C -->|Serialized to .bib| D["MetaDataSerializer"]
  E["SaveDatabaseAction"] -->|Reads preference| C
  E -->|Applies cleanup| F["AbbreviateJournalCleanup"]
  F -->|Abbreviates journals| G["BibEntry fields updated"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java ✨ Enhancement +21/-2

Integrate journal abbreviation cleanup into save workflow

jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java


2. jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesView.java ✨ Enhancement +33/-0

Add dropdown UI for journal abbreviation preference

jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesView.java


3. jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java ✨ Enhancement +19/-0

Manage journal abbreviation preference binding and storage

jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java


View more (15)
4. jablib/src/main/java/org/jabref/model/metadata/MetaData.java ✨ Enhancement +24/-2

Add library abbreviation type field and accessors

jablib/src/main/java/org/jabref/model/metadata/MetaData.java


5. jablib/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java ✨ Enhancement +2/-0

Serialize library abbreviation type to metadata

jablib/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java


6. jablib/src/main/java/org/jabref/logic/importer/util/MetaDataParser.java ✨ Enhancement +7/-0

Parse library abbreviation type from metadata

jablib/src/main/java/org/jabref/logic/importer/util/MetaDataParser.java


7. jabgui/src/main/java/org/jabref/gui/LibraryTab.java ✨ Enhancement +1/-1

Pass JournalAbbreviationRepository to SaveDatabaseAction

jabgui/src/main/java/org/jabref/gui/LibraryTab.java


8. jabgui/src/main/java/org/jabref/gui/dialogs/AutosaveUiManager.java ✨ Enhancement +3/-1

Inject JournalAbbreviationRepository into autosave action

jabgui/src/main/java/org/jabref/gui/dialogs/AutosaveUiManager.java


9. jabgui/src/main/java/org/jabref/gui/exporter/SaveAction.java ✨ Enhancement +3/-1

Pass JournalAbbreviationRepository to save action

jabgui/src/main/java/org/jabref/gui/exporter/SaveAction.java


10. jabgui/src/main/java/org/jabref/gui/exporter/SaveAllAction.java ✨ Enhancement +2/-1

Pass JournalAbbreviationRepository to save all action

jabgui/src/main/java/org/jabref/gui/exporter/SaveAllAction.java


11. jabgui/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogViewModel.java ✨ Enhancement +3/-1

Inject JournalAbbreviationRepository into shared database save

jabgui/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogViewModel.java


12. jabgui/src/main/resources/org/jabref/gui/libraryproperties/saving/SavingProperties.fxml ✨ Enhancement +8/-0

Add journal abbreviation dropdown to saving properties UI

jabgui/src/main/resources/org/jabref/gui/libraryproperties/saving/SavingProperties.fxml


13. jablib/src/test/java/org/jabref/logic/cleanup/AbbreviateJournalOnSaveTest.java 🧪 Tests +50/-0

Test LTWA abbreviation cleanup on save

jablib/src/test/java/org/jabref/logic/cleanup/AbbreviateJournalOnSaveTest.java


14. jablib/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java 🧪 Tests +12/-0

Test serialization of library abbreviation type

jablib/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java


15. jablib/src/test/java/org/jabref/logic/importer/util/MetaDataParserTest.java 🧪 Tests +17/-0

Test round-trip parsing of library abbreviation type

jablib/src/test/java/org/jabref/logic/importer/util/MetaDataParserTest.java


16. jabgui/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java 🧪 Tests +3/-2

Update tests to pass JournalAbbreviationRepository

jabgui/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java


17. jablib/src/main/resources/l10n/JabRef_en.properties 📝 Documentation +3/-0

Add localization strings for abbreviation UI

jablib/src/main/resources/l10n/JabRef_en.properties


18. CHANGELOG.md 📝 Documentation +11/-9

Document new per-library abbreviation preference feature

CHANGELOG.md


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

qodo-free-for-open-source-projects Bot commented Apr 12, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (4) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Extra blank line in changelog📘 Rule violation ⚙ Maintainability
Description
An additional blank line is introduced at the end of CHANGELOG.md, which violates the changelog
formatting requirement. This can cause unnecessary diffs and formatting drift.
Code

CHANGELOG.md[2020]

+
Evidence
PR Compliance ID 34 requires no extra blank lines in CHANGELOG.md; the diff adds an empty line
right before the markdownlint directive.

AGENTS.md
CHANGELOG.md[2020-2020]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An extra blank line was added at the end of `CHANGELOG.md`.
## Issue Context
The project’s changelog compliance rule forbids introducing extra blank lines.
## Fix Focus Areas
- CHANGELOG.md[2020-2020]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Cleanup logic added to GUI 📘 Rule violation ⚙ Maintainability
Description
SaveDatabaseAction (GUI layer) now performs journal abbreviation cleanup over all entries, which
is non-GUI/business logic. This violates the layering guideline and makes the GUI responsible for
logic behavior.
Code

jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[R276-288]

+                List<FieldChange> abbreviationChanges = bibDatabaseContext.getMetaData()
+                                                                          .getLibraryAbbreviationType()
+                                                                          .map(abbreviationType -> {
+                                                                              boolean useFJournal = preferences.getJournalAbbreviationPreferences().shouldUseFJournalField();
+                                                                              AbbreviateJournalCleanup cleanup = new AbbreviateJournalCleanup(
+                                                                                      bibDatabaseContext.getDatabase(), journalAbbreviationRepository, abbreviationType, useFJournal);
+                                                                              return bibDatabaseContext.getDatabase().getEntries().stream()
+                                                                                                       .flatMap(entry -> cleanup.cleanup(entry).stream())
+                                                                                                       .toList();
+                                                                          })
+                                                                          .orElse(List.of());
+                libraryTab.registerUndoableChanges(
+                        Stream.concat(databaseWriter.getSaveActionsFieldChanges().stream(), abbreviationChanges.stream()).toList());
Evidence
PR Compliance ID 20 requires complex non-GUI logic to live in org.jabref.logic; the added code
instantiates AbbreviateJournalCleanup and iterates all entries to compute FieldChanges directly
inside a GUI action.

AGENTS.md
jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[276-288]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
GUI-layer `SaveDatabaseAction` now contains business logic for abbreviating journals on save.
## Issue Context
Layering rules require business logic to be implemented in `org.jabref.logic`, with GUI code acting as wiring/gateway.
## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[276-288]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Cleanup runs after write🐞 Bug ≡ Correctness
Description
SaveDatabaseAction.saveDatabase writes the database to disk before running
AbbreviateJournalCleanup, but the cleanup mutates BibEntry fields in memory. This can produce a
saved file without abbreviations while the library is then marked unchanged, risking silent loss of
the abbreviations on close.
Code

jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[R276-289]

+                List<FieldChange> abbreviationChanges = bibDatabaseContext.getMetaData()
+                                                                          .getLibraryAbbreviationType()
+                                                                          .map(abbreviationType -> {
+                                                                              boolean useFJournal = preferences.getJournalAbbreviationPreferences().shouldUseFJournalField();
+                                                                              AbbreviateJournalCleanup cleanup = new AbbreviateJournalCleanup(
+                                                                                      bibDatabaseContext.getDatabase(), journalAbbreviationRepository, abbreviationType, useFJournal);
+                                                                              return bibDatabaseContext.getDatabase().getEntries().stream()
+                                                                                                       .flatMap(entry -> cleanup.cleanup(entry).stream())
+                                                                                                       .toList();
+                                                                          })
+                                                                          .orElse(List.of());
+                libraryTab.registerUndoableChanges(
+                        Stream.concat(databaseWriter.getSaveActionsFieldChanges().stream(), abbreviationChanges.stream()).toList());
Evidence
In saveDatabase, the database is written first (writeDatabase/writePartOfDatabase), and only
afterwards the code constructs and runs AbbreviateJournalCleanup over entries and registers those
changes. AbbreviateJournalCleanup calls entry.setField(...), so it mutates the in-memory
database. After saveDatabase returns successfully, save(...) marks the undo manager unchanged
and resets changed properties, meaning the UI can consider the library saved even though the file
may not contain the post-write in-memory mutations.

/jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[255-299]
/jablib/src/main/java/org/jabref/logic/cleanup/AbbreviateJournalCleanup.java[35-85]
/jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[215-245]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AbbreviateJournalCleanup` is executed after the file write, but it mutates `BibEntry` fields. This can result in the file being saved without abbreviations while the in-memory library contains abbreviated values and is marked as unchanged.
### Issue Context
- `saveDatabase(...)` currently writes the database, then runs abbreviation cleanup and registers undo changes.
- `AbbreviateJournalCleanup` mutates entries (`entry.setField(...)`).
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[255-299]
- jablib/src/main/java/org/jabref/logic/cleanup/AbbreviateJournalCleanup.java[35-85]
### Implementation notes
- Apply abbreviation cleanup (and collect `FieldChange`s) **before** calling `databaseWriter.writeDatabase(...)` / `writePartOfDatabase(...)` so the written content matches the in-memory state.
- Keep `registerUndoableChanges(...)` based on the actual applied changes.
- Ensure the post-save `markUnchanged()` only happens when the file matches current in-memory content.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Unrelated CHANGELOG reformatting 📘 Rule violation ⚙ Maintainability
Description
The PR includes formatting-only edits in CHANGELOG.md that are unrelated to the per-library
abbreviation feature, increasing diff noise and review burden. Only the new entry should be added
without touching unrelated lines.
Code

CHANGELOG.md[R36-46]

+- We changed CSL reference format by adding citation type at the end. [#15370](https://github.com/JabRef/jabref/issues/15370) [#15434](https://github.com/JabRef/jabref/issues/15434)
- We changed the groups filter field to use a filter icon. [#15402](https://github.com/JabRef/jabref/issues/15402)
- We improved the MultiMergeEntries dialog to automatically select the most plausible field value when merging entries (e.g. a more specific date). [#15027](https://github.com/JabRef/jabref/issues/15027)
- We removed the restart prompt when accepting Mr. DLib privacy settings or hiding the Related articles tab in the entry editor. [#15195](https://github.com/JabRef/jabref/issues/15195)
- We replaced the unlinked files dialog with a wizard-based interface for searching and importing files. [#12709](https://github.com/JabRef/jabref/issues/12709)
- We replaced the various notifications for file changes, tasks and popup toasts with a new info center. [#14762](https://github.com/JabRef/jabref/issues/14762)
- We upgraded to Lucene 10.4 for the fulltext search.
-    Thus, the now created search index cannot be read from older versions of JabRef anylonger.
-    ⚠️ JabRef will recreate the index in a new folder for new files and this will take a long time for a huge library.
-    Moreover, switching back and forth JabRef versions and meanwhile adding PDFs also requires rebuilding the index now and then.
-    [#15220](https://github.com/JabRef/jabref/pull/15220)
+  Thus, the now created search index cannot be read from older versions of JabRef anylonger.
+  ⚠️ JabRef will recreate the index in a new folder for new files and this will take a long time for a huge library.
+  Moreover, switching back and forth JabRef versions and meanwhile adding PDFs also requires rebuilding the index now and then.
+  [#15220](https://github.com/JabRef/jabref/pull/15220)
Evidence
PR Compliance ID 1 forbids reformatting unrelated code; the shown hunk changes
whitespace/indentation and spacing in existing entries without functional/user-facing content
changes tied to this PR’s feature.

AGENTS.md
CHANGELOG.md[36-46]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`CHANGELOG.md` includes formatting-only edits unrelated to the feature, creating noisy diffs.
## Issue Context
Compliance requires avoiding reformatting outside the functional scope of the PR.
## Fix Focus Areas
- CHANGELOG.md[36-46]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. null used as ComboBox option 📘 Rule violation ☼ Reliability
Description
The UI uses null as a sentinel value to represent the 'None' abbreviation option, passing null
into collection-building APIs and relying on null to encode absence. This makes the code more
error-prone and conflicts with the Optional-first guideline.
Code

jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesView.java[R58-66]

+        journalAbbreviationOnSave.setItems(FXCollections.observableArrayList(
+                null, AbbreviationType.DEFAULT, AbbreviationType.DOTLESS,
+                AbbreviationType.SHORTEST_UNIQUE, AbbreviationType.LTWA));
+        journalAbbreviationOnSave.setConverter(new StringConverter<>() {
+            @Override
+            public String toString(AbbreviationType type) {
+                if (type == null) {
+                    return Localization.lang("None (use global setting)");
+                }
Evidence
PR Compliance ID 9 forbids passing null as an argument, and PR Compliance ID 7 discourages using
null/sentinels instead of explicit Optional patterns; the new code injects null into the
ComboBox item list and treats null as the 'None' choice.

AGENTS.md
AGENTS.md
jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesView.java[58-66]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The 'None (use global setting)' choice is implemented via `null` in the ComboBox items, which passes `null` into APIs and encodes absence as `null`.
## Issue Context
Compliance prefers Optional-based patterns and forbids passing `null` as an argument in general.
## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesView.java[58-66]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Ignores selectedOnly scope 🐞 Bug ≡ Correctness
Description
The new abbreviation-on-save logic always abbreviates
bibDatabaseContext.getDatabase().getEntries() regardless of the selectedOnly flag. This can
unexpectedly mutate the entire library when saveDatabase(..., selectedOnly=true, ...) is used
(e.g., “Save selected as plain”).
Code

jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[R273-286]

                databaseWriter.writeDatabase(bibDatabaseContext);
            }
-                libraryTab.registerUndoableChanges(databaseWriter.getSaveActionsFieldChanges());
+                List<FieldChange> abbreviationChanges = bibDatabaseContext.getMetaData()
+                                                                          .getLibraryAbbreviationType()
+                                                                          .map(abbreviationType -> {
+                                                                              boolean useFJournal = preferences.getJournalAbbreviationPreferences().shouldUseFJournalField();
+                                                                              AbbreviateJournalCleanup cleanup = new AbbreviateJournalCleanup(
+                                                                                      bibDatabaseContext.getDatabase(), journalAbbreviationRepository, abbreviationType, useFJournal);
+                                                                              return bibDatabaseContext.getDatabase().getEntries().stream()
+                                                                                                       .flatMap(entry -> cleanup.cleanup(entry).stream())
+                                                                                                       .toList();
+                                                                          })
+                                                                          .orElse(List.of());
Evidence
When selectedOnly is true, the writer correctly writes only libraryTab.getSelectedEntries(), but
the abbreviation pass still iterates over *all* database entries via
bibDatabaseContext.getDatabase().getEntries(). saveSelectedAsPlain calls `saveDatabase(...,
selectedOnly=true, ...)`, so enabling per-library abbreviation could still modify non-selected
entries in memory during a selected-only export/save operation.

/jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[124-135]
/jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[255-289]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Abbreviation-on-save iterates over all entries even when `selectedOnly=true`, causing unintended mutations outside the selected set.
### Issue Context
- `writePartOfDatabase(...)` uses `libraryTab.getSelectedEntries()`.
- Abbreviation cleanup uses `bibDatabaseContext.getDatabase().getEntries()` unconditionally.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[124-135]
- jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[255-289]
### Implementation notes
Choose one consistent behavior:
- If abbreviation-on-save is meant only for full-library saves: guard it with `if (!selectedOnly)`.
- If it should apply to selected-only operations too: run cleanup only on `libraryTab.getSelectedEntries()` (and ensure this does not unexpectedly alter the rest of the library).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

7. Trivial // Journal abbreviation comment 📘 Rule violation ⚙ Maintainability
Description
A new comment is added that restates what the following property represents rather than explaining
non-obvious intent or constraints. This adds noise without providing rationale.
Code

jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java[R55-56]

+    // Journal abbreviation on save
+    private final ObjectProperty<AbbreviationType> journalAbbreviationOnSaveProperty = new SimpleObjectProperty<>();
Evidence
PR Compliance ID 4 requires comments to explain 'why' rather than restating code; `// Journal
abbreviation on save` merely labels the following field.

AGENTS.md
jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java[55-56]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A new comment restates the code intent without adding rationale.
## Issue Context
Comments should explain non-obvious reasoning ('why'), not label obvious code.
## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java[55-56]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread CHANGELOG.md Outdated
Comment on lines +276 to +288
List<FieldChange> abbreviationChanges = bibDatabaseContext.getMetaData()
.getLibraryAbbreviationType()
.map(abbreviationType -> {
boolean useFJournal = preferences.getJournalAbbreviationPreferences().shouldUseFJournalField();
AbbreviateJournalCleanup cleanup = new AbbreviateJournalCleanup(
bibDatabaseContext.getDatabase(), journalAbbreviationRepository, abbreviationType, useFJournal);
return bibDatabaseContext.getDatabase().getEntries().stream()
.flatMap(entry -> cleanup.cleanup(entry).stream())
.toList();
})
.orElse(List.of());
libraryTab.registerUndoableChanges(
Stream.concat(databaseWriter.getSaveActionsFieldChanges().stream(), abbreviationChanges.stream()).toList());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Cleanup logic added to gui 📘 Rule violation ⚙ Maintainability

SaveDatabaseAction (GUI layer) now performs journal abbreviation cleanup over all entries, which
is non-GUI/business logic. This violates the layering guideline and makes the GUI responsible for
logic behavior.
Agent Prompt
## Issue description
GUI-layer `SaveDatabaseAction` now contains business logic for abbreviating journals on save.

## Issue Context
Layering rules require business logic to be implemented in `org.jabref.logic`, with GUI code acting as wiring/gateway.

## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java[276-288]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@calixtus
Copy link
Copy Markdown
Member

Please address or comment on qodos comments

@github-actions github-actions Bot added status: no-bot-comments and removed status: changes-required Pull requests that are not yet complete labels Apr 15, 2026
@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: no-bot-comments labels Apr 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Your pull request conflicts with the target branch.

Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

@github-actions github-actions Bot added status: no-bot-comments and removed status: changes-required Pull requests that are not yet complete labels Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support auto-LTWA in .bib file

2 participants