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

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

import de.ivu.elect.business.kandidatur.boundary.DirektkandidaturConversationSelect;
import de.ivu.elect.business.kandidatur.entity.Direktkandidatur;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.kandidatur.EinzelkandidaturEditView;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;

@Named(EinzelkandidaturEditAction.COMPONENT_NAME)
public class EinzelkandidaturEditAction extends AbstractEinzelkandidaturAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "einzelkandidaturEditAction";

  @Inject
  private transient DirektkandidaturConversationSelect direktkandidaturConversationSelect;

  public EinzelkandidaturEditAction() {
    super();
  }

  @Override
  public UseCasePermission getRequiredPermission() {
    return UseCasePermission.DIREKTKANDIDATUR_EDIT;
  }

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

  @Override
  protected String doIt(Direktkandidatur entity) {
    direktkandidaturConversationSelect.setEntity(entity);

    return EinzelkandidaturEditView.VIEW_ID;
  }

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

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