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

import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.person.entity.Tag;
import de.ivu.elect.jee.entity.EagerLoadingCollector;
import de.ivu.elect.jee.presentation.search.WildcardConverter;

public abstract class AbstractTagSearch {

  @Inject
  protected transient TagExtendedDAO dao;

  public AbstractTagSearch() {
    super();
  }

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

  protected abstract List<Tag> querySearchResult(TagSearchParameters searchParameters);

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