
package de.ivu.elect.presentation.konfiguration;

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

import de.ivu.elect.business.konfiguration.boundary.KonfigurationSearchParameters;
import de.ivu.elect.business.konfiguration.entity.Konfiguration;
import de.ivu.elect.jee.presentation.dynamicform.FormBuilder;
import de.ivu.elect.presentation.hilfe.OnlineHilfeId;
import de.ivu.elect.presentation.konfiguration.form.KonfigurationSearchFormBuilder;
import de.ivu.elect.presentation.security.AbstractGebietSecurityFilter;

@OnlineHilfeId(value = "353", mehrfachVergebenOk = true)
@Named(AbstractKonfigurationSearchView.COMPONENT_NAME)
public class KonfigurationSearchView extends AbstractKonfigurationSearchView {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient KonfigurationSearchFormBuilder konfigurationSearchFormBuilder;

  public KonfigurationSearchView() {
    super();
  }

  @Override
  public int getDefaultPageSize() {
    return getPageSizeShowAll();
  }

  @Override
  protected AbstractGebietSecurityFilter<Konfiguration> getGebietSecurityFilter() {
    return KEIN_GEBIET_SECURITY_FILTER;
  }

  @Override
  public void addProperties(FormBuilder formBuilder) {
    konfigurationSearchFormBuilder.addProperties(formBuilder, getSearchParameters());
  }

  @Override
  public KonfigurationSearchParameters getSearchParameters() {
    KonfigurationSearchParameters searchParameters = super.getSearchParameters();
    searchParameters.setMandant(getMandant());
    return searchParameters;
  }

  @Override
  public void presetSearchParameters() {
    // Do nothing
  }

  @Override
  public void resetSearchParametersModel() {
    // Do nothing
  }

  @Override
  public boolean isBtnGoBackRendered() {
    return super.isBtnGoBackRendered() || viewStackContainsOtherViewsAndShouldNotReset();
  }
}
