
package de.ivu.elect.presentation.wahl.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.wahl.entity.WahlParameter;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.wahl.WahlParameterEditView;

@Named(WahlParameterEditAction.COMPONENT_NAME)
public class WahlParameterEditAction extends AbstractWahlParameterAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "wahlParameterEditAction";

  @View
  @Inject
  private WahlParameterEditView wahlParameterEditView;

  public WahlParameterEditAction() {
    super();
  }

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

  @Override
  protected boolean isDisabledInternal(@Nonnull WahlParameter wahlParameter) {
    return false;
  }

  @Override
  protected String doIt(WahlParameter wahlParameter) {
    return wahlParameterEditView.edit(wahlParameter);
  }

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

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

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