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);
}
}
use of org.hippoecm.hst.core.component.HstComponentException in project hippo by NHS-digital-website.
the class PublicationBase method getDatasets.
public List<Dataset> getDatasets() throws HstComponentException {
assertPropertyPermitted(PropertyKeys.DATASETS);
HstQueryResult hstQueryResult;
try {
hstQueryResult = HstQueryBuilder.create(getParentBean()).ofTypes(Dataset.class).build().execute();
} catch (QueryException queryException) {
log.error("Failed to find datasets for publication " + getCanonicalPath(), queryException);
throw new HstComponentException("Failed to find datasets for publication " + getCanonicalPath(), queryException);
}
ArrayList<Dataset> hippoBeans = Lists.newArrayList((Iterator) hstQueryResult.getHippoBeans());
hippoBeans.sort(DocumentTitleComparator.COMPARATOR);
return hippoBeans;
}
use of org.hippoecm.hst.core.component.HstComponentException in project hippo by NHS-digital-website.
the class DatasetComponent method doBeforeRender.
@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
super.doBeforeRender(request, response);
final HstRequestContext ctx = request.getRequestContext();
Dataset dataset = (Dataset) ctx.getContentBean();
if (!dataset.isPubliclyAccessible()) {
try {
response.forward("/error/404");
} catch (IOException ioException) {
throw new HstComponentException("forward failed", ioException);
}
return;
}
request.setAttribute("dataset", dataset);
}
Aggregations