use of org.hippoecm.hst.core.component.HstComponentException in project hippo by NHS-digital-website.
the class HippoBeanHelper method getTaxonomyName.
public static String getTaxonomyName() throws HstComponentException {
String taxonomyName;
try {
HstRequestContext ctx = RequestContextProvider.get();
taxonomyName = ctx.getSession().getNode("/hippo:namespaces/publicationsystem/publication/editor:templates/_default_/classifiable").getProperty("essentials-taxonomy-name").getString();
} catch (RepositoryException repositoryException) {
throw new HstComponentException("Exception occurred during fetching taxonomy file name.", repositoryException);
}
return taxonomyName;
}
use of org.hippoecm.hst.core.component.HstComponentException in project hippo by NHS-digital-website.
the class CiBreadcrumbProvider method loadCiLandingBean.
/**
* <p>
* Query the repository to see if this document sits under one of the Clinical Indicator
* folders, and if so load in the CiLanding bean (which is used to create the breadcrumb).
* The CiLanding document has a property called urlNameOfContentFolder which links
* the CiLanding page to the appropriate content folder
* </p>
*/
private void loadCiLandingBean() {
HstQueryBuilder queryBuilder = HstQueryBuilder.create(RequestContextProvider.get().getSiteContentBaseBean());
final HstQueryResult hstQueryResult;
Constraint[] constraints = Arrays.stream(currentDocumentBean.getPath().split("/")).map((pathSegment) -> constraint("publicationsystem:urlNameOfContentFolder").equalTo(pathSegment)).toArray(Constraint[]::new);
final HstQuery query = queryBuilder.ofTypes(CiLanding.class).where(or(constraints)).build();
try {
hstQueryResult = query.execute();
} catch (QueryException queryException) {
throw new HstComponentException("Exception occurred during ci folder search.", queryException);
}
if (hstQueryResult.getHippoBeans().hasNext()) {
isClinicalIndicator = true;
ciLandingBean = (CiLanding) hstQueryResult.getHippoBeans().nextHippoBean();
}
}
use of org.hippoecm.hst.core.component.HstComponentException 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");
}
use of org.hippoecm.hst.core.component.HstComponentException in project hippo by NHS-digital-website.
the class PublicationComponent method getPublication.
private Publication getPublication(HstRequestContext ctx) throws HstComponentException {
HippoBean content = ctx.getContentBean();
if (content.getClass().equals(Publication.class)) {
return (Publication) content;
}
if (content.getClass().equals(HippoFolder.class)) {
return Publication.getPublicationInFolder((HippoFolder) content, Publication.class);
}
log.warn("Cannot find Publication document for: {}", content.getPath());
throw new HstComponentException("Cannot find Publication document based on request content");
}
use of org.hippoecm.hst.core.component.HstComponentException in project hippo by NHS-digital-website.
the class FolderComponent method doBeforeRender.
@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
super.doBeforeRender(request, response);
HippoFolder folder = (HippoFolder) request.getRequestContext().getContentBean();
try {
request.setAttribute("publications", findAllDocuments(folder));
} catch (QueryException queryException) {
throw new HstComponentException("Exception occurred during folder search.", queryException);
}
}
Aggregations