
package de.ivu.elect.presentation.wahlrechtspruefung.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.wahlrechtspruefung.entity.Pruefkriterium;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.wahlrechtspruefung.PruefkriteriumEditView;

@Named(PruefkriteriumEditAction.COMPONENT_NAME)
public class PruefkriteriumEditAction extends AbstractPruefkriteriumAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "pruefkriteriumEditAction";

  @View
  @Inject
  private transient PruefkriteriumEditView pruefkriteriumEditView;

  public PruefkriteriumEditAction() {
    super();
  }

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

  @Override
  public boolean isDisabledInternal(@Nonnull Pruefkriterium pruefkriterium) {
    return false;
  }

  @Override
  protected String doIt(Pruefkriterium pruefkriterium) {
    return pruefkriteriumEditView.edit(pruefkriterium);
  }

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

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