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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.stimmzettel.entity.Stimmzettel;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractStimmzettelSearch {

  @Inject
  protected transient StimmzettelExtendedDAO dao;

  public AbstractStimmzettelSearch() {
    super();
  }

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

  protected abstract List<Stimmzettel> querySearchResult(StimmzettelSearchParameters searchParameters);

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