use of org.hippoecm.hst.content.beans.standard.HippoFolder in project hippo by NHS-digital-website.
the class Dataset method getParentPublication.
public Publication getParentPublication() {
Publication publicationBean = null;
HippoFolder folder = (HippoFolder) getParentBean();
while (!HippoBeanHelper.isRootFolder(folder)) {
publicationBean = Publication.getPublicationInFolder(folder, Publication.class);
if (publicationBean != null) {
break;
} else {
folder = (HippoFolder) folder.getParentBean();
}
}
return publicationBean;
}
use of org.hippoecm.hst.content.beans.standard.HippoFolder 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.content.beans.standard.HippoFolder in project hippo by NHS-digital-website.
the class HippoBeanHelper method getParentPublication.
public static Publication getParentPublication(HippoBean child) {
HippoFolder folder = (HippoFolder) child.getParentBean();
while (!HippoBeanHelper.isRootFolder(folder)) {
Publication publication = Publication.getPublicationInFolder(folder, Publication.class);
if (publication != null) {
return publication;
}
folder = (HippoFolder) folder.getParentBean();
}
return null;
}
Aggregations