Add more commands to JabSrv#14855
Conversation
Technical specification completed and saved to `.zenflow/tasks/new-task-b2ce/spec.md`. The spec includes: **Key Findings:** - **Difficulty**: Medium - **Architecture**: HTTP commands use Jackson polymorphic deserialization, delegate to `UiCommand` records, which are processed by `UiMessageHandler` - **Implementation**: Create 3 new command classes mirroring CLI functionality **Critical Dependencies:** - `UiMessageHandler` must be registered in HK2 `ServiceLocator` - Commands need `Platform.runLater()` for JavaFX thread safety **Open Questions:** 1. ServiceLocator binding configuration location 2. Thread safety approach (async execution)
I'll start by reading the specification and understanding the existing code structure.
…tiple ones) - remove libraryId and entryIds for select entries command (unsure if it is still used)
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
Co-authored-by: qodo-free-for-open-source-projects[bot] <189517486+qodo-free-for-open-source-projects[bot]@users.noreply.github.com>
|
|
||
| ### Changed | ||
|
|
||
| - REST-API: Command resource: `command` instead of `commandId`. [#14855](https://github.com/JabRef/jabref/pull/14855) |
There was a problem hiding this comment.
If we change this, we probably should adapt jabmap, shouldn't we?
There was a problem hiding this comment.
We could also add an alias and adapt jabmap later on and than remove the alias again
| private ServiceLocator serviceLocator; | ||
| // TODO: This is probably needed for some CAYW functionality to "scope" the citation keys properly | ||
| // @JsonProperty | ||
| // private String libraryId = ""; |
There was a problem hiding this comment.
This is not for cayw but for jabmap if I remember correctly.
| } | ||
| // TODO: This is probably needed for some CAYW functionality to use a unique entry id "scope" the citation keys properly | ||
| // @JsonProperty | ||
| // private List<String> entryIds = new ArrayList<>(); |
| } | ||
|
|
||
| if (filesToServe.isEmpty()) { | ||
| // empty filesToServe indicates GUI mode |
There was a problem hiding this comment.
We could also check if srvStateManager instanceOf JabRevSrvStateManager this should be more reliable, but i also dont see a downside of this check
* upstream/main: (64 commits) New Crowdin updates (JabRef#14862) Make JDK25 available (JabRef#14861) Fix empty entries array when exporting group chat to JSON (JabRef#14814) feat: add right-click copy context menu to AI chat messages (JabRef#14722) FIX : generic error dialog and icon in Source Tab parsing (JabRef#14828) Factor out setup-* actions (JabRef#14859) Link .http files. Update dependency org.postgresql:postgresql to v42.7.9 (JabRef#14857) Add more commands to JabSrv (JabRef#14855) Fix JabRef#14821: Hide identifier action buttons when field is empty (JabRef#14831) Add GH_TOKEN to closed issues/PRs processing step New Crowdin updates (JabRef#14854) New Crowdin updates (JabRef#14849) Chore(deps): Bump jablib/src/main/resources/csl-styles from `0201999` to `f345aa8` (JabRef#14833) Add support for book front covers, again (JabRef#14777) Readd min width to button in new enty dialog (JabRef#14791) Replace plugin impl from jbang plugin (JabRef#14846) Revise AI policy wording Chore(deps): Bump jablib/src/main/resources/csl-locales (JabRef#14677) Update dependency com.konghq:unirest-modules-gson to v4.7.1 (JabRef#14845) ...
User description
Refs #14823 (comment)
We now have "proper" commands
Steps to test
commands.http- executerest-api.http- scroll down - executeMandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)PR Type
Enhancement
Description
Refactored HTTP command architecture to use polymorphic deserialization
Added three new HTTP commands:
selectentries,open, andfocusRenamed
JumpToEntryKeytoSelectEntryKeyssupporting multiple entriesMoved
UiMessageHandlerinterface to logic module for better separationAdded REST API endpoint for importing BibTeX to current library
Improved thread safety with
Platform.runLater()for JavaFX operationsDiagram Walkthrough
File Walkthrough
15 files
Renamed JumpToEntryKey to SelectEntryKeys with list supportRegistered JabRefFrame as UiMessageHandler with thread safetyRefactored entry selection to support multiple entriesUpdated to use SelectEntryKeys with list parameterPass JabRefFrame to HTTP server manager initializationAdded UiMessageHandler parameter to start methodsPass UiMessageHandler through to Server initializationRegister UiMessageHandler in service locator for GUI modeRefactored to abstract class with polymorphic JSON deserializationSimplified command dispatch with polymorphic deserializationSimplified to delegate to UiCommand via base classNew command to bring JabRef window to frontNew command to open library files via HTTPNew resource for entries endpoint with BibTeX importAdded support for `current` library identifier in GUI mode6 files
Moved interface from gui.frame to logic packageUpdated import to use UiMessageHandler from logic packageUpdated import to use UiMessageHandler from logic packageUpdated import to use UiMessageHandler from logic packageMoved to resources package and updated package declarationMoved PDF files endpoint to EntriesResource1 files
New test for focus command CLI error handling3 files
Updated examples with new command format and focus commandAdded BibTeX import endpoint documentationDocumented new REST-API commands and property changes