
package de.ivu.elect.presentation.geodata;

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

import de.ivu.elect.business.geodata.entity.GeodataOrt;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.dynamicform.FormBuilder;
import de.ivu.elect.presentation.geodata.table.GeodataOrtColumnBuilder;
import de.ivu.elect.presentation.hilfe.OnlineHilfeId;
import de.ivu.elect.presentation.security.AbstractGebietSecurityFilter;

@OnlineHilfeId(value = "476", mehrfachVergebenOk = true)
@Named(AbstractGeodataOrtSearchView.COMPONENT_NAME)
public class GeodataOrtSearchView extends AbstractGeodataOrtSearchView {

  private static final long serialVersionUID = 1L;

  @Inject
  private GeodataOrtColumnBuilder geodataOrtColumnBuilder;

  public GeodataOrtSearchView() {
    super();
  }

  @Override
  public EagerLoadingCollector<GeodataOrt> getEagerLoadingCollector() {
    EagerLoadingCollector<GeodataOrt> eagerLoadingCollector = super.getEagerLoadingCollector();

    geodataOrtColumnBuilder.collectEagerLoadings(eagerLoadingCollector);

    return eagerLoadingCollector;
  }

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

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

  @Override
  public void addProperties(FormBuilder formBuilder) {
    formBuilder.addProperty(searchParameters.getOrtsnameProperty());
    formBuilder.addProperty(searchParameters.getOrtsteilnameProperty());
    formBuilder.addProperty(searchParameters.getPlzProperty());
  }

}
