
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;
import de.ivu.elect.presentation.wahlvorschlag.ListeEditView;

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

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "listeEditAction";

  @Inject
  private transient ListeConversationSelect listeConversationSelect;

  public ListeEditAction() {
    super();
  }

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

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

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

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

    return ListeEditView.VIEW_ID;
  }

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

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