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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.internet.entity.InternetWidget;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractInternetWidgetSearch {

  @Inject
  protected transient InternetWidgetExtendedDAO dao;

  public AbstractInternetWidgetSearch() {
    super();
  }

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

  protected abstract List<InternetWidget> querySearchResult(InternetWidgetSearchParameters searchParameters);

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