Search in sources :

Example 1 with HippoFolder

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;
}
Also used : HippoFolder(org.hippoecm.hst.content.beans.standard.HippoFolder)

Example 2 with HippoFolder

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);
    }
}
Also used : QueryException(org.hippoecm.hst.content.beans.query.exceptions.QueryException) HippoFolder(org.hippoecm.hst.content.beans.standard.HippoFolder) HstComponentException(org.hippoecm.hst.core.component.HstComponentException)

Example 3 with HippoFolder

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;
}
Also used : HippoFolder(org.hippoecm.hst.content.beans.standard.HippoFolder)

Aggregations

HippoFolder (org.hippoecm.hst.content.beans.standard.HippoFolder)3 QueryException (org.hippoecm.hst.content.beans.query.exceptions.QueryException)1 HstComponentException (org.hippoecm.hst.core.component.HstComponentException)1