#929: EmployeeService.kt

projectforge-business/src/main/kotlin/org/projectforge/business/fibu/EmployeeService.kt Type: Spring Service / Business Logic · Purpose: Public-facing employee business logic — active status checks, time-dependent attributes, monthly reports · Path: projectforge-business/src/main/kotlin/org/projectforge/business/fibu/EmployeeService.kt 445 lines · 308 code · 96 comments · 41 blank
The primary public API for employee business logic. Serves as the façade over EmployeeServiceSupport (internal implementation), EmployeeDao, EmployeeCache, and TimesheetDao. Exposed as a singleton via EmployeeService.instance. Registers a history adapter for EmployeeValidSinceAttrDO on initialization.

Architecture & Design

Dependencies & Initialization

DependencyRole
PfCachesAccess to UserGroupCache for user resolution (used in isEmployeeActive()).
EmployeeDaoEntity lookup and select operations. Circular dependency resolved: EmployeeService sets itself on EmployeeDao.employeeService during @PostConstruct.
EmployeeServiceSupportInternal service containing the actual implementation logic (validation, insert, update, find). Marked internal visibility.
HistoryFormatServiceRegisters EmployeeValidSinceAttrHistoryAdapter for history rendering of time-dependent attributes.
TimesheetDaoUsed by getReportOfMonth() to aggregate timesheet data per employee/month.

Active-Status Logic

isEmployeeActive(employee, showRecentlyLeavers): Returns true if:

Time-Dependent Attribute Methods

All time-dependent methods iterate through ValidSinceAttrDO entries sorted by validSince DESC and select the entry whose validSince is on or before the reference date. Methods are organized by attribute type:

ValidSinceAttr CRUD Operations

The service provides a complete CRUD surface for EmployeeValidSinceAttrDO:

Monthly Employee Report

getReportOfMonth(year, month, user) creates a MonthlyEmployeeReport, initializes date boundaries, queries timesheets via TimesheetFilter for the given user and month range, adds each timesheet (with access-check info), and calculates aggregated durations by Kost2.

Git History

868d6abb7 2025 -> 2026
7893cea1e Selection of User/Employee improved. EmployeeService.selectAllActive returns now sorted list.
7cdc06ad7 MonthlyEmployeeReport[Week] -> Kotlin
feb661d79 Employee: displaying history for time attrs
28efde264 Employee: weeklyWorkingHours now as time-dependent attr.
63081666f Source file headers: 2024-> 2025.
4ae4f3ea3 Bugfixes while going-live...
ddf02927d Migration stuff in progress...
4942c854d Migration stuff in progress...
b71b5073d Migration stuff in progress... (all tests of all packages: OK).
ffb18cf8f Migration stuff in progress...
1012e347a Migration stuff in progress... (all tests of all packages: OK).
e74d3655b Migration stuff in progress...
6aca64431 Migration stuff in progress... (all tests of all packages: OK).
016699665 Migration stuff in progress...
8bd78b145 Migration stuff in progress... (all tests of all packages: OK).
ac2dbb269 Migration stuff in progress...
4b9ffbee2 Migration stuff in progress... (all tests of all packages: OK).
e80642c81 Migration stuff in progress... (all tests of all packages: OK).
1204b927b Migration stuff in progress... (all tests of all packages: OK).
9e38d3c0d Migration stuff in progress...
84e863624 Migration stuff in progress... (all tests of all packages: OK).
b79a1edca Migration stuff in progress... (all tests of all packages: OK).
d67bce18b Migration stuff in progress...
6f7e0fbc7 Migration stuff in progress...
1b50060c3 BaseDao: renamed: get -> find, save -> insert, getList -> select, load -> select
87aaf6a5a Migration stuff in progress... BaseDao refactored.
1faf30810 Migration stuff in progress...
3aeda5ef5 Big change: all save|update|...InTrans renamed.
85b4e1175 PfPersistenceService and PfPersistenceContext: query renamed to executeQuery.
b095e6f7d Big change of Transaction handling.
f59810cf0 Migration stuff in progress...
4c04cfd65 MAJOR-CHANGE! Migration of integer id's to Long id's
d54f93842 EmployeeServiceImpl -> EmployeeService.