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

import javax.inject.Inject;

import de.ivu.elect.business.system.boundary.SystemLogWriter;
import de.ivu.elect.business.system.entity.SystemLogQuelle;
import de.ivu.elect.business.system.entity.SystemLogStoreEntry;
import de.ivu.elect.jee.faces.Messages;
import de.ivu.elect.jee.startup.PostStartup;

public class ElectDbInitializerSystemLogPostStartup implements PostStartup {

  @Inject
  private transient SystemLogWriter systemLogWriter;

  @Inject
  private transient ElectDbInitializerSystemLogStore logStore;

  @Inject
  private transient Messages messages;

  @Override
  public void postStartup() {
    for (SystemLogStoreEntry systemLogStoreEntry : logStore.getEntryList()) {
      systemLogStoreEntry.getType().write(systemLogWriter, messages.getMessageForMessageKey(systemLogStoreEntry.getMessageKey(), systemLogStoreEntry.getParams()), SystemLogQuelle.SYSTEM);
    }
  }
}
