#930: EmployeeServiceSupport.kt

projectforge-business/src/main/kotlin/org/projectforge/business/fibu/EmployeeServiceSupport.kt Type: Spring Service (internal) · Purpose: Internal implementation of EmployeeService — validation, persistence, and lookup logic for time-dependent attributes · Path: projectforge-business/src/main/kotlin/org/projectforge/business/fibu/EmployeeServiceSupport.kt 418 lines · 304 code · 88 comments · 26 blank
The implementation engine behind EmployeeService. Marked internal — not accessible outside the fibu package. Contains all the actual logic for querying, validating, inserting, updating, soft-deleting, and undeleteing EmployeeValidSinceAttrDO entries. Also resolves current attribute values (annual leave, weekly hours, status) from the validity-period entries.

Architecture & Design

Dependencies

DependencyRole
BaseDOPersistenceServiceGeneric CRUD operations (insert, update, markAsDeleted, undelete) with access-check support.
EmployeeCacheInvalidated after every mutation (setExpired()) to force cache refresh.
EmployeeDaoEntity lookup and access-check delegation (checkLoggedInUserSelectAccess, checkLoggedInUserInsertAccess, checkLoggedInUserUpdateAccess).
PfPersistenceServiceDirect query execution for ValidSinceAttr lookups and validations.

Query Methods

Active Entry Resolution (getActiveEntry)

The getActiveEntry(entries, validAtDate) method solves a key business problem: given a list of ValidSinceAttr entries with validSince dates, find the one that is currently applicable at a given point in time. Algorithm:

  1. Iterate all non-deleted entries.
  2. For each entry where validAtDate >= entry.validSince, compare to the best-found-so-far.
  3. Select the entry with the latest validSince that is still before/on the reference date.

This supports historical lookups — asking "what was the annual leave for employee X on date Y" — which is critical for accurate reporting.

Validation Logic (validate)

Before insert or update, the system checks if another ValidSinceAttr exists with the same (employee, type, validSince) combination:

CRUD Operations

Concrete Value Getters

All return null if employee or validAtDate is null (for test compatibility with CallAllPagesTest/Wicket).

Git History

868d6abb7 2025 -> 2026
28efde264 Employee: weeklyWorkingHours now as time-dependent attr. eintritt/austritt: timestamp -> date
63081666f Source file headers: 2024-> 2025.
5f9bbfbd3 Fix typos in projectforge-business directory
4ae4f3ea3 Bugfixes while going-live...
b5dc26e24 Migration stuff in progress... (all tests of all packages: OK).
b0efaddc2 Migration stuff in progress... (all tests of all packages: OK).
6aca64431 Migration stuff in progress... (all tests of all packages: OK).