Search in sources :

Example 1 with Indicator

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

the class IndicatorComponent method getIndicator.

private Indicator getIndicator(HstRequestContext ctx) throws HstComponentException {
    HippoBean content = ctx.getContentBean();
    if (content instanceof Indicator) {
        return (Indicator) content;
    }
    log.warn("Cannot find Indicator document for: {}", content.getPath());
    throw new HstComponentException("Cannot find Indicator document based on request content");
}
Also used : HippoBean(org.hippoecm.hst.content.beans.standard.HippoBean) HstComponentException(org.hippoecm.hst.core.component.HstComponentException) Indicator(uk.nhs.digital.nil.beans.Indicator)

Example 2 with Indicator

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

the class IndicatorComponent method doBeforeRender.

@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
    super.doBeforeRender(request, response);
    final HstRequestContext ctx = request.getRequestContext();
    Indicator indicator = getIndicator(ctx);
    request.setAttribute("indicator", indicator);
}
Also used : HstRequestContext(org.hippoecm.hst.core.request.HstRequestContext) Indicator(uk.nhs.digital.nil.beans.Indicator)

Aggregations

Indicator (uk.nhs.digital.nil.beans.Indicator)2 HippoBean (org.hippoecm.hst.content.beans.standard.HippoBean)1 HstComponentException (org.hippoecm.hst.core.component.HstComponentException)1 HstRequestContext (org.hippoecm.hst.core.request.HstRequestContext)1