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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.gebietsbaum.entity.Gebietsart;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractGebietsartSearch {

  @Inject
  protected transient GebietsartExtendedDAO dao;

  public AbstractGebietsartSearch() {
    super();
  }

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

  protected abstract List<Gebietsart> querySearchResult(GebietsartSearchParameters searchParameters);

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