/*
* Template-File src/main/takatuka/templates/EntityAbstractSearch.vm
*/
package de.ivu.elect.business.kandidatenportal.boundary;

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.kandidatenportal.entity.WvpBenutzer;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractWvpBenutzerSearch {

  @Inject
  protected transient WvpBenutzerExtendedDAO dao;

  public AbstractWvpBenutzerSearch() {
    super();
  }

  public List<WvpBenutzer> getSearchResult(WvpBenutzerSearchParameters searchParameters, EagerLoadingCollector<WvpBenutzer> eagerLoadingCollector) {
    return eagerLoadingCollector.eagerLoad(querySearchResult(searchParameters));
  }

  protected abstract List<WvpBenutzer> querySearchResult(WvpBenutzerSearchParameters searchParameters);

  protected String convertSearchPattern(String patternInput) {
    return new WildcardConverter().addAndConvertToJpqlLikeExpression(patternInput);
  }
}
