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

import javax.annotation.Nonnull;

import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.menu.AbstractActionEntry;
import de.ivu.elect.presentation.personenregister.AbstractEntityMitPersonendatenSearchResultEntry;
import de.ivu.elect.presentation.personenregister.AbstractEntityMitPersonendatenSelectionView;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;

public class EntityMitPersonendatenSearchResultEntryAuswaehlenAction extends AbstractActionEntry<AbstractEntityMitPersonendatenSearchResultEntry> {

  private static final long serialVersionUID = 1L;

  private AbstractEntityMitPersonendatenSelectionView selectionView;

  public EntityMitPersonendatenSearchResultEntryAuswaehlenAction() {
    super();
  }

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

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

  @Override
  public boolean isDisabledInternal(@Nonnull AbstractEntityMitPersonendatenSearchResultEntry searchResultEntry) {
    return false;
  }

  public AbstractEntityMitPersonendatenSelectionView getSelectionView() {
    return selectionView;
  }

  public void setSelectionView(AbstractEntityMitPersonendatenSelectionView personenregisterPersonendatenSelectionView) {
    this.selectionView = personenregisterPersonendatenSelectionView;
  }

  @Override
  protected String doIt(AbstractEntityMitPersonendatenSearchResultEntry searchResultEntry) {
    return getSelectionView().goToOnSelectionView(searchResultEntry);
  }

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

  @Override
  protected void fireChangeEvent() {
    // Do nothing.
  }

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

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