001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.portletdisplaytemplate;
016    
017    import com.liferay.portal.kernel.template.TemplateVariableGroup;
018    import com.liferay.portal.kernel.util.ProxyFactory;
019    import com.liferay.portlet.dynamicdatamapping.DDMTemplate;
020    
021    import java.util.List;
022    import java.util.Map;
023    
024    import javax.servlet.http.HttpServletRequest;
025    import javax.servlet.http.HttpServletResponse;
026    
027    /**
028     * @author Leonardo Barros
029     */
030    public class PortletDisplayTemplateManagerUtil {
031    
032            public static DDMTemplate getDDMTemplate(
033                    long groupId, long classNameId, String displayStyle,
034                    boolean useDefault) {
035    
036                    return _portletDisplayTemplateManager.getDDMTemplate(
037                            groupId, classNameId, displayStyle, useDefault);
038            }
039    
040            public static String getDisplayStyle(String ddmTemplateKey) {
041                    return _portletDisplayTemplateManager.getDisplayStyle(ddmTemplateKey);
042            }
043    
044            public static Map<String, TemplateVariableGroup> getTemplateVariableGroups(
045                    String language) {
046    
047                    return _portletDisplayTemplateManager.getTemplateVariableGroups(
048                            language);
049            }
050    
051            public static String renderDDMTemplate(
052                            HttpServletRequest request, HttpServletResponse response,
053                            long templateId, List<?> entries,
054                            Map<String, Object> contextObjects)
055                    throws Exception {
056    
057                    return _portletDisplayTemplateManager.renderDDMTemplate(
058                            request, response, templateId, entries, contextObjects);
059            }
060    
061            private static final PortletDisplayTemplateManager
062                    _portletDisplayTemplateManager = ProxyFactory.newServiceTrackedInstance(
063                            PortletDisplayTemplateManager.class);
064    
065    }