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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.kandidatur.entity.Listenkandidatur;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractListenkandidaturSearch {

  @Inject
  protected transient ListenkandidaturExtendedDAO dao;

  public AbstractListenkandidaturSearch() {
    super();
  }

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

  protected abstract List<Listenkandidatur> querySearchResult(ListenkandidaturSearchParameters searchParameters);

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