use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.
the class PageInfoTag method doEndTag.
@Override
public int doEndTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
try {
IPageManager pageManager = (IPageManager) ApsWebApplicationUtils.getBean(SystemConstants.PAGE_MANAGER, this.pageContext);
IPage page = pageManager.getOnlinePage(this.getPageCode());
if (null == page) {
_logger.error("Required info for null page : inserted code '{}'", this.getPageCode());
}
if (this.getInfo() == null || this.getInfo().equals(CODE_INFO)) {
this.setValue(page.getCode());
} else if (this.getInfo().equals(TITLE_INFO)) {
this.extractPageTitle(page, currentLang);
} else if (this.getInfo().equals(URL_INFO)) {
this.extractPageUrl(page, currentLang, reqCtx);
} else if (this.getInfo().equals(OWNER_INFO)) {
this.extractPageOwner(page, reqCtx);
} else if (this.getInfo().equals(CHILD_OF_INFO)) {
this.extractIsChildOfTarget(page);
} else if (this.getInfo().equals(HAS_CHILD)) {
boolean hasChild = (page.getChildrenCodes() != null && page.getChildrenCodes().length > 0);
this._value = new Boolean(hasChild).toString();
}
this.evalValue();
} catch (Throwable t) {
_logger.error("Error during tag initialization", t);
// ApsSystemUtils.logThrowable(t, this, "doStartTag");
throw new JspException("Error during tag initialization ", t);
}
this.release();
return EVAL_PAGE;
}
Aggregations