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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.wertelisten.entity.Wertelisten;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractWertelistenSearch {

  @Inject
  protected transient WertelistenExtendedDAO dao;

  public AbstractWertelistenSearch() {
    super();
  }

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

  protected abstract List<Wertelisten> querySearchResult(WertelistenSearchParameters searchParameters);

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