use of org.hippoecm.hst.content.beans.standard.HippoBean in project hippo by NHS-digital-website.
the class SearchComponent method buildAndExecuteHstSearch.
private void buildAndExecuteHstSearch(HstRequest request, SearchComponentInfo paramInfo) {
HippoFacetNavigationBean facetNavigationBean = getFacetNavigationBean(request);
if (facetNavigationBean != null) {
HippoResultSetBean resultSet = facetNavigationBean.getResultSet();
if (resultSet != null) {
Pageable<HippoBean> pageable = getPageableFactory().createPageable(resultSet.getDocumentIterator(HippoBean.class), facetNavigationBean.getCount().intValue(), paramInfo.getPageSize(), getCurrentPage(request));
request.setAttribute("pageable", pageable);
request.setAttribute("pageNumbers", getHstPageNumbers(pageable));
}
}
setCommonSearchRequestAttributes(request, paramInfo);
request.setAttribute("area", getAreaOption(request).toString());
request.setAttribute("facets", facetNavigationBean);
}
use of org.hippoecm.hst.content.beans.standard.HippoBean in project hippo by NHS-digital-website.
the class NavigationBlockComponent method doBeforeRender.
@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
super.doBeforeRender(request, response);
NavigationBlockComponentInfo componentInfo = getComponentParametersInfo(request);
final String theme = componentInfo.getTheme();
final String size = componentInfo.getSize();
final String position = componentInfo.getPosition();
final String heading = componentInfo.getHeading();
List<HippoBean> allDocuments = new ArrayList<>();
HippoBean document1 = getHippoBeanForPath(componentInfo.getDocument1(), HippoBean.class);
allDocuments.add(document1);
HippoBean document2 = getHippoBeanForPath(componentInfo.getDocument2(), HippoBean.class);
allDocuments.add(document2);
HippoBean document3 = getHippoBeanForPath(componentInfo.getDocument3(), HippoBean.class);
allDocuments.add(document3);
HippoBean document4 = getHippoBeanForPath(componentInfo.getDocument4(), HippoBean.class);
allDocuments.add(document4);
HippoBean document5 = getHippoBeanForPath(componentInfo.getDocument5(), HippoBean.class);
allDocuments.add(document5);
HippoBean document6 = getHippoBeanForPath(componentInfo.getDocument6(), HippoBean.class);
allDocuments.add(document6);
request.setAttribute("theme", theme);
request.setAttribute("size", size);
request.setAttribute("position", position);
request.setAttribute("heading", heading);
request.setAttribute("documents", buildDocumentsList(allDocuments));
}
use of org.hippoecm.hst.content.beans.standard.HippoBean in project hippo by NHS-digital-website.
the class WrappedListPickerComponent method doBeforeRender.
@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
super.doBeforeRender(request, response);
final WrappedListPickerComponentInfo info = getComponentParametersInfo(request);
final HippoBean document = getHippoBeanForPath(info.getWrappingDocument(), HippoBean.class);
final Boolean showIcon = info.getShowIcon();
request.setAttribute("wrappingDocument", document);
request.setAttribute("currentDate", Calendar.getInstance());
request.setAttribute("showIcon", showIcon);
}
use of org.hippoecm.hst.content.beans.standard.HippoBean in project hippo by NHS-digital-website.
the class PageSectionGrouper method groupSections.
public List<Object> groupSections(List<? extends HippoBean> sections) {
// convert the section into a grouped list so we can
// show multiple images next to each other in a section
List<Object> groupedSections = new ArrayList<>();
for (HippoBean section : sections) {
if (isHalfImage(section)) {
// if the last entry was a Image Pair with a space then we are the second one
ImageSection imageSection = (ImageSection) section;
Object last = groupedSections.size() > 0 ? groupedSections.get(groupedSections.size() - 1) : null;
if (isImagePairWithSpace(last)) {
((ImagePairSection) last).setSecond(imageSection);
} else {
groupedSections.add(new ImagePairSection(imageSection));
}
} else {
// just add it, no grouping required
groupedSections.add(section);
}
}
return groupedSections;
}
use of org.hippoecm.hst.content.beans.standard.HippoBean in project hippo by NHS-digital-website.
the class PublicationBase method getParentDocument.
public HippoBean getParentDocument() {
assertPropertyPermitted(PropertyKeys.PARENT_SERIES);
HippoBean parentBean = null;
HippoBean folder = getParentBean();
while (!HippoBeanHelper.isRootFolder(folder)) {
List<HippoBean> parentBeans = new ArrayList<>();
// The parent object of the publication could be either
// Series or Archive and this will find which of those
// it is and return the parents bean
parentBeans.addAll(folder.getChildBeans(Series.class));
parentBeans.addAll(folder.getChildBeans(Archive.class));
Iterator<HippoBean> iterator = parentBeans.iterator();
if (iterator.hasNext()) {
parentBean = iterator.next();
break;
} else {
folder = folder.getParentBean();
}
}
return parentBean;
}
Aggregations