use of org.hippoecm.hst.content.beans.standard.HippoDocument in project hippo by NHS-digital-website.
the class CardListComponent method doBeforeRender.
@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
LOGGER.info("Card List Component Info");
CardListComponentInfo info = getComponentParametersInfo(request);
String headerText = info.getHeader();
String introductionText = info.getIntroduction();
request.setAttribute("headerText", headerText);
request.setAttribute("introText", introductionText);
String button1Title = info.getButton1Title();
String button1Url = info.getButton1Link();
String button2Title = info.getButton2Title();
String button2Url = info.getButton2Link();
request.setAttribute("button1Title", button1Title);
request.setAttribute("button1Url", button1Url);
request.setAttribute("button2Title", button2Title);
request.setAttribute("button2Url", button2Url);
List<HippoDocument> cardComponents = getCardComponents(info);
request.setAttribute("cardList", cardComponents);
String template = info.getTemplate();
request.setAttribute("template", template);
}
use of org.hippoecm.hst.content.beans.standard.HippoDocument in project hippo by NHS-digital-website.
the class AzListComponent method doBeforeRender.
@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
super.doBeforeRender(request, response);
final AzListComponentInfo componentParametersInfo = getComponentParametersInfo(request);
String headerText = componentParametersInfo.getHeaderText();
request.setAttribute("headerText", headerText);
String buttonText = componentParametersInfo.getButtonText();
request.setAttribute("buttonText", buttonText);
String navigationDocumentPath = componentParametersInfo.getNavigationDocument();
HippoDocument bean = this.getHippoBeanForPath(navigationDocumentPath, HippoDocument.class);
request.setAttribute("navigationDocument", bean);
}
use of org.hippoecm.hst.content.beans.standard.HippoDocument in project hippo by NHS-digital-website.
the class ProjectUpdateFeedComponent method addOrganisationFilter.
private void addOrganisationFilter(List<BaseFilter> filters, HstRequest request, HstQuery query) {
String organisationTitle = getSelectedOrganisationTitle(request);
if (StringUtils.isNotBlank(organisationTitle)) {
HippoBeanIterator organisationBeans;
try {
final HstRequestContext requestContext = request.getRequestContext();
HstQuery orgQuery = requestContext.getQueryManager().createQuery(requestContext.getSiteContentBaseBean(), Organisation.class);
Filter orgNameFilter = orgQuery.createFilter();
orgNameFilter.addEqualToCaseInsensitive("website:title", organisationTitle);
orgQuery.setFilter(orgNameFilter);
organisationBeans = orgQuery.execute().getHippoBeans();
} catch (QueryException e) {
log.debug("Error finding organisation with title {}: {}", organisationTitle, e);
return;
}
if (organisationBeans.getSize() == 0) {
return;
}
String jcrQuery;
if (organisationBeans.getSize() > 1) {
StringBuilder jcrQueryBuilder = new StringBuilder(String.format("((website:organisation/@hippo:docbase = '%s')", ((HippoDocument) organisationBeans.nextHippoBean()).getCanonicalHandleUUID()));
while (organisationBeans.hasNext()) {
jcrQueryBuilder.append(String.format(" or (website:organisation/@hippo:docbase = '%s')", ((HippoDocument) organisationBeans.nextHippoBean()).getCanonicalHandleUUID()));
}
jcrQueryBuilder.append(")");
jcrQuery = jcrQueryBuilder.toString();
} else {
jcrQuery = String.format("(website:organisation/@hippo:docbase = '%s')", ((HippoDocument) organisationBeans.nextHippoBean()).getCanonicalHandleUUID());
}
Filter filter = query.createFilter();
filter.addJCRExpression(jcrQuery);
filters.add(filter);
}
}
use of org.hippoecm.hst.content.beans.standard.HippoDocument in project hippo by NHS-digital-website.
the class ListPickerComponent method doBeforeRender.
@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) {
final ListPickerComponentInfo paramInfo = getComponentParametersInfo(request);
final List<HippoDocument> documentItems = getDocumentItems(paramInfo);
final int pageSize = getPageSize(request, paramInfo);
final int page = getAnyIntParameter(request, REQUEST_PARAM_PAGE, 1);
final Pageable<HippoDocument> pageable = getPageableFactory().createPageable(documentItems, page, pageSize);
request.setModel(REQUEST_ATTR_PAGEABLE, pageable);
request.setAttribute(REQUEST_ATTR_PARAM_INFO, paramInfo);
}
use of org.hippoecm.hst.content.beans.standard.HippoDocument in project hippo by NHS-digital-website.
the class HeaderComponent method doBeforeRender.
@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
super.doBeforeRender(request, response);
final HeaderComponentInfo componentParametersInfo = getComponentParametersInfo(request);
String bannerDocPath = componentParametersInfo.getBannerDoc();
HippoDocument banner = this.getHippoBeanForPath(bannerDocPath, HippoDocument.class);
request.setAttribute("banner", banner);
String colour = componentParametersInfo.getColour();
if ("Dark Blue".equalsIgnoreCase(colour)) {
request.setAttribute("colour", "Dark Blue Multicolour");
} else {
request.setAttribute("colour", colour);
}
String digiblockPosition = componentParametersInfo.getDigiblockPosition();
request.setAttribute("digiblockposition", digiblockPosition);
String alignment = componentParametersInfo.getAlignment();
request.setAttribute("alignment", alignment);
String button1text = componentParametersInfo.getButton1Text();
String button1Url = componentParametersInfo.getButton1Url();
request.setAttribute("button1Text", button1text);
request.setAttribute("button1Url", button1Url);
String button2text = componentParametersInfo.getButton2Text();
String button2Url = componentParametersInfo.getButton2Url();
request.setAttribute("button2Text", button2text);
request.setAttribute("button2Url", button2Url);
request.getRequestContext().setAttribute("headerPresent", true);
request.setAttribute("stripTagsContentRewriter", stripTagsContentRewriter);
DocumentUtils.setMetaTags(request, this);
}
Aggregations