#1106: TimesheetRecentService.kt

projectforge-business/src/main/kotlin/org/projectforge/business/timesheet/TimesheetRecentService.kt Service / Recent Entries, projectforge-business/src/main/kotlin/org/projectforge/business/timesheet/TimesheetRecentService.kt 195 lines · 142 code · 30 comments · 23 blank
Spring @Service managing recent timesheet entries per user. Maintains three separate RecentQueues (max 50 entries each) stored volatile via UserPrefService: recent.timesheets (TimesheetRecentEntry objects), recent.locations (Strings), and recent.taskIds (Longs). addRecentTimesheet() appends a new entry to the timesheet queue, location queue, and task queue. On first access (empty queue), the service populates from the database: queries last 1 year of user timesheets, deduplicates (by field equality), and fills the queues up to 50 items. getRecentTimesheets()/getRecentTimesheet() return the queue contents. getRecentLocations() and getRecentTaskIds() return typed queues. Uses generic getRecentQueue() with a lazy initialization lambda pattern. User pref area keyed by TimesheetRecentService::class.java.name for namespacing.

Git History

868d6abb7 2025 -> 2026
3c439391c Timesheet: recent entries (display of kost2, project and customer) fixed. Timesheet: ai unit is preset by recent entry. Timesheet-Excel-Export: AI-savings added.
9103cc3c7 Timesheets: ignores no ai fields for recent entries as well as for favorites (should be done manually).
63081666f Source file headers: 2024-> 2025.
cba940301 Migration stuff in progress...
1b50060c3 BaseDao: renamed: get -> find, save -> insert, getList -> select, load -> select
67805f2fc ThreadLocalUserContext.user -> ThreadLocalUserContext.loggedInUser (renamed for avoiding mis-understandings in code).
4c04cfd65 MAJOR-CHANGE! Migration of integer id's to Long id's (including fk's etc.)
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
38bec971a ThreadLocal -> Kotlin
512ffa420 Configuration param: timesheetTag implemented.
5f7ef41b8 Copyright 2021 -> 2022
4c615b323 Nothing real: compiler warnings fixed.
d875be4d4 TimesheetDao: Java - Kotlin (!!!! Side effects may occur all over the project!!!!)
bac4708d9 WIP: timesheet -> reference.
ceb63e8a1 Source code header: (C) 2001-2021.
18ae3e67c WIP: timesheet -> reference.
ba7039475 wip
7e28918de wip
75c780fee Renamed: recents -> recentList
2d6ddaea9 Refactoring of recent time sheets functionality in TimesheetRecentService.