use of org.hippoecm.hst.content.beans.query.filter.Filter in project hippo by NHS-digital-website.
the class ProjectUpdateFeedComponent method addUpdateTypeFilter.
private void addUpdateTypeFilter(List<BaseFilter> filters, String updateType, HstQuery query) {
if (StringUtils.isNotBlank(updateType)) {
Filter filter = query.createFilter();
try {
filter.addEqualTo("website:typeofupdate", updateType);
filters.add(filter);
} catch (final FilterException exception) {
log.error("Error trying to add type of update filter", exception);
}
}
}
use of org.hippoecm.hst.content.beans.query.filter.Filter in project hippo by NHS-digital-website.
the class SupplementaryInformationHubComponent method contributeAndFilters.
@Override
protected void contributeAndFilters(List<BaseFilter> filters, HstRequest request, HstQuery query) throws FilterException {
super.contributeAndFilters(filters, request, query);
// Add year filter
final String selectedYear = DocumentUtils.findYearOrDefault(getSelectedYear(request), Calendar.getInstance().get(Calendar.YEAR));
final Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, Integer.parseInt(selectedYear));
Filter yearFilter = query.createFilter();
try {
yearFilter.addEqualTo("publicationsystem:NominalDate", calendar, DateTools.Resolution.YEAR);
filters.add(yearFilter);
} catch (final FilterException exception) {
log.error("Error trying to add year filter", exception);
}
// Add month filter
final Month selectedMonth = findMonthOrNull(getSelectedMonth(request));
if (Objects.nonNull(selectedMonth)) {
calendar.set(Calendar.MONTH, calenderMonthOrdinate(selectedMonth));
Filter monthFilter = query.createFilter();
try {
monthFilter.addEqualTo("publicationsystem:NominalDate", calendar, DateTools.Resolution.MONTH);
filters.add(monthFilter);
} catch (final FilterException exception) {
log.error("Error trying to add year filter", exception);
}
}
}
use of org.hippoecm.hst.content.beans.query.filter.Filter in project hippo by NHS-digital-website.
the class ProjectUpdateFeedComponent method createQueryFilter.
@Override
protected Filter createQueryFilter(final HstRequest request, final HstQuery query) throws FilterException {
final String queryParam = getSearchQuery(request);
if (queryParam == null) {
return null;
}
Filter queryFilter = query.createFilter();
queryFilter.addContains(".", ComponentUtils.parseAndApplyWildcards(queryParam));
return queryFilter;
}
use of org.hippoecm.hst.content.beans.query.filter.Filter in project hippo by NHS-digital-website.
the class SupplementaryInformationHubComponent method createQueryFilter.
@Override
protected Filter createQueryFilter(final HstRequest request, final HstQuery query) throws FilterException {
Filter queryFilter = null;
final String queryParam = getSearchQuery(request);
if (queryParam != null) {
final String querystring = ComponentUtils.parseAndApplyWildcards(queryParam);
queryFilter = query.createFilter();
queryFilter.addContains(".", querystring);
}
return queryFilter;
}
use of org.hippoecm.hst.content.beans.query.filter.Filter 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);
}
}
Aggregations