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