001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.layoutconfiguration.util;
016    
017    import com.liferay.portal.model.Portlet;
018    import com.liferay.portlet.layoutconfiguration.util.xml.RuntimeLogic;
019    
020    import javax.portlet.RenderRequest;
021    import javax.portlet.RenderResponse;
022    
023    import javax.servlet.ServletContext;
024    import javax.servlet.http.HttpServletRequest;
025    import javax.servlet.http.HttpServletResponse;
026    import javax.servlet.jsp.JspWriter;
027    import javax.servlet.jsp.PageContext;
028    
029    /**
030     * @author Brian Wing Shun Chan
031     * @author Raymond Augé
032     * @author Shuyang Zhou
033     */
034    public class RuntimePortletUtil {
035    
036            public static String processCustomizationSettings(
037                            ServletContext servletContext, HttpServletRequest request,
038                            HttpServletResponse response, PageContext pageContext,
039                            String velocityTemplateId, String velocityTemplateContent)
040                    throws Exception {
041    
042                    return getRuntimePortlet().processCustomizationSettings(
043                            servletContext, request, response, pageContext, velocityTemplateId,
044                            velocityTemplateContent);
045            }
046    
047            public static String processPortlet(
048                            ServletContext servletContext, HttpServletRequest request,
049                            HttpServletResponse response, RenderRequest renderRequest,
050                            RenderResponse renderResponse, String portletId, String queryString,
051                            boolean writeOutput)
052                    throws Exception {
053    
054                    return getRuntimePortlet().processPortlet(
055                            servletContext, request, response, renderRequest, renderResponse,
056                            portletId, queryString, writeOutput);
057            }
058    
059            public static String processPortlet(
060                            ServletContext servletContext, HttpServletRequest request,
061                            HttpServletResponse response, RenderRequest renderRequest,
062                            RenderResponse renderResponse, String portletId, String queryString,
063                            String columnId, Integer columnPos, Integer columnCount,
064                            boolean writeOutput)
065                    throws Exception {
066    
067                    return getRuntimePortlet().processPortlet(
068                            servletContext, request, response, renderRequest, renderResponse,
069                            portletId, queryString, columnId, columnPos, columnCount,
070                            writeOutput);
071            }
072    
073            public static String processPortlet(
074                            ServletContext servletContext, HttpServletRequest request,
075                            HttpServletResponse response, Portlet portlet, String queryString,
076                            String columnId, Integer columnPos, Integer columnCount,
077                            String path, boolean writeOutput)
078                    throws Exception {
079    
080                    return getRuntimePortlet().processPortlet(
081                            servletContext, request, response, portlet, queryString, columnId,
082                            columnPos, columnCount, path, writeOutput);
083            }
084    
085            public static String processPortlet(
086                            ServletContext servletContext, HttpServletRequest request,
087                            HttpServletResponse response, RenderRequest renderRequest,
088                            RenderResponse renderResponse, Portlet portlet, String portletId,
089                            String queryString, String columnId, Integer columnPos,
090                            Integer columnCount, String path, boolean writeOutput)
091                    throws Exception {
092    
093                    return getRuntimePortlet().processPortlet(
094                            servletContext, request, response, renderRequest, renderResponse,
095                            portlet, portletId, queryString, columnId, columnPos, columnCount,
096                            path, writeOutput);
097            }
098    
099            public static void processTemplate(
100                            ServletContext servletContext, HttpServletRequest request,
101                            HttpServletResponse response, PageContext pageContext,
102                            JspWriter jspWriter, String velocityTemplateId,
103                            String velocityTemplateContent)
104                    throws Exception {
105    
106                    getRuntimePortlet().processTemplate(
107                            servletContext, request, response, pageContext, jspWriter,
108                            velocityTemplateId, velocityTemplateContent);
109            }
110    
111            public static void processTemplate(
112                            ServletContext servletContext, HttpServletRequest request,
113                            HttpServletResponse response, PageContext pageContext,
114                            JspWriter jspWriter, String portletId, String velocityTemplateId,
115                            String velocityTemplateContent)
116                    throws Exception {
117    
118                    getRuntimePortlet().processTemplate(
119                            servletContext, request, response, pageContext, jspWriter,
120                            portletId, velocityTemplateId, velocityTemplateContent);
121            }
122    
123            public static String processXML(
124                            HttpServletRequest request, String content,
125                            RuntimeLogic runtimeLogic)
126                    throws Exception {
127    
128                    return getRuntimePortlet().processXML(request, content, runtimeLogic);
129            }
130    
131            public static RuntimePortlet getRuntimePortlet() {
132                    return _runtimePortlet;
133            }
134    
135            public void setRuntimePortlet(RuntimePortlet runtimePortlet) {
136                    _runtimePortlet = runtimePortlet;
137            }
138    
139            private static RuntimePortlet _runtimePortlet;
140    
141    }