#1028: VisitorbookDao.kt

projectforge-business/src/main/kotlin/org/projectforge/business/orga/VisitorbookDao.kt DAO (Visitorbook), projectforge-business/src/main/kotlin/org/projectforge/business/orga/VisitorbookDao.kt 88 lines · 55 code · 23 comments · 10 blank
DAO for visitorbook master records. Extends BaseDao with custom select sorting (by last visit date descending) and history integration. Uses entity graph to eagerly load contact persons.

Design

QueryFilter Customization

Overrides createQueryFilter to set ENTITY_GRAPH_WITH_CONTACT_EMPLOYEES entity graph, ensuring contact persons are eagerly fetched when listing visitorbooks.

Custom Sorting

Overrides select to default-sort results by lastDateOfVisit descending when no explicit sort is specified, using the VisitorbookCache. This puts recently visited books at the top of lists.

History Integration

Overrides getHistoryPropertyPrefix to return the entry's dateOfVisit as prefix for child entry history entries. Also handles delegation of visitorbook ID tracking via HistoryFormatUtils.

Service Wiring

Uses @PostConstruct to inject itself into VisitorbookService.visitorbookDao, enabling the service layer to delegate to the DAO.

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
27a5e6cad Visitorbook: bugfix on contactPersons.
3390a7f09 WIP: History entries handling. VisitorBook.
18bf92219 WIP: History entries handling. VisitorBookDao.