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

import java.util.Collections;
import java.util.List;

import de.ivu.elect.business.person.entity.Tag;
import de.ivu.elect.jee.entity.QueryDsl;


import static de.ivu.elect.business.person.entity.QTag.tag;

public class TagSearch extends AbstractTagSearch {
  @Override
  protected List<Tag> querySearchResult(TagSearchParameters searchParameters) {
    QueryDsl queryDsl = dao.getQueryDsl();
    queryDsl.from(tag);
    queryDsl.eq(tag.mandant, searchParameters.getTag().getMandant());
    queryDsl.eqIfNotBlank(tag.nameNormalisiert, searchParameters.getTag().getNameNormalisiert());
    queryDsl.eqIfNotNull(tag.status, searchParameters.getTag().getStatus());
    queryDsl.orderBy(tag.name.asc());

    return queryDsl.list(tag);

  }
}
