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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.konfiguration.entity.Konfiguration;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractKonfigurationSearch {

  @Inject
  protected transient KonfigurationExtendedDAO dao;

  public AbstractKonfigurationSearch() {
    super();
  }

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

  protected abstract List<Konfiguration> querySearchResult(KonfigurationSearchParameters searchParameters);

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