1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.util;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.upload.UploadPortletRequest;
28  import com.liferay.portal.kernel.upload.UploadServletRequest;
29  import com.liferay.portal.model.Company;
30  import com.liferay.portal.model.Layout;
31  import com.liferay.portal.model.LayoutSet;
32  import com.liferay.portal.model.Portlet;
33  import com.liferay.portal.model.User;
34  import com.liferay.portal.theme.ThemeDisplay;
35  import com.liferay.portlet.expando.model.ExpandoBridge;
36  
37  import java.io.IOException;
38  import java.io.Serializable;
39  
40  import java.util.Date;
41  import java.util.List;
42  import java.util.Locale;
43  import java.util.Map;
44  import java.util.Properties;
45  import java.util.TimeZone;
46  
47  import javax.portlet.ActionRequest;
48  import javax.portlet.ActionResponse;
49  import javax.portlet.PortletMode;
50  import javax.portlet.PortletPreferences;
51  import javax.portlet.PortletRequest;
52  import javax.portlet.PortletResponse;
53  import javax.portlet.PreferencesValidator;
54  import javax.portlet.RenderRequest;
55  import javax.portlet.ValidatorException;
56  import javax.portlet.WindowState;
57  
58  import javax.servlet.ServletContext;
59  import javax.servlet.ServletException;
60  import javax.servlet.http.HttpServletRequest;
61  import javax.servlet.http.HttpServletResponse;
62  import javax.servlet.http.HttpSession;
63  import javax.servlet.jsp.PageContext;
64  
65  /**
66   * <a href="PortalUtil.java.html"><b><i>View Source</i></b></a>
67   *
68   * @author Brian Wing Shun Chan
69   *
70   */
71  public class PortalUtil {
72  
73      /**
74       * Adds the description for a page. This appends to the existing page
75       * description.
76       *
77       * @param       description the description for a page
78       * @param       request the HTTP servlet request
79       */
80      public static void addPageDescription(
81          String description, HttpServletRequest request) {
82  
83          getPortal().addPageDescription(description, request);
84      }
85  
86      /**
87       * Adds the keywords for a page. This appends to the existing page keywords.
88       *
89       * @param       keywords the keywords for a page
90       * @param       request the HTTP servlet request
91       */
92      public static void addPageKeywords(
93          String keywords, HttpServletRequest request) {
94  
95          getPortal().addPageKeywords(keywords, request);
96      }
97  
98      /**
99       * Adds the subtitle for a page. This appends to the existing page subtitle.
100      *
101      * @param       subtitle the subtitle for a page
102      * @param       request the HTTP servlet request
103      */
104     public static void addPageSubtitle(
105         String subtitle, HttpServletRequest request) {
106 
107         getPortal().addPageSubtitle(subtitle, request);
108     }
109 
110     /**
111      * Adds the whole title for a page. This appends to the existing page whole
112      * title.
113      *
114      * @param       title the whole title for a page
115      * @param       request the HTTP servlet request
116      */
117     public static void addPageTitle(String title, HttpServletRequest request) {
118         getPortal().addPageTitle(title, request);
119     }
120 
121     public static void clearRequestParameters(RenderRequest renderRequest) {
122         getPortal().clearRequestParameters(renderRequest);
123     }
124 
125     public static void copyRequestParameters(
126         ActionRequest actionRequest, ActionResponse actionResponse) {
127 
128         getPortal().copyRequestParameters(actionRequest, actionResponse);
129     }
130 
131     public static String getCDNHost() {
132         return getPortal().getCDNHost();
133     }
134 
135     public static String getClassName(long classNameId) {
136         return getPortal().getClassName(classNameId);
137     }
138 
139     public static long getClassNameId(Class<?> classObj) {
140         return getPortal().getClassNameId(classObj);
141     }
142 
143     public static long getClassNameId(String value) {
144         return getPortal().getClassNameId(value);
145     }
146 
147     public static String getClassNamePortletId(String className) {
148         return getPortal().getClassNamePortletId(className);
149     }
150 
151     public static String getCommunityLoginURL(ThemeDisplay themeDisplay)
152         throws PortalException, SystemException {
153 
154         return getPortal().getCommunityLoginURL(themeDisplay);
155     }
156 
157     public static Company getCompany(HttpServletRequest request)
158         throws PortalException, SystemException {
159 
160         return getPortal().getCompany(request);
161     }
162 
163     public static Company getCompany(PortletRequest portletRequest)
164         throws PortalException, SystemException {
165 
166         return getPortal().getCompany(portletRequest);
167     }
168 
169     public static long getCompanyId(HttpServletRequest request) {
170         return getPortal().getCompanyId(request);
171     }
172 
173     public static long getCompanyId(PortletRequest portletRequest) {
174         return getPortal().getCompanyId(portletRequest);
175     }
176 
177     public static long[] getCompanyIds() {
178         return getPortal().getCompanyIds();
179     }
180 
181     public static String getComputerAddress() {
182         return getPortal().getComputerAddress();
183     }
184 
185     public static String getComputerName() {
186         return getPortal().getComputerName();
187     }
188 
189     public static String getControlPanelCategory(
190             long companyId, String portletId)
191         throws SystemException {
192 
193         return getPortal().getControlPanelCategory(companyId, portletId);
194     }
195 
196     public static List<Portlet> getControlPanelPortlets(
197             long companyId, String category)
198         throws SystemException {
199 
200         return getPortal().getControlPanelPortlets(companyId, category);
201     }
202 
203     public static String getCurrentURL(HttpServletRequest request) {
204         return getPortal().getCurrentURL(request);
205     }
206 
207     public static String getCurrentURL(PortletRequest portletRequest) {
208         return getPortal().getCurrentURL(portletRequest);
209     }
210 
211     public static String getCustomSQLFunctionIsNotNull() {
212         return getPortal().getCustomSQLFunctionIsNotNull();
213     }
214 
215     public static String getCustomSQLFunctionIsNull() {
216         return getPortal().getCustomSQLFunctionIsNull();
217     }
218 
219     public static Date getDate(int month, int day, int year, PortalException pe)
220         throws PortalException {
221 
222         return getPortal().getDate(month, day, year, pe);
223     }
224 
225     public static Date getDate(
226             int month, int day, int year, TimeZone timeZone, PortalException pe)
227         throws PortalException {
228 
229         return getPortal().getDate(month, day, year, timeZone, pe);
230     }
231 
232     public static Date getDate(
233             int month, int day, int year, int hour, int min, PortalException pe)
234         throws PortalException {
235 
236         return getPortal().getDate(month, day, year, hour, min, pe);
237     }
238 
239     public static Date getDate(
240             int month, int day, int year, int hour, int min, TimeZone timeZone,
241             PortalException pe)
242         throws PortalException {
243 
244         return getPortal().getDate(month, day, year, hour, min, timeZone, pe);
245     }
246 
247     public static long getDefaultCompanyId() {
248         return getPortal().getDefaultCompanyId();
249     }
250 
251     public static Map<String, Serializable> getExpandoBridgeAttributes(
252             ExpandoBridge expandoBridge, PortletRequest portletRequest)
253         throws PortalException, SystemException {
254 
255         return getPortal().getExpandoBridgeAttributes(
256             expandoBridge, portletRequest);
257     }
258 
259     public static String getFirstPageLayoutTypes(PageContext pageContext) {
260         return getPortal().getFirstPageLayoutTypes(pageContext);
261     }
262 
263     public static String getHomeURL(HttpServletRequest request)
264         throws PortalException, SystemException {
265 
266         return getPortal().getHomeURL(request);
267     }
268 
269     public static String getHost(HttpServletRequest request) {
270         return getPortal().getHost(request);
271     }
272 
273     public static String getHost(PortletRequest portletRequest) {
274         return getPortal().getHost(portletRequest);
275     }
276 
277     public static HttpServletRequest getHttpServletRequest(
278         PortletRequest portletRequest) {
279 
280         return getPortal().getHttpServletRequest(portletRequest);
281     }
282 
283     public static HttpServletResponse getHttpServletResponse(
284         PortletResponse portletResponse) {
285 
286         return getPortal().getHttpServletResponse(portletResponse);
287     }
288 
289     public static String getLayoutEditPage(Layout layout) {
290         return getPortal().getLayoutEditPage(layout);
291     }
292 
293     public static String getLayoutViewPage(Layout layout) {
294         return getPortal().getLayoutViewPage(layout);
295     }
296 
297     public static String getLayoutURL(ThemeDisplay themeDisplay) {
298         return getPortal().getLayoutURL(themeDisplay);
299     }
300 
301     public static String getLayoutURL(
302         Layout layout, ThemeDisplay themeDisplay) {
303 
304         return getPortal().getLayoutURL(layout, themeDisplay);
305     }
306 
307     public static String getLayoutURL(
308         Layout layout, ThemeDisplay themeDisplay, boolean doAsUser) {
309 
310         return getPortal().getLayoutURL(layout, themeDisplay, doAsUser);
311     }
312 
313     public static String getLayoutActualURL(Layout layout) {
314         return getPortal().getLayoutActualURL(layout);
315     }
316 
317     public static String getLayoutActualURL(Layout layout, String mainPath) {
318         return getPortal().getLayoutActualURL(layout, mainPath);
319     }
320 
321     public static String getLayoutActualURL(
322             long groupId, boolean privateLayout, String mainPath,
323             String friendlyURL)
324         throws PortalException, SystemException {
325 
326         return getPortal().getLayoutActualURL(
327             groupId, privateLayout, mainPath, friendlyURL);
328     }
329 
330     public static String getLayoutActualURL(
331             long groupId, boolean privateLayout, String mainPath,
332             String friendlyURL, Map<String, String[]> params)
333         throws PortalException, SystemException {
334 
335         return getPortal().getLayoutActualURL(
336             groupId, privateLayout, mainPath, friendlyURL, params);
337     }
338 
339     public static String getLayoutFriendlyURL(
340         Layout layout, ThemeDisplay themeDisplay) {
341 
342         return getPortal().getLayoutFriendlyURL(layout, themeDisplay);
343     }
344 
345     public static String getLayoutSetFriendlyURL(
346             LayoutSet layoutSet, ThemeDisplay themeDisplay)
347         throws PortalException, SystemException {
348 
349         return getPortal().getLayoutSetFriendlyURL(layoutSet, themeDisplay);
350     }
351 
352     public static String getLayoutTarget(Layout layout) {
353         return getPortal().getLayoutTarget(layout);
354     }
355 
356     public static String getJsSafePortletId(String portletId) {
357         return getPortal().getJsSafePortletId(portletId);
358     }
359 
360     public static Locale getLocale(HttpServletRequest request) {
361         return getPortal().getLocale(request);
362     }
363 
364     public static Locale getLocale(RenderRequest renderRequest) {
365         return getPortal().getLocale(renderRequest);
366     }
367 
368     public static HttpServletRequest getOriginalServletRequest(
369         HttpServletRequest request) {
370 
371         return getPortal().getOriginalServletRequest(request);
372     }
373 
374     public static String getPathContext() {
375         return getPortal().getPathContext();
376     }
377 
378     public static String getPathFriendlyURLPrivateGroup() {
379         return getPortal().getPathFriendlyURLPrivateGroup();
380     }
381 
382     public static String getPathFriendlyURLPrivateUser() {
383         return getPortal().getPathFriendlyURLPrivateUser();
384     }
385 
386     public static String getPathFriendlyURLPublic() {
387         return getPortal().getPathFriendlyURLPublic();
388     }
389 
390     public static String getPathImage() {
391         return getPortal().getPathImage();
392     }
393 
394     public static String getPathMain() {
395         return getPortal().getPathMain();
396     }
397 
398     public static long getPlidFromFriendlyURL(
399         long companyId, String friendlyURL) {
400 
401         return getPortal().getPlidFromFriendlyURL(companyId, friendlyURL);
402     }
403 
404     public static long getPlidFromPortletId(
405         long groupId, boolean privateLayout, String portletId) {
406 
407         return getPortal().getPlidFromPortletId(
408             groupId, privateLayout, portletId);
409     }
410 
411     public static Portal getPortal() {
412         return _portal;
413     }
414 
415     public static String getPortalLibDir() {
416         return getPortal().getPortalLibDir();
417     }
418 
419     public static int getPortalPort() {
420         return getPortal().getPortalPort();
421     }
422 
423     public static Properties getPortalProperties() {
424         return getPortal().getPortalProperties();
425     }
426 
427     public static String getPortalURL(ThemeDisplay themeDisplay) {
428         return getPortal().getPortalURL(themeDisplay);
429     }
430 
431     public static String getPortalURL(HttpServletRequest request) {
432         return getPortal().getPortalURL(request);
433     }
434 
435     public static String getPortalURL(
436         HttpServletRequest request, boolean secure) {
437 
438         return getPortal().getPortalURL(request, secure);
439     }
440 
441     public static String getPortalURL(PortletRequest portletRequest) {
442         return getPortal().getPortalURL(portletRequest);
443     }
444 
445     public static String getPortalURL(
446         PortletRequest portletRequest, boolean secure) {
447 
448         return getPortal().getPortalURL(portletRequest, secure);
449     }
450 
451     public static String getPortalURL(
452         String serverName, int serverPort, boolean secure) {
453 
454         return getPortal().getPortalURL(serverName, serverPort, secure);
455     }
456 
457     public static String getPortalWebDir() {
458         return getPortal().getPortalWebDir();
459     }
460 
461     public static Object[] getPortletFriendlyURLMapper(
462             long groupId, boolean privateLayout, String url)
463         throws PortalException, SystemException {
464 
465         return getPortal().getPortletFriendlyURLMapper(
466             groupId, privateLayout, url);
467     }
468 
469     public static Object[] getPortletFriendlyURLMapper(
470             long groupId, boolean privateLayout, String url,
471             Map<String, String[]> params)
472         throws PortalException, SystemException {
473 
474         return getPortal().getPortletFriendlyURLMapper(
475             groupId, privateLayout, url, params);
476     }
477 
478     /**
479      * @deprecated Use <code>getScopeGroupId</code>.
480      */
481     public static long getPortletGroupId(long plid) {
482         return getPortal().getPortletGroupId(plid);
483     }
484 
485     /**
486      * @deprecated Use <code>getScopeGroupId</code>.
487      */
488     public static long getPortletGroupId(Layout layout) {
489         return getPortal().getPortletGroupId(layout);
490     }
491 
492     /**
493      * @deprecated Use <code>getScopeGroupId</code>.
494      */
495     public static long getPortletGroupId(HttpServletRequest request) {
496         return getPortal().getPortletGroupId(request);
497     }
498 
499     /**
500      * @deprecated Use <code>getScopeGroupId</code>.
501      */
502     public static long getPortletGroupId(ActionRequest actionRequest) {
503         return getPortal().getPortletGroupId(actionRequest);
504     }
505 
506     /**
507      * @deprecated Use <code>getScopeGroupId</code>.
508      */
509     public static long getPortletGroupId(RenderRequest renderRequest) {
510         return getPortal().getPortletGroupId(renderRequest);
511     }
512 
513     public static String getPortletId(HttpServletRequest request) {
514         return getPortal().getPortletId(request);
515     }
516 
517     public static String getPortletId(PortletRequest portletRequest) {
518         return getPortal().getPortletId(portletRequest);
519     }
520 
521     public static String getPortletNamespace(String portletId) {
522         return getPortal().getPortletNamespace(portletId);
523     }
524 
525     public static String getPortletTitle(
526         String portletId, long companyId, String languageId) {
527 
528         return getPortal().getPortletTitle(portletId, companyId, languageId);
529     }
530 
531     public static String getPortletTitle(
532         String portletId, long companyId, Locale locale) {
533 
534         return getPortal().getPortletTitle(portletId, companyId, locale);
535     }
536 
537     public static String getPortletTitle(String portletId, User user) {
538         return getPortal().getPortletTitle(portletId, user);
539     }
540 
541     public static String getPortletTitle(
542         Portlet portlet, long companyId, String languageId) {
543 
544         return getPortletTitle(portlet, companyId, languageId);
545     }
546 
547     public static String getPortletTitle(
548         Portlet portlet, long companyId, Locale locale) {
549 
550         return getPortal().getPortletTitle(portlet, companyId, locale);
551     }
552 
553     public static String getPortletTitle(Portlet portlet, User user) {
554         return getPortal().getPortletTitle(portlet, user);
555     }
556 
557     public static String getPortletTitle(
558         Portlet portlet, ServletContext servletContext, Locale locale) {
559 
560         return getPortal().getPortletTitle(portlet, servletContext, locale);
561     }
562 
563     public static String getPortletXmlFileName() throws SystemException {
564         return getPortal().getPortletXmlFileName();
565     }
566 
567     public static PortletPreferences getPreferences(
568         HttpServletRequest request) {
569 
570         return getPortal().getPreferences(request);
571     }
572 
573     public static PreferencesValidator getPreferencesValidator(
574         Portlet portlet) {
575 
576         return getPortal().getPreferencesValidator(portlet);
577     }
578 
579     public static long getScopeGroupId(long plid) {
580         return getPortal().getScopeGroupId(plid);
581     }
582 
583     public static long getScopeGroupId(Layout layout) {
584         return getPortal().getScopeGroupId(layout);
585     }
586 
587     public static long getScopeGroupId(Layout layout, String portletId) {
588         return getPortal().getScopeGroupId(layout, portletId);
589     }
590 
591     public static long getScopeGroupId(HttpServletRequest request) {
592         return getPortal().getScopeGroupId(request);
593     }
594 
595     public static long getScopeGroupId(
596         HttpServletRequest request, String portletId) {
597 
598         return getPortal().getScopeGroupId(request, portletId);
599     }
600 
601     public static long getScopeGroupId(PortletRequest portletRequest) {
602         return getPortal().getScopeGroupId(portletRequest);
603     }
604 
605     public static User getSelectedUser(HttpServletRequest request)
606         throws PortalException, SystemException {
607 
608         return getPortal().getSelectedUser(request);
609     }
610 
611     public static User getSelectedUser(
612             HttpServletRequest request, boolean checkPermission)
613         throws PortalException, SystemException {
614 
615         return getPortal().getSelectedUser(request, checkPermission);
616     }
617 
618     public static User getSelectedUser(PortletRequest portletRequest)
619         throws PortalException, SystemException {
620 
621         return getPortal().getSelectedUser(portletRequest);
622     }
623 
624     public static User getSelectedUser(
625             PortletRequest portletRequest, boolean checkPermission)
626         throws PortalException, SystemException {
627 
628         return getPortal().getSelectedUser(portletRequest, checkPermission);
629     }
630 
631     public static String getStaticResourceURL(
632         HttpServletRequest request, String uri) {
633 
634         return getPortal().getStaticResourceURL(request, uri);
635     }
636 
637     public static String getStaticResourceURL(
638         HttpServletRequest request, String uri, String queryString) {
639 
640         return getPortal().getStaticResourceURL(request, uri, queryString);
641     }
642 
643     public static String getStaticResourceURL(
644         HttpServletRequest request, String uri, long timestamp) {
645 
646         return getPortal().getStaticResourceURL(request, uri, timestamp);
647     }
648 
649     public static String getStaticResourceURL(
650         HttpServletRequest request, String uri, String queryString,
651         long timestamp) {
652 
653         return getPortal().getStaticResourceURL(
654             request, uri, queryString, timestamp);
655     }
656 
657     public static String getStrutsAction(HttpServletRequest request) {
658         return getPortal().getStrutsAction(request);
659     }
660 
661     public static String[] getSystemCommunityRoles() {
662         return getPortal().getSystemCommunityRoles();
663     }
664 
665     public static String[] getSystemGroups() {
666         return getPortal().getSystemGroups();
667     }
668 
669     public static String[] getSystemOrganizationRoles() {
670         return getPortal().getSystemOrganizationRoles();
671     }
672 
673     public static String[] getSystemRoles() {
674         return getPortal().getSystemRoles();
675     }
676 
677     public static String[] getTagsCategories(PortletRequest portletRequest) {
678         return getPortal().getTagsCategories(portletRequest);
679     }
680 
681     public static String[] getTagsEntries(PortletRequest portletRequest) {
682         return getPortal().getTagsEntries(portletRequest);
683     }
684 
685     public static UploadPortletRequest getUploadPortletRequest(
686         ActionRequest actionRequest) {
687 
688         return getPortal().getUploadPortletRequest(actionRequest);
689     }
690 
691     public static UploadServletRequest getUploadServletRequest(
692         HttpServletRequest request) {
693 
694         return getPortal().getUploadServletRequest(request);
695     }
696 
697     public static Date getUptime() {
698         return getPortal().getUptime();
699     }
700 
701     public static String getURLWithSessionId(String url, String sessionId) {
702         return getPortal().getURLWithSessionId(url, sessionId);
703     }
704 
705     public static User getUser(HttpServletRequest request)
706         throws PortalException, SystemException {
707 
708         return getPortal().getUser(request);
709     }
710 
711     public static User getUser(PortletRequest portletRequest)
712         throws PortalException, SystemException {
713 
714         return getPortal().getUser(portletRequest);
715     }
716 
717     public static long getUserId(HttpServletRequest request) {
718         return getPortal().getUserId(request);
719     }
720 
721     public static long getUserId(PortletRequest portletRequest) {
722         return getPortal().getUserId(portletRequest);
723     }
724 
725     public static String getUserName(long userId, String defaultUserName) {
726         return getPortal().getUserName(userId, defaultUserName);
727     }
728 
729     public static String getUserName(
730         long userId, String defaultUserName, String userAttribute) {
731 
732         return getPortal().getUserName(userId, defaultUserName, userAttribute);
733     }
734 
735     public static String getUserName(
736         long userId, String defaultUserName, HttpServletRequest request) {
737 
738         return getPortal().getUserName(userId, defaultUserName, request);
739     }
740 
741     public static String getUserName(
742         long userId, String defaultUserName, String userAttribute,
743         HttpServletRequest request) {
744 
745         return getPortal().getUserName(
746             userId, defaultUserName, userAttribute, request);
747     }
748 
749     public static String getUserPassword(HttpSession session) {
750         return getPortal().getUserPassword(session);
751     }
752 
753     public static String getUserPassword(HttpServletRequest request) {
754         return getPortal().getUserPassword(request);
755     }
756 
757     public static String getUserPassword(PortletRequest portletRequest) {
758         return getPortal().getUserPassword(portletRequest);
759     }
760 
761     public static String getUserValue(
762             long userId, String param, String defaultValue)
763         throws SystemException {
764 
765         return getPortal().getUserValue(userId, param, defaultValue);
766     }
767 
768     public static String getWidgetURL(
769         Portlet portlet, ThemeDisplay themeDisplay) {
770 
771         return getPortal().getWidgetURL(portlet, themeDisplay);
772     }
773 
774     public static boolean isLayoutFirstPageable(String type) {
775         return getPortal().isLayoutFirstPageable(type);
776     }
777 
778     public static boolean isLayoutFriendliable(Layout layout) {
779         return getPortal().isLayoutFriendliable(layout);
780     }
781 
782     public static boolean isLayoutParentable(Layout layout) {
783         return getPortal().isLayoutParentable(layout);
784     }
785 
786     public static boolean isLayoutParentable(String type) {
787         return getPortal().isLayoutParentable(type);
788     }
789 
790     public static boolean isLayoutSitemapable(Layout layout) {
791         return getPortal().isLayoutSitemapable(layout);
792     }
793 
794     public static boolean isMethodGet(PortletRequest portletRequest) {
795         return getPortal().isMethodGet(portletRequest);
796     }
797 
798     public static boolean isMethodPost(PortletRequest portletRequest) {
799         return getPortal().isMethodPost(portletRequest);
800     }
801 
802     public static boolean isReservedParameter(String name) {
803         return getPortal().isReservedParameter(name);
804     }
805 
806     public static boolean isSystemGroup(String groupName) {
807         return getPortal().isSystemGroup(groupName);
808     }
809 
810     public static boolean isSystemRole(String roleName) {
811         return getPortal().isSystemRole(roleName);
812     }
813 
814     public static boolean isUpdateAvailable()
815         throws PortalException, SystemException {
816 
817         return getPortal().isUpdateAvailable();
818     }
819 
820     public static void renderPage(
821             StringBuilder sb, ServletContext servletContext,
822             HttpServletRequest request, HttpServletResponse response,
823             String path)
824         throws IOException, ServletException {
825 
826         getPortal().renderPage(sb, servletContext, request, response, path);
827     }
828 
829     public static void renderPortlet(
830             StringBuilder sb, ServletContext servletContext,
831             HttpServletRequest request, HttpServletResponse response,
832             Portlet portlet, String queryString)
833         throws IOException, ServletException {
834 
835         getPortal().renderPortlet(
836             sb, servletContext, request, response, portlet, queryString);
837     }
838 
839     public static void renderPortlet(
840             StringBuilder sb, ServletContext servletContext,
841             HttpServletRequest request, HttpServletResponse response,
842             Portlet portlet, String queryString, String columnId,
843             Integer columnPos, Integer columnCount)
844         throws IOException, ServletException {
845 
846         getPortal().renderPortlet(
847             sb, servletContext, request, response, portlet, queryString,
848             columnId, columnPos, columnCount);
849     }
850 
851     public static void renderPortlet(
852             StringBuilder sb, ServletContext servletContext,
853             HttpServletRequest request, HttpServletResponse response,
854             Portlet portlet, String queryString, String columnId,
855             Integer columnPos, Integer columnCount, String path)
856         throws IOException, ServletException {
857 
858         getPortal().renderPortlet(
859             sb, servletContext, request, response, portlet, queryString,
860             columnId, columnPos, columnCount, path);
861     }
862 
863     public static void sendError(
864             Exception e, HttpServletRequest request,
865             HttpServletResponse response)
866         throws IOException, ServletException {
867 
868         getPortal().sendError(e, request, response);
869     }
870 
871     public static void sendError(
872             int status, Exception e, HttpServletRequest request,
873             HttpServletResponse response)
874         throws IOException, ServletException {
875 
876         getPortal().sendError(status, e, request, response);
877     }
878 
879     public static void sendError(
880             Exception e, ActionRequest actionRequest,
881             ActionResponse actionResponse)
882         throws IOException {
883 
884         getPortal().sendError(e, actionRequest, actionResponse);
885     }
886 
887     public static void sendError(
888             int status, Exception e, ActionRequest actionRequest,
889             ActionResponse actionResponse)
890         throws IOException {
891 
892         getPortal().sendError(status, e, actionRequest, actionResponse);
893     }
894 
895     /**
896      * Sets the description for a page. This overrides the existing page
897      * description.
898      *
899      * @param       description the description for a page
900      * @param       request the HTTP servlet request
901      */
902     public static void setPageDescription(
903         String description, HttpServletRequest request) {
904 
905         getPortal().setPageDescription(description, request);
906     }
907 
908     /**
909      * Sets the keywords for a page. This overrides the existing page keywords.
910      *
911      * @param       keywords the keywords for a page
912      * @param       request the HTTP servlet request
913      */
914     public static void setPageKeywords(
915         String keywords, HttpServletRequest request) {
916 
917         getPortal().setPageKeywords(keywords, request);
918     }
919 
920     /**
921      * Sets the subtitle for a page. This overrides the existing page subtitle.
922      *
923      * @param       subtitle the subtitle for a page
924      * @param       request the HTTP servlet request
925      */
926     public static void setPageSubtitle(
927         String subtitle, HttpServletRequest request) {
928 
929         getPortal().setPageSubtitle(subtitle, request);
930     }
931 
932     /**
933      * Sets the whole title for a page. This overrides the existing page whole
934      * title.
935      *
936      * @param       title the whole title for a page
937      * @param       request the HTTP servlet request
938      */
939     public static void setPageTitle(
940         String title, HttpServletRequest request) {
941 
942         getPortal().setPageTitle(title, request);
943     }
944 
945     /**
946      * Sets the port obtained on the first request to the portal.
947      *
948      * @param       request the HTTP servlet request
949      */
950     public static void setPortalPort(HttpServletRequest request) {
951         getPortal().setPortalPort(request);
952     }
953 
954     public static void storePreferences(PortletPreferences preferences)
955         throws IOException, ValidatorException {
956 
957         getPortal().storePreferences(preferences);
958     }
959 
960     public static String transformCustomSQL(String sql) {
961         return getPortal().transformCustomSQL(sql);
962     }
963 
964     public static PortletMode updatePortletMode(
965         String portletId, User user, Layout layout, PortletMode portletMode,
966         HttpServletRequest request) {
967 
968         return getPortal().updatePortletMode(
969             portletId, user, layout, portletMode, request);
970     }
971 
972     public static WindowState updateWindowState(
973         String portletId, User user, Layout layout, WindowState windowState,
974         HttpServletRequest request) {
975 
976         return getPortal().updateWindowState(
977             portletId, user, layout, windowState, request);
978     }
979 
980     public void setPortal(Portal portal) {
981         _portal = portal;
982     }
983 
984     private static Portal _portal;
985 
986 }