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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.niederschrift.entity.Niederschrift;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractNiederschriftSearch {

  @Inject
  protected transient NiederschriftExtendedDAO dao;

  public AbstractNiederschriftSearch() {
    super();
  }

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

  protected abstract List<Niederschrift> querySearchResult(NiederschriftSearchParameters searchParameters);

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