#1014: HRPlanningDao.kt

projectforge-business/src/main/kotlin/org/projectforge/business/humanresources/HRPlanningDao.kt DAO (HR Planning), projectforge-business/src/main/kotlin/org/projectforge/business/humanresources/HRPlanningDao.kt 305 lines · 220 code · 58 comments · 27 blank
Data Access Object for HR week planning. Extends BaseDao, providing CRUD operations, Hibernate Search indexing, access control, and history integration for employee weekly resource planning entries.

Architecture

Access Control

Implements fine-grained write access checking beyond the standard USER_RIGHT_ID check. On insert/update, verifies that the logged-in user has project-specific rights for each HR planning entry. Users must be either the project manager, head of business manager, sales manager, or a member of the project manager group to modify entries for a given project. This is enforced via afterDBWrite which iterates all entries and validates permissions before commit.

History Integration

Overrides addOwnHistoryEntries to merge history entries from child HRPlanningEntryDO objects. Uses HistoryFormatUtils.setNumberAsPropertyNameForListEntries to prefix each entry's history with the project name or status, making history diffs readable.

Hibernate Search

Defines additional search fields (ADDITIONAL_SEARCH_FIELDS) for full-text search across entries' project name, customer name, and user details. Registers HRPlanningEntryDO as an additional search entity via additionalHistorySearchDOs.

Performance

Overrides prepareHibernateSearch to eagerly initialize lazy-loaded project fields (project manager group) before Hibernate Search indexing, preventing N+1 queries during search index updates.

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
18bf92219 WIP: History entries handling. VisitorBookDao.
bbc198d03 Migration stuff in progress... (all tests of all packages: OK).