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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.email.entity.EmailLayout;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractEmailLayoutSearch {

  @Inject
  protected transient EmailLayoutExtendedDAO dao;

  public AbstractEmailLayoutSearch() {
    super();
  }

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

  protected abstract List<EmailLayout> querySearchResult(EmailLayoutSearchParameters searchParameters);

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