/**
* Renders an ADT.
*
* @param request the request
* @param response the response
* @param templateCtx the template context
* @param templateUUID the UUID of the ADT (DDMTemplate object/table) to render
* @throws TemplateNotFoundException if no template having such UUID could be found
* @throws CouldNotRenderTemplateException if the template could not be rendered
*/
public void renderADT(RenderRequest request, RenderResponse response, Map<String, Object> templateCtx, String templateUUID) throws CouldNotRenderTemplateException, TemplateNotFoundException {
HttpServletRequest httpServletRequest = this.portal.getHttpServletRequest(request);
HttpServletResponse httpServletResponse = this.portal.getHttpServletResponse(response);
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long companyId = themeDisplay.getCompanyId();
try {
List<DDMTemplate> ddmTemplates = this.getDDMTemplateLocalService().getDDMTemplatesByUuidAndCompanyId(templateUUID, companyId);
if (ddmTemplates.isEmpty()) {
throw new TemplateNotFoundException("No ADT found with companyId ["+companyId+"] and UUID ["+templateUUID+"]");
}
String renderedTemplate = this.getPortletDisplayTemplate().renderDDMTemplate(httpServletRequest, httpServletResponse, ddmTemplates.get(0), Collections.emptyList(), templateCtx);
response.getWriter().write(renderedTemplate);
} catch (Exception e) {
throw new CouldNotRenderTemplateException("Could not render from ADT [" + templateUUID + "]", e);
}
}
TemplatedPortlet.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:flashlight-search
作者:
评论列表
文章目录