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