Search in sources :

Example 1 with SupplementaryInformationHub

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

the class SupplementaryInformationHubComponent method doBeforeRender.

@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) {
    super.doBeforeRender(request, response);
    final HstRequestContext context = request.getRequestContext();
    final SupplementaryInformationHub document = (SupplementaryInformationHub) context.getContentBean();
    if (document != null) {
        request.setAttribute("document", document);
    }
    List<SupplementaryInformation> si = getListOfSupplementaryInformation();
    request.setAttribute("years", years(si));
    String selectedYear = DocumentUtils.findYearOrDefault(getSelectedYear(request), Calendar.getInstance().get(Calendar.YEAR));
    request.setAttribute("selectedYear", selectedYear);
    final Month selectedMonth = findMonthOrNull(getSelectedMonth(request));
    if (Objects.nonNull(selectedMonth)) {
        request.setAttribute("selectedMonth", selectedMonth);
    }
    request.setAttribute("months", months(Integer.parseInt(selectedYear), si));
}
Also used : SupplementaryInformation(uk.nhs.digital.website.beans.SupplementaryInformation) Month(java.time.Month) SupplementaryInformationHub(uk.nhs.digital.website.beans.SupplementaryInformationHub) HstRequestContext(org.hippoecm.hst.core.request.HstRequestContext)

Aggregations

Month (java.time.Month)1 HstRequestContext (org.hippoecm.hst.core.request.HstRequestContext)1 SupplementaryInformation (uk.nhs.digital.website.beans.SupplementaryInformation)1 SupplementaryInformationHub (uk.nhs.digital.website.beans.SupplementaryInformationHub)1