
package de.ivu.elect.presentation.system;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import de.ivu.elect.business.system.boundary.SystemLogChangeEvent;
import de.ivu.elect.business.system.entity.SystemLog;
import de.ivu.elect.jee.faces.FacesContextUtil;
import de.ivu.elect.jee.presentation.dynamicform.FormBuilder;
import de.ivu.elect.jee.presentation.redirect.Redirect;
import de.ivu.elect.presentation.hilfe.OnlineHilfeId;

@OnlineHilfeId(value = "352", mehrfachVergebenOk = true)
@Named(AbstractSystemLogEditView.COMPONENT_NAME)
public class SystemLogEditView extends AbstractSystemLogEditView {

  private static final long serialVersionUID = 1L;


  @Inject
  private transient SystemLogChangeEvent changeEvent;

  @Redirect
  public String pruefAll() {
    edit.pruefAll(getMandant());

    addInfoMessage("entity.edit.action.check.success.message", entityMeta.getMehrzahlMessage());
    changeEvent.sendChangeEvent(); // ELECT-5585
    return FacesContextUtil.getCurrentViewId();
  }

  @Redirect
  public String deleteAll() {
    edit.deleteAll(getMandant());

    addInfoMessage("entity.edit.action.delete.success.message", entityMeta.getMehrzahlMessage());
    changeEvent.sendChangeEvent(); // ELECT-5585
    return FacesContextUtil.getCurrentViewId();
  }


  @Redirect
  public String pruefSearched(List<SystemLog> systemLogList) {
    edit.pruefSearched(systemLogList);

    addInfoMessage("entity.edit.action.check.success.message", entityMeta.getMehrzahlMessage());
    changeEvent.sendChangeEvent(); // ELECT-5585
    return FacesContextUtil.getCurrentViewId();
  }

  @Redirect
  public String deleteSearched(List<SystemLog> systemLogList) {
    edit.deleteSearched(systemLogList);

    addInfoMessage("entity.edit.action.delete.success.message", entityMeta.getMehrzahlMessage());
    changeEvent.sendChangeEvent(); // ELECT-5585
    return FacesContextUtil.getCurrentViewId();
  }



  @Override
  public void addProperties(FormBuilder formBuilder, SystemLog systemLog) {
    // keine Felder zum Bearbeiten vorhanden
  }

  @Override
  protected boolean isGebietBearbeitenRechtPruefen() {
    return false;
  }
}
