
package de.ivu.elect.business.email.boundary;

import java.util.List;

import javax.ejb.Stateless;

import de.ivu.elect.business.email.entity.EmailLayout;
import de.ivu.elect.business.email.entity.QEmailLayout;
import de.ivu.elect.jee.entity.QueryDsl;

@Stateless
public class EmailLayoutSearch extends AbstractEmailLayoutSearch {

  public EmailLayoutSearch() {
    super();
  }

  @Override
  protected List<EmailLayout> querySearchResult(EmailLayoutSearchParameters searchParameters) {
    QueryDsl queryDsl = dao.getQueryDsl();

    QEmailLayout emailLayout = QEmailLayout.emailLayout;

    queryDsl.from(emailLayout);
    queryDsl.likeIfNotBlank(emailLayout.bezeichnung, searchParameters.getBezeichnung());

    queryDsl.getQuery().orderBy(emailLayout.bezeichnung.asc());

    return queryDsl.list(emailLayout);
  }
}
