Here is the French translation of the provided HTML, with all tags preserved, `lang="fr"` set, and the FR link marked as active. The title includes `[FR]`. ```html #262 : SkillMatrixPrivacyProtectionJob.kt [FR]
EN · DE · RU · FR · ES

#262 : SkillMatrixPrivacyProtectionJob.kt

plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillMatrixPrivacyProtectionJob.kt Type : Kotlin · Rôle : Enregistrement de plugin · Source : plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillMatrixPrivacyProtectionJob.kt 79 lignes · 44 code · 26 commentaires · 9 vides
Tâche planifiée/système pour SkillMatrixPrivacyProtection. Implémente une logique de maintenance périodique ou de vérification de cohérence exécutée par le planificateur de tâches PF.

Structure du code

Annotations : PostConstruct, micromata, Service, author, Autowired

Classes : SkillMatrixPrivacyProtectionJob

Supertype(s) : IPrivacyProtectionJob

Fonctions (2) : postConstruct, execute

Propriétés (6) : persistenceService, purgeCronPrivacyProtectionJob, userDao, date, lastUpdate, counter

Importations : 9 paquetages

Paquetage : org.projectforge.plugins.skillmatrix

Code source (abrégé)

package org.projectforge.plugins.skillmatrix

import jakarta.annotation.PostConstruct
import mu.KotlinLogging
import org.projectforge.business.privacyprotection.CronPrivacyProtectionJob
import org.projectforge.business.privacyprotection.IPrivacyProtectionJob
import org.projectforge.business.user.UserDao
import org.projectforge.framework.persistence.jpa.PfPersistenceService
import org.projectforge.framework.time.PFDateTime
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

private val log = KotlinLogging.logger {}

/**
 *
 * @author Kai Reinhard (k.reinhard@micromata.de)
 */
@Service
class SkillMatrixPrivacyProtectionJob : IPrivacyProtectionJob {
    @Autowired
    private lateinit var persistenceService: PfPersistenceService

    @Autowired
    private lateinit var purgeCronPrivacyProtectionJob: CronPrivacyProtectionJob

    @Autowired
    private lateinit var userDao: UserDao

    @PostConstruct
    private fun postConstruct() {
        purgeCronPrivacyProtectionJob.register(this)
    }

    override fun execute() {
        val date = PFDateTime.now().minusMonths(3L)
        log.info("Purge des entrées de la matrice de compétences des partants (utilisateurs supprimés/désactivés avec lastUpdate < ${date.isoString}Z)...")

        userDao.selectAll(checkAccess = false).forEach { user ->
            if (user.deactivated || user.deleted) {
                val lastUpdate = user.lastUpdate
                if (lastUpdate != null && lastUpdate < date.utilDate) {
                    val counter = persistenceService.runInTransaction { context ->
                        context.executeNamedUpdate(
                            SkillEntryDO.DELETE_ALL_OF_USER, Pair("userId", user.id)
                        )
                    }
                    if (counter > 0) {
                        log.info { "$counter entrées supprimées de la matrice de compétences de l'utilisateur '${user.username}' avec l'id ${user.id}." }
                    }
                }
            }
        }
        log.info("Purge des entrées de la matrice de compétences terminée.")
    }
}

Historique Git

868d6abb7 2025 -> 2026
63081666f En-têtes des fichiers source : 2024 -> 2025.
1b50060c3 BaseDao : renommé : get -> find, save -> insert, getList -> select, load -> select
2a8ea2076 Migration en cours... BaseDao refactorisé (pas encore terminé) méthodes internes* renommées.
108ecf629 !!!!! Gros changement dans la gestion des transactions : Réutilise PfPersistenceContext autant que possible (pas encore terminé). Les tests ne s'exécutent pas encore. Transactions en lecture seule supprimées dans PfPersistenceService, opérations d'écriture de PfPersistenceService supprimées.