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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.gruppe.entity.Gruppe;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractGruppeSearch {

  @Inject
  protected transient GruppeExtendedDAO dao;

  public AbstractGruppeSearch() {
    super();
  }

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

  protected abstract List<Gruppe> querySearchResult(GruppeSearchParameters searchParameters);

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