#1126: UserPrefDao.kt

projectforge-business/src/main/kotlin/org/projectforge/business/user/UserPrefDao.kt Data Access Object, projectforge-business/src/main/kotlin/org/projectforge/business/user/UserPrefDao.kt 750 lines · 587 code · 102 comments · 61 blank
DAO for user preference persistence, providing CRUD operations on UserPrefDO and UserPrefEntryDO entities with area-based scoping.

Architecture

Inheritance

Extends BaseDao. Provides getUserPrefs(user, area), getEntry(user, area, key), saveEntry() for preference persistence.

Area Scoping

All queries are scoped by UserPrefArea to prevent cross-area key collisions. Preferences are organized as UserPrefDO (container) → UserPrefEntryDO (individual entries).

Design Rationale

Two-level structure (DO → EntryDO) enables atomic loading of all preferences for an area while keeping individual entry updates lightweight.

Architecture Analysis

Resides in projectforge-business, the core module containing domain logic, services, and persistence. Defines a fixed set of named constants, often implementing I18nEnum for internationalized display labels.

Git History

CommitWhat changed
868d6abb752025 -> 2026
e2061d7db0UserPrefDao: Suppress error log on old TimesheetPrefData. Login handling improved: redirect to origin url after login.
63081666f6Source file headers: 2024-> 2025.
0237d5eba9Json serialization refactored: IdOnlySerializer and IdsOnlySerializer introduced.
43453fcafeMigration stuff in progress...
811041325eMigration stuff in progress...
f7d7ff851fMigration stuff in progress... (all tests of all packages: OK).
011000f03dMigration stuff in progress... (all tests of all packages: OK).
4d58829ccdUserPrefCache and UserXmlPreferencesCache refactored.
d67bce18b9Migration stuff in progress...
5989b32fdbBaseDao: mechanism of onChangeLister refactored.
1b50060c3aBaseDao: renamed: get -> find, save -> insert, getList -> select, load -> select
87aaf6a5a5Migration stuff in progress... BaseDao refactored (not yet finished) internal* methods renamed.
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).
85b4e11758PfPersistenceService and PfPersistenceContext: query renamed to executeQuery.
9de3436296Migration stuff in progress...
384da53decMigration stuff in progress...
f7f5ad4d36UserPrefDao -> Kotlin.