Search in sources :

Example 11 with BaseFilter

use of org.hippoecm.hst.content.beans.query.filter.BaseFilter in project hippo by NHS-digital-website.

the class ProjectUpdateFeedComponent method addYearFilter.

private void addYearFilter(List<BaseFilter> filters, String year, HstQuery query) {
    final Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, Integer.parseInt(year));
    Filter filter = query.createFilter();
    try {
        filter.addEqualTo("website:updatetimestamp", calendar, DateTools.Resolution.YEAR);
        filters.add(filter);
    } catch (final FilterException exception) {
        log.error("Error trying to add year filter", exception);
    }
}
Also used : BaseFilter(org.hippoecm.hst.content.beans.query.filter.BaseFilter) Filter(org.hippoecm.hst.content.beans.query.filter.Filter) FilterException(org.hippoecm.hst.content.beans.query.exceptions.FilterException)

Aggregations

BaseFilter (org.hippoecm.hst.content.beans.query.filter.BaseFilter)11 Filter (org.hippoecm.hst.content.beans.query.filter.Filter)11 FilterException (org.hippoecm.hst.content.beans.query.exceptions.FilterException)7 HstQuery (org.hippoecm.hst.content.beans.query.HstQuery)3 QueryException (org.hippoecm.hst.content.beans.query.exceptions.QueryException)3 ArrayList (java.util.ArrayList)2 Calendar (java.util.Calendar)2 HstQueryBuilder (org.hippoecm.hst.content.beans.query.builder.HstQueryBuilder)2 FeedListComponentInfo (uk.nhs.digital.common.components.info.FeedListComponentInfo)2 Month (java.time.Month)1 HippoBeanIterator (org.hippoecm.hst.content.beans.standard.HippoBeanIterator)1 HippoDocument (org.hippoecm.hst.content.beans.standard.HippoDocument)1 HstRequestContext (org.hippoecm.hst.core.request.HstRequestContext)1 EssentialsEventsComponentInfo (org.onehippo.cms7.essentials.components.info.EssentialsEventsComponentInfo)1