List of usage examples for com.liferay.portal.templateparser Transformer Transformer
public Transformer(String errorTemplatePropertyKey, boolean restricted)
From source file:com.liferay.content.targeting.portlet.util.PortletDisplayTemplateUtil.java
License:Open Source License
public static String renderDDMTemplate(PortletRequest portletRequest, ThemeDisplay themeDisplay, long ddmTemplateId, List<?> entries, Map<String, Object> contextObjects) throws Exception { DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.getTemplate(ddmTemplateId); String language = ddmTemplate.getLanguage(); if (language.equals(TemplateConstants.LANG_TYPE_VM)) { _log.error("Velocity Application Display Templates not supported"); return null; }// w w w.java 2s. co m contextObjects.put(PortletDisplayTemplateConstants.TEMPLATE_ID, ddmTemplateId); contextObjects.put(PortletDisplayTemplateConstants.ENTRIES, entries); if (!entries.isEmpty()) { contextObjects.put(PortletDisplayTemplateConstants.ENTRY, entries.get(0)); } contextObjects.putAll(_getPortletPreferences(portletRequest)); // Compatibility with existing Application Display Templates Object portletJspTagLibs = contextObjects.get("PortletJspTagLibs"); if (portletJspTagLibs != null) { contextObjects.put("taglibLiferayHash", portletJspTagLibs); } contextObjects.put(PortletDisplayTemplateConstants.ASSET_PUBLISHER_HELPER, AssetPublisherHelperUtil.getAssetPublisherHelper()); Transformer transformer = new Transformer(PropsKeys.DYNAMIC_DATA_LISTS_ERROR_TEMPLATE, true); return transformer.transform(themeDisplay, contextObjects, ddmTemplate.getScript(), language); }