Search in sources :

Example 1 with SearchArea

use of uk.nhs.digital.common.enums.SearchArea in project hippo by NHS-digital-website.

the class SearchComponent method deriveScope.

private HippoBean[] deriveScope(HstRequest request) {
    SearchArea areaParam = getAreaOption(request);
    final HippoBean base = RequestContextProvider.get().getSiteContentBaseBean();
    final HippoBean newsAndEventsFolder = base.getBean(FOLDER_NEWS_AND_EVENTS);
    final HippoBean publicationsFolder = base.getBean(FOLDER_PUBLICATIONS);
    final HippoBean servicesFolder = base.getBean(FOLDER_SERVICES);
    final HippoBean dataAndInformationFolder = base.getBean(FOLDER_DATAANDINFORMATION);
    final HippoBean nationalIndicatorLibraryFolder = base.getBean(FOLDER_NIL);
    List<HippoBean> scopeBeans = new ArrayList<HippoBean>();
    switch(areaParam) {
        case NEWS_AND_EVENTS:
            scopeBeans.add(newsAndEventsFolder);
            break;
        case DATA:
            scopeBeans.add(publicationsFolder);
            scopeBeans.add(nationalIndicatorLibraryFolder);
            scopeBeans.add(dataAndInformationFolder);
            break;
        case SERVICES:
            scopeBeans.add(servicesFolder);
            break;
        case ALL:
            scopeBeans.add(request.getRequestContext().getSiteContentBaseBean());
            break;
        default:
            scopeBeans.add(request.getRequestContext().getSiteContentBaseBean());
    }
    return scopeBeans.toArray(new HippoBean[0]);
}
Also used : HippoBean(org.hippoecm.hst.content.beans.standard.HippoBean) SearchArea(uk.nhs.digital.common.enums.SearchArea)

Aggregations

HippoBean (org.hippoecm.hst.content.beans.standard.HippoBean)1 SearchArea (uk.nhs.digital.common.enums.SearchArea)1