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

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

import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.business.wahlvorschlag.boundary.ListeConversationSelect;
import de.ivu.elect.business.wahlvorschlag.entity.Liste;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;

@Named(ListeDeleteAction.COMPONENT_NAME)
public class ListeDeleteAction extends AbstractListeAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "listeDeleteAction";

  @Inject
  private transient ListeConversationSelect listeConversationSelect;

  public ListeDeleteAction() {
    super();
  }

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

  @Override
  protected AbstractGebietSecurity getGebietSecurity() {
    return getBearbeitenGebietSecurity();
  }

  @Override
  protected boolean isDisabledInternal(Liste liste) {
    return false;
  }

  @Override
  protected String doIt(Liste entity) {
    listeConversationSelect.setEntity(entity);

    // Return to current page and display the dialog!
    return null;
  }

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

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

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

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