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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.benutzerverwaltung.entity.Nachricht;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractNachrichtSearch {

  @Inject
  protected transient NachrichtExtendedDAO dao;

  public AbstractNachrichtSearch() {
    super();
  }

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

  protected abstract List<Nachricht> querySearchResult(NachrichtSearchParameters searchParameters);

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