#1042: PurgeCalendarEntriesJob.kt

projectforge-business/src/main/kotlin/org/projectforge/business/privacyprotection/PurgeCalendarEntriesJob.kt Privacy Job (Calendar Purge), projectforge-business/src/main/kotlin/org/projectforge/business/privacyprotection/PurgeCalendarEntriesJob.kt 120 lines · 80 code · 28 comments · 12 blank
Implements IPrivacyProtectionJob to delete calendar events older than a configurable number of days. Configured via JSON property projectforge.privacyProtection.purgeCalendars specifying calendar IDs and expiry days. Typically used to auto-purge illness calendars.

Architecture

Configuration

Reads purgeCalendars property as a JSON array of {calendarId, expiryDays} objects via JsonUtils.fromJson. On @PostConstruct, parses the config and registers itself with CronPrivacyProtectionJob. Handles parsing errors gracefully with error logging.

Execution

For each configured calendar:

  1. Loads the calendar via TeamCalDao.find(calendarId, checkAccess=false).
  2. Computes expiryDate = now - expiryDays.
  3. Runs a named query SELECT_ENTRIES_IN_THE_PAST_TO_PURGE in a transaction to find events ending before the expiry date.
  4. Force-deletes each event via TeamEventDao.forceDelete(event, checkAccess=false), also removing history entries (commit c3a3a7476).

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
1b50060c3 BaseDao: renamed: get -> find.
87aaf6a5a Migration stuff in progress...
3aeda5ef5 Big change: all save|update|...InTrans renamed.
1135ccbca Persistence: functions renamed: *NewTrans -> *InTrans
b095e6f7d !!!!! Big change of Transaction handling.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022
c3a3a7476 PurgeCalendarEntriesJob deletes now also history entries.
f491ef05c PROJECTFORGE-3690: SkillMatrixPrivacyProtectionJob.
534dab9cd PROJECTFORGE-3687: CronPrivacyProtectionJob implemented.