#1309: HistoryFormatUtils.kt

projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/history/HistoryFormatUtils.kt Spring Service / Utility, projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/history/HistoryFormatUtils.kt 198 lines · 118 code · 64 comments · 16 blank
Spring @Service providing formatting utilities for history display. Translates group/user ID lists into human-readable names, handles property name translation via i18n, formats embedded collection entries with positional prefixes (e.g., pos#1:propertyName), and processes DisplayHistoryEntry objects for frontend rendering.

Architecture

ID-to-Name Resolution

Injects GroupService and UserService to resolve ID lists into sorted, comma-separated names:

Property Name Handling

MethodDescription
getPlainPropertyName(attr)Strips internal format; delegates to HistoryOldFormatConverter if outdated
translatePropertyName(clazz, propertyName)Looks up @PropertyInfo annotation for i18n key, translates it, or returns raw name

Embedded Collection Formatting

Used for list-type properties (e.g., AuftragDO.positionen) to show positional context in history:

getPropertyNameForEmbedded(propertyName, "pos", 1) → "pos#1" or "pos#1:propertyName"
getPropertyNameForEmbedded(propertyName, Pair("pos", 1), Pair("kost1", 3)) → "pos#1.kost1#3:propertyName"

Batch Operations

Formatting Pipeline

  1. HistoryOldFormatConverter.getPlainPropertyName() — normalizes legacy format
  2. translatePropertyName() — i18n translation via @PropertyInfo annotation
  3. replaceGroupAndUserIdsValues() — resolves ID lists to names
  4. setNumberAsPropertyNameForListEntries() — prefixes position numbers

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
18bf92219 WIP: History entries handling. VisitorBookDao.
9e3c523c7 Migration stuff in progress... (all tests OK).
c97135a57 Migration stuff in progress...
f408da8a8 Migration stuff in progress... (all tests OK).
d18c899b5 Refactoring of history entries, FlatDisplayHistoryEntries and DisplayHistoryEntries...
b79a1edca Migration stuff in progress... (all tests OK).