Search in sources :

Example 1 with ProjectUpdate

use of uk.nhs.digital.website.beans.ProjectUpdate in project hippo by NHS-digital-website.

the class ProjectUpdateFeedComponent method doBeforeRender.

@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) {
    super.doBeforeRender(request, response);
    final HippoBean document = request.getRequestContext().getContentBean();
    if (document != null) {
        request.setAttribute("document", document);
    }
    try {
        List<ProjectUpdate> unfilteredResults = toList(HstQueryBuilder.create(document.getParentBean()).ofTypes(ProjectUpdate.class).build().execute().getHippoBeans());
        request.setAttribute("organisations", organisations(unfilteredResults));
        request.setAttribute("updateTypes", types(unfilteredResults));
        request.setAttribute("years", years(unfilteredResults));
    } catch (QueryException e) {
        log.error("Query for filter generation failed: {}", e.getMessage());
    }
    request.setAttribute("selectedOrganisation", getSelectedOrganisationTitle(request));
    request.setAttribute("selectedUpdateType", getSelectedUpdateType(request));
    request.setAttribute("selectedYear", getYearToFilter(request));
}
Also used : HippoBean(org.hippoecm.hst.content.beans.standard.HippoBean) QueryException(org.hippoecm.hst.content.beans.query.exceptions.QueryException) ProjectUpdate(uk.nhs.digital.website.beans.ProjectUpdate)

Aggregations

QueryException (org.hippoecm.hst.content.beans.query.exceptions.QueryException)1 HippoBean (org.hippoecm.hst.content.beans.standard.HippoBean)1 ProjectUpdate (uk.nhs.digital.website.beans.ProjectUpdate)1