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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.datei.entity.DateiImport;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractDateiImportSearch {

  @Inject
  protected transient DateiImportExtendedDAO dao;

  public AbstractDateiImportSearch() {
    super();
  }

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

  protected abstract List<DateiImport> querySearchResult(DateiImportSearchParameters searchParameters);

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