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

import javax.annotation.Nullable;

import org.primefaces.event.SelectEvent;

import de.ivu.elect.business.kandidatur.entity.Kandidatur;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;

public class KandidaturEditAction extends AbstractKandidaturAction {

  private static final long serialVersionUID = 1L;

  public KandidaturEditAction() {
    super();
  }

  @Override
  protected UseCasePermission getRequiredPermission() {
    throw new IllegalStateException(); // ersetzt durch hasPrincipalRequiredPermission()
  }

  @Override
  public boolean hasPrincipalRequiredPermission() {
    return false; // in core: keine Doppelklick-Aktion für Kandidaturen
  }

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

  @Override
  public void onRowDblselect(SelectEvent event) {
    // in core: keine Doppelklick-Aktion für Kandidaturen
  }

  @Override
  @Nullable
  public String doIt(Kandidatur kandidatur) {
    throw new UnsupportedOperationException("This may ONLY be used as an onRowDblSelect-action!");
  }

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

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