
package de.ivu.elect.business.system.control.files;

import javax.enterprise.event.Observes;
import javax.enterprise.event.Reception;
import javax.enterprise.event.TransactionPhase;
import javax.inject.Inject;

import de.ivu.elect.business.konfiguration.entity.ElectKonfigurationWerte;
import de.ivu.elect.business.konfiguration.entity.KonfigurationWertGeaendertEvent;

public class FileCleanupCronTimerKonfigurationWertGeaendertTimerEventListener {

  @Inject
  private transient FileCleanupCronTimer cronTimer;

  public FileCleanupCronTimerKonfigurationWertGeaendertTimerEventListener() {
    super();
  }

  public void listen(@Observes(during = TransactionPhase.AFTER_COMPLETION, notifyObserver = Reception.ALWAYS) KonfigurationWertGeaendertEvent konfigurationWertGeaendertEvent) {
    if (ElectKonfigurationWerte.ELECT_COMMON_DATEI_CLEANUP_CRON_TIMER.equals(konfigurationWertGeaendertEvent.getKey())) {
      cronTimer.createTimer(konfigurationWertGeaendertEvent.getNeuerWert());
    }
  }
}
