Automatic Grouping By Date#14169
Conversation
…c tests currently only group based on year not months
…to-date-groups
…year following month and day, changing AutomaticDateGroup/DateGroup+ DateGranularity + tests (year/month/day)
Model of auto date groups complelte and the test added
- Add AUTOMATIC_DATE_GROUP_ID constant to MetadataSerializationConfiguration - Implement serializeAutomaticDateGroup() in GroupSerializer * Serializes field name * Serializes granularity (YEAR/MONTH/FULL_DATE) - Add AutomaticDateGroup case in serialization switch - Add getField() and getGranularity() methods to AutomaticDateGroup - Fix deepCopy() and hashCode() to include granularity Serialization format: AutomaticDateGroup:name;context;field;granularity;...
- Add AutomaticDateGroup and DateGranularity imports to GroupsParser - Implement automaticDateGroupFromString() method * Parse name, context, field from serialized string * Parse and convert granularity string to DateGranularity enum * Create AutomaticDateGroup with all parameters * Restore group details (color, icon, description) - Add condition check in fromString() to handle AutomaticDateGroup This enables AutomaticDateGroup to be loaded from .bib files, completing the save/load cycle with serialization.
Serialization tests (GroupSerializerTest.java): - Test YEAR granularity serialization - Test MONTH granularity serialization - Test serialization with color, icon, and description - Verify format: AutomaticDateGroup:name;context;field;granularity;... Deserialization tests (GroupsParserTest.java): - Test parsing YEAR granularity - Test parsing MONTH granularity - Test parsing FULL_DATE granularity - Test parsing with color, icon, and description - Verify correct object reconstruction from string Total: 7 new test cases covering all granularity types and edge cases.
Checkstyle reported DateGranularity as an unused import because we only use it through method return type inference (getGranularity().name()). The import is not needed since we don't declare any variables of this type.
- Document DateGranularity enum values - Add class-level documentation for DateGroup - Ensures these files are detected as changed files in CI for JBang testing
Logic serialization
Implement the GUI for auto date grouping
Syncing the upstream update
Hey @elliotgnn!Thank you for contributing to JabRef! Your help is truly appreciated ❤️. We have automatic checks in place, based on which you will soon get automated feedback if any of them are failing. We also use TragBot with custom rules that scans your changes and provides some preliminary comments, before a maintainer takes a look. TragBot is still learning, and may not always be accurate. In the "Files changed" tab, you can go through its comments and just click on "Resolve conversation" if you are sure that it is incorrect, or comment on the conversation if you are doubtful. Please re-check our contribution guide in case of any other doubts related to our contribution workflow. |
|
Please provide steps to test without using a walkthrough. |
subhramit
left a comment
There was a problem hiding this comment.
LGTM, var used but only in tests, so okay
* groups: add model classes: AutomaticDateGroup + DateGroup + some basic tests currently only group based on year not months * model(groups): adding granularity to to model so it can now group by year following month and day, changing AutomaticDateGroup/DateGroup+ DateGranularity + tests (year/month/day) * Fix formatting/checkstyle, apply OpenRewrite, add CHANGELOG * Match OpenRewrite/formatting expected by CI * Add serialization support for AutomaticDateGroup - Add AUTOMATIC_DATE_GROUP_ID constant to MetadataSerializationConfiguration - Implement serializeAutomaticDateGroup() in GroupSerializer * Serializes field name * Serializes granularity (YEAR/MONTH/FULL_DATE) - Add AutomaticDateGroup case in serialization switch - Add getField() and getGranularity() methods to AutomaticDateGroup - Fix deepCopy() and hashCode() to include granularity Serialization format: AutomaticDateGroup:name;context;field;granularity;... * Add deserialization support for AutomaticDateGroup - Add AutomaticDateGroup and DateGranularity imports to GroupsParser - Implement automaticDateGroupFromString() method * Parse name, context, field from serialized string * Parse and convert granularity string to DateGranularity enum * Create AutomaticDateGroup with all parameters * Restore group details (color, icon, description) - Add condition check in fromString() to handle AutomaticDateGroup This enables AutomaticDateGroup to be loaded from .bib files, completing the save/load cycle with serialization. * Add comprehensive tests for AutomaticDateGroup serialization Serialization tests (GroupSerializerTest.java): - Test YEAR granularity serialization - Test MONTH granularity serialization - Test serialization with color, icon, and description - Verify format: AutomaticDateGroup:name;context;field;granularity;... Deserialization tests (GroupsParserTest.java): - Test parsing YEAR granularity - Test parsing MONTH granularity - Test parsing FULL_DATE granularity - Test parsing with color, icon, and description - Verify correct object reconstruction from string Total: 7 new test cases covering all granularity types and edge cases. * Fix: Add missing DateGranularity import to GroupSerializer * Fix: Remove unused DateGranularity import from GroupSerializer Checkstyle reported DateGranularity as an unused import because we only use it through method return type inference (getGranularity().name()). The import is not needed since we don't declare any variables of this type. * Add JavaDoc comments to DateGranularity and DateGroup - Document DateGranularity enum values - Add class-level documentation for DateGroup - Ensures these files are detected as changed files in CI for JBang testing * Add UI components for automatic year groups * Add Date group functionality for automatic grouping * Fix the error popping up when right-clicking the group. * Remove obsolete localization keys from JabRef_en.properties * Clean up redundant comments in GroupDialogViewModel and GroupNodeViewModel * test bug fix BibtexParserTest.java:1453 * fix jbang * turn it back to original case * Fix submodules * Fix submodules --------- Co-authored-by: Sheng Wang <u7507270@gmail.com> Co-authored-by: Xu <u7643101@anu.edu.au> Co-authored-by: Xingyu <u7713884@anu.edu.au> Co-authored-by: XingyuDu2025 <xingyu.du02@gmail.com> Co-authored-by: Christoph <siedlerkiller@gmail.com>
Closes #10822
This PR adds Automatic Date Groups feature to JabRef. Users can create automatic groups by year, by year-month or by full date when the date field of entries are set. Membership is dynamic—no manual assignment. The following are the specifics of implementation.
Model
DateGranularityenum:YEAR,MONTH,FULL_DATE.DateGroup extends AbstractGroup: represents a single key like2024,2024-10, or2024-10-14. Matching uses JabRef’s aliasing (date ↔ year/month/day).AutomaticDateGroup: builds childDateGroups for all entries at the chosen granularity and merges identical keys.Serialization
GroupsParser: read/write support forAutomaticDateGroup. Deserialization is tolerant—if the granularity token is missing/invalid, it defaults toYEAR(backward-compatible with older libraries).jablib/src/main/java/org/jabref/logic/exporterandjablib/src/main/java/org/jabref/logic/importerfolderGUI
YEAR)gui/groupsfolderSteps to test
Automated tests
Corresponding unit and integration tests for model, logic have been added for testing feature and persistence, in order to run them user can execute the command:
Manual Test
Manual Test can also be carried out through directly interacting with the GUI, steps will be:
+Add groupunder walkthrough section to generate example entriesAdd Groupat the lower left cornerDateoption under Collect by section and you can keep the default granularity for DATE and YEAROKBelow are the Demonstration images:




step 2:
step 3:
step 4:
step 5:
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)