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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.kandidatur.entity.Direktkandidatur;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractDirektkandidaturSearch {

  @Inject
  protected transient DirektkandidaturExtendedDAO dao;

  public AbstractDirektkandidaturSearch() {
    super();
  }

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

  protected abstract List<Direktkandidatur> querySearchResult(DirektkandidaturSearchParameters searchParameters);

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