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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.mandant.entity.Mandant;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractMandantSearch {

  @Inject
  protected transient MandantExtendedDAO dao;

  public AbstractMandantSearch() {
    super();
  }

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

  protected abstract List<Mandant> querySearchResult(MandantSearchParameters searchParameters);

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