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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.wahlvorschlag.entity.Liste;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractListeSearch {

  @Inject
  protected transient ListeExtendedDAO dao;

  public AbstractListeSearch() {
    super();
  }

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

  protected abstract List<Liste> querySearchResult(ListeSearchParameters searchParameters);

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