#1123: UserPrefCache.kt

projectforge-business/src/main/kotlin/org/projectforge/business/user/UserPrefCache.kt Cache, projectforge-business/src/main/kotlin/org/projectforge/business/user/UserPrefCache.kt 96 lines · 46 code · 36 comments · 14 blank
Cache implementation for user preferences, extending AbstractUserPrefCache with concrete storage and retrieval logic for UserPrefEntryDO entities.

Architecture

Cache Hierarchy

Extends AbstractUserPrefCache. Uses in-memory ConcurrentHashMap per user for fast access. Falls back to database queries via UserPrefDao on cache miss.

Type Safety

Provides generic getEntry(key, type) methods using Kotlin reified generics. Supports String, Integer, Boolean, and serialized object values.

Design Rationale

Preferences are read on virtually every page load but change infrequently. The cache eliminates redundant DB reads while putValue() ensures write-through consistency.

Architecture Analysis

Resides in projectforge-business, the core module containing domain logic, services, and persistence. Typically annotated with @Service or @Component, managed by the Spring IoC container with dependency injection.

Git History

CommitWhat changed
868d6abb752025 -> 2026
63081666f6Source file headers: 2024-> 2025.
f8961fd661Shutdown handling of ProjectForge improved: ShutdownService will shutdown some services first before database will gone.
011000f03dMigration stuff in progress... (all tests of all packages: OK).
4d58829ccdUserPrefCache and UserXmlPreferencesCache refactored.
4b9ffbee2cMigration stuff in progress... (all tests of all packages: OK).
1b50060c3aBaseDao: renamed: get -> find, save -> insert, getList -> select, load -> select
87aaf6a5a5Migration stuff in progress... BaseDao refactored (not yet finished) internal* methods renamed.
b1a4bf2acfMigration stuff in progress... (all tests of all packages: OK).
3aeda5ef5aBig change: all save|update|...InTrans renamed (InTrans removed). PfPesistenceContext as param not needed anymore (ThreadLocal is used instead). (all tests of all packages: OK).
67805f2fc1ThreadLocalUserContext.user -> ThreadLocalUserContext.loggedInUser (renamed for avoiding mis-understandings in code).
1135ccbca9Persistence: functions renamed: *NewTrans -> *InTrans
b095e6f7d1!!!!! Big change of Transaction handling: Re-uses PfPersistenceContext as much as possible (not yet finished). Tests doesn't yet run.
4c04cfd652MAJOR-CHANGE! Migration of integer id's to Long id's (including fk's etc.)
d809ca82a2Migration stuff in progress...
31a7c1cbacMigration stuff in progress...
06828f4908Migration stuff in progress...
77bade6dfbjavax.* -> jakarta.*
b6092df092Copyright 2023 -> 2024
ab45d51fa4Copyright 2001-2022 -> 2001-2023.
38bec971afThreadLocal -> Kotlin
2430786334ProjektEditPage returns now to Wicket-version if called by.
fc0e360a84React list: filter reset will also reset AG grid states and reloads the page.
5f7ef41b8cCopyright 2021 -> 2022
ceb63e8a1bSource code header: (C) 2001-2021.
4d0748a453UserPrefCache: synchronize. Bugfix: user prefs were lost!
b6750dc966Nothing real.
fc9fb3e5a3WIP: Token handling for authorization.
7c79f1922cCopyright of source header -> 2020.
fadbfeb2c4WIP: MagicFilter, currentFilter, favorites, UserPrefCache/Dao...
8d0def4e16WicketSupport for Kotlin based SpringBeans improved.
dc4db8a8ebWorkaround for Wicket-SpringBean issue: KotlinComponents and WicketSupport classes added as hot-fix for the de-migration phase of Wicket.
3f7eb5ee93UserPrefCache: class must be declared as open (Wicket tries to proxy this class).
a7bc98bddbJson serialization: UtilDateConverter re-used for ToString, Rest and UserPrefDao. WIP: UserPrefCache...
523ce3c901New UserPrefCache seems to work now, ready to fly...
31f0b32b5fWIP: UserPrefs...
747bfa24cfWIP: UserPrefCache: support of json serialízation and deserialization.