
package de.ivu.elect.presentation.system.action;

import javax.annotation.Nonnull;
import javax.inject.Inject;
import javax.inject.Named;

import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.business.system.entity.SystemLog;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.system.SystemLogEditView;

@Named(SystemLogDeleteAction.COMPONENT_NAME)
public class SystemLogDeleteAction extends AbstractSystemLogAction {

  public static final String COMPONENT_NAME = "systemLogDeleteAction";

  private static final long serialVersionUID = 1L;

  @View
  @Inject
  private transient SystemLogEditView systemLogEditView;

  @Override
  public boolean isDisabledInternal(@Nonnull SystemLog entity) {
    return false;
  }

  @Override
  public String getLabelKey() {
    return "entity.edit.action.delete";
  }

  @Override
  public String getDialogName() {
    return "DeleteConfirm";
  }

  @Override
  public String getIcon() {
    return appIcons.getIconDelete();
  }

  @Override
  protected String doIt(SystemLog entity) {
    systemLogEditView.setEntity(entity);
    return null;
  }

  @Override
  protected UseCasePermission getRequiredPermission() {
    return UseCasePermission.SYSTEM_LOG_DELETE;
  }

  @Override
  protected boolean isFireChangeEvent() {
    return true;
  }
}
