Search in sources :

Example 1 with ComponentList

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

the class TaskHubComponent method doBeforeRender.

@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
    super.doBeforeRender(request, response);
    final ComponentList bean = (ComponentList) request.getRequestContext().getContentBean();
    List<?> priorityTaskList = getTasksFromLinkBlocks(bean.getBlocks()).filter(task -> ((Task) task).getPriorityAction()).collect(Collectors.toList());
    request.setAttribute("priorityTasks", priorityTaskList);
    List<?> alternativeTaskList = getTasksFromLinkBlocks(bean.getBlocks()).flatMap(task -> addAlternativeNameEntries((Task) task)).collect(Collectors.toList());
    request.setAttribute("alternativeTasks", alternativeTaskList);
}
Also used : Task(uk.nhs.digital.intranet.beans.Task) Arrays(java.util.Arrays) List(java.util.List) Stream(java.util.stream.Stream) HstRequest(org.hippoecm.hst.core.component.HstRequest) ComponentList(uk.nhs.digital.website.beans.ComponentList) HstResponse(org.hippoecm.hst.core.component.HstResponse) uk.nhs.digital.common.components(uk.nhs.digital.common.components) Internallink(uk.nhs.digital.website.beans.Internallink) Collectors(java.util.stream.Collectors) Task(uk.nhs.digital.intranet.beans.Task) ComponentList(uk.nhs.digital.website.beans.ComponentList)

Aggregations

Arrays (java.util.Arrays)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 HstRequest (org.hippoecm.hst.core.component.HstRequest)1 HstResponse (org.hippoecm.hst.core.component.HstResponse)1 uk.nhs.digital.common.components (uk.nhs.digital.common.components)1 Task (uk.nhs.digital.intranet.beans.Task)1 ComponentList (uk.nhs.digital.website.beans.ComponentList)1 Internallink (uk.nhs.digital.website.beans.Internallink)1