001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.util;
016    
017    import com.liferay.portal.kernel.dao.db.DB;
018    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.exception.SystemException;
021    import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
022    import com.liferay.portal.kernel.upload.UploadPortletRequest;
023    import com.liferay.portal.kernel.upload.UploadServletRequest;
024    import com.liferay.portal.kernel.util.KeyValuePair;
025    import com.liferay.portal.model.BaseModel;
026    import com.liferay.portal.model.Company;
027    import com.liferay.portal.model.Layout;
028    import com.liferay.portal.model.LayoutSet;
029    import com.liferay.portal.model.Portlet;
030    import com.liferay.portal.model.Resource;
031    import com.liferay.portal.model.ResourcePermission;
032    import com.liferay.portal.model.User;
033    import com.liferay.portal.theme.ThemeDisplay;
034    import com.liferay.portlet.expando.model.ExpandoBridge;
035    import com.liferay.portlet.social.model.SocialEquityActionMapping;
036    
037    import java.io.IOException;
038    import java.io.Serializable;
039    
040    import java.sql.SQLException;
041    
042    import java.util.Date;
043    import java.util.List;
044    import java.util.Locale;
045    import java.util.Map;
046    import java.util.Properties;
047    import java.util.TimeZone;
048    
049    import javax.portlet.ActionRequest;
050    import javax.portlet.ActionResponse;
051    import javax.portlet.PortletMode;
052    import javax.portlet.PortletPreferences;
053    import javax.portlet.PortletRequest;
054    import javax.portlet.PortletResponse;
055    import javax.portlet.PreferencesValidator;
056    import javax.portlet.RenderRequest;
057    import javax.portlet.RenderResponse;
058    import javax.portlet.ValidatorException;
059    import javax.portlet.WindowState;
060    
061    import javax.servlet.ServletContext;
062    import javax.servlet.ServletException;
063    import javax.servlet.http.HttpServletRequest;
064    import javax.servlet.http.HttpServletResponse;
065    import javax.servlet.http.HttpSession;
066    import javax.servlet.jsp.PageContext;
067    
068    /**
069     * @author Brian Wing Shun Chan
070     * @author Eduardo Lundgren
071     */
072    public class PortalUtil {
073    
074            /**
075             * Adds the description for a page. This appends to the existing page
076             * description.
077             */
078            public static void addPageDescription(
079                    String description, HttpServletRequest request) {
080    
081                    getPortal().addPageDescription(description, request);
082            }
083    
084            /**
085             * Adds the keywords for a page. This appends to the existing page keywords.
086             */
087            public static void addPageKeywords(
088                    String keywords, HttpServletRequest request) {
089    
090                    getPortal().addPageKeywords(keywords, request);
091            }
092    
093            /**
094             * Adds the subtitle for a page. This appends to the existing page subtitle.
095             */
096            public static void addPageSubtitle(
097                    String subtitle, HttpServletRequest request) {
098    
099                    getPortal().addPageSubtitle(subtitle, request);
100            }
101    
102            /**
103             * Adds the whole title for a page. This appends to the existing page whole
104             * title.
105             */
106            public static void addPageTitle(String title, HttpServletRequest request) {
107                    getPortal().addPageTitle(title, request);
108            }
109    
110            public static void addPortalPortEventListener(
111                    PortalPortEventListener portalPortEventListener) {
112    
113                    getPortal().addPortalPortEventListener(portalPortEventListener);
114            }
115    
116            public static void addPortletBreadcrumbEntry(
117                    HttpServletRequest request, String title, String url) {
118    
119                    getPortal().addPortletBreadcrumbEntry(request, title, url);
120            }
121    
122            public static void addPortletDefaultResource(
123                            HttpServletRequest request, Portlet portlet)
124                    throws PortalException, SystemException {
125    
126                    getPortal().addPortletDefaultResource(request, portlet);
127            }
128    
129            public static void clearRequestParameters(RenderRequest renderRequest) {
130                    getPortal().clearRequestParameters(renderRequest);
131            }
132    
133            public static void copyRequestParameters(
134                    ActionRequest actionRequest, ActionResponse actionResponse) {
135    
136                    getPortal().copyRequestParameters(actionRequest, actionResponse);
137            }
138    
139            public static String escapeRedirect(String url) {
140                    return getPortal().escapeRedirect(url);
141            }
142    
143            public static String generateRandomKey(
144                    HttpServletRequest request, String input) {
145    
146                    return getPortal().generateRandomKey(request, input);
147            }
148    
149            public static BaseModel<?> getBaseModel(Resource resource)
150                    throws PortalException, SystemException {
151    
152                    return getPortal().getBaseModel(resource);
153            }
154    
155            public static BaseModel<?> getBaseModel(
156                            ResourcePermission resourcePermission)
157                    throws PortalException, SystemException {
158    
159                    return getPortal().getBaseModel(resourcePermission);
160            }
161    
162            public static BaseModel<?> getBaseModel(String modelName, String primKey)
163                    throws PortalException, SystemException {
164    
165                    return getPortal().getBaseModel(modelName, primKey);
166            }
167    
168            public static long getBasicAuthUserId(HttpServletRequest request)
169                    throws PortalException, SystemException {
170    
171                    return getPortal().getBasicAuthUserId(request);
172            }
173    
174            public static long getBasicAuthUserId(
175                            HttpServletRequest request, long companyId)
176                    throws PortalException, SystemException {
177    
178                    return getPortal().getBasicAuthUserId(request, companyId);
179            }
180    
181            /**
182             * @deprecated {@link #getCDNHost(boolean)}
183             */
184            public static String getCDNHost() {
185                    return getPortal().getCDNHost();
186            }
187    
188            public static String getCDNHost(boolean secure) {
189                    return getPortal().getCDNHost(secure);
190            }
191    
192            public static String getCDNHostHttp() {
193                    return getPortal().getCDNHostHttp();
194            }
195    
196            public static String getCDNHostHttps() {
197                    return getPortal().getCDNHostHttps();
198            }
199    
200            public static String getClassName(long classNameId) {
201                    return getPortal().getClassName(classNameId);
202            }
203    
204            public static long getClassNameId(Class<?> classObj) {
205                    return getPortal().getClassNameId(classObj);
206            }
207    
208            public static long getClassNameId(String value) {
209                    return getPortal().getClassNameId(value);
210            }
211    
212            public static String getClassNamePortletId(String className) {
213                    return getPortal().getClassNamePortletId(className);
214            }
215    
216            public static String getCommunityLoginURL(ThemeDisplay themeDisplay)
217                    throws PortalException, SystemException {
218    
219                    return getPortal().getCommunityLoginURL(themeDisplay);
220            }
221    
222            public static String[] getCommunityPermissions(HttpServletRequest request) {
223                    return getPortal().getCommunityPermissions(request);
224            }
225    
226            public static String[] getCommunityPermissions(
227                    PortletRequest portletRequest) {
228    
229                    return getPortal().getCommunityPermissions(portletRequest);
230            }
231    
232            public static Company getCompany(HttpServletRequest request)
233                    throws PortalException, SystemException {
234    
235                    return getPortal().getCompany(request);
236            }
237    
238            public static Company getCompany(PortletRequest portletRequest)
239                    throws PortalException, SystemException {
240    
241                    return getPortal().getCompany(portletRequest);
242            }
243    
244            public static long getCompanyId(HttpServletRequest request) {
245                    return getPortal().getCompanyId(request);
246            }
247    
248            public static long getCompanyId(PortletRequest portletRequest) {
249                    return getPortal().getCompanyId(portletRequest);
250            }
251    
252            public static long[] getCompanyIds() {
253                    return getPortal().getCompanyIds();
254            }
255    
256            public static String getComputerAddress() {
257                    return getPortal().getComputerAddress();
258            }
259    
260            public static String getComputerName() {
261                    return getPortal().getComputerName();
262            }
263    
264            public static String getControlPanelCategory(
265                            String portletId, ThemeDisplay themeDisplay)
266                    throws SystemException {
267    
268                    return getPortal().getControlPanelCategory(portletId, themeDisplay);
269            }
270    
271            public static String getControlPanelFullURL(
272                            long scopeGroupId, String ppid, Map<String, String[]> params)
273                    throws PortalException, SystemException {
274    
275                    return getPortal().getControlPanelFullURL(scopeGroupId, ppid, params);
276            }
277    
278            public static List<Portlet> getControlPanelPortlets(
279                            String category, ThemeDisplay themeDisplay)
280                    throws SystemException {
281    
282                    return getPortal().getControlPanelPortlets(
283                            category, themeDisplay);
284            }
285    
286            public static String getCurrentCompleteURL(HttpServletRequest request) {
287                    return getPortal().getCurrentCompleteURL(request);
288            }
289    
290            public static String getCurrentURL(HttpServletRequest request) {
291                    return getPortal().getCurrentURL(request);
292            }
293    
294            public static String getCurrentURL(PortletRequest portletRequest) {
295                    return getPortal().getCurrentURL(portletRequest);
296            }
297    
298            public static String getCustomSQLFunctionIsNotNull() {
299                    return getPortal().getCustomSQLFunctionIsNotNull();
300            }
301    
302            public static String getCustomSQLFunctionIsNull() {
303                    return getPortal().getCustomSQLFunctionIsNull();
304            }
305    
306            public static Date getDate(int month, int day, int year) {
307                    return getPortal().getDate(month, day, year);
308            }
309    
310            public static Date getDate(
311                            int month, int day, int year, int hour, int min, PortalException pe)
312                    throws PortalException {
313    
314                    return getPortal().getDate(month, day, year, hour, min, pe);
315            }
316    
317            public static Date getDate(
318                            int month, int day, int year, int hour, int min, TimeZone timeZone,
319                            PortalException pe)
320                    throws PortalException {
321    
322                    return getPortal().getDate(month, day, year, hour, min, timeZone, pe);
323            }
324    
325            public static Date getDate(int month, int day, int year, PortalException pe)
326                    throws PortalException {
327    
328                    return getPortal().getDate(month, day, year, pe);
329            }
330    
331            public static Date getDate(
332                            int month, int day, int year, TimeZone timeZone, PortalException pe)
333                    throws PortalException {
334    
335                    return getPortal().getDate(month, day, year, timeZone, pe);
336            }
337    
338            /**
339             * @deprecated {@link DBFactoryUtil#getDB()}
340             */
341            public static DB getDB() {
342                    return DBFactoryUtil.getDB();
343            }
344    
345            public static long getDefaultCompanyId() {
346                    return getPortal().getDefaultCompanyId();
347            }
348    
349            public static Map<String, Serializable> getExpandoBridgeAttributes(
350                            ExpandoBridge expandoBridge, PortletRequest portletRequest)
351                    throws PortalException, SystemException {
352    
353                    return getPortal().getExpandoBridgeAttributes(
354                            expandoBridge, portletRequest);
355            }
356    
357            public static String getFirstPageLayoutTypes(PageContext pageContext) {
358                    return getPortal().getFirstPageLayoutTypes(pageContext);
359            }
360    
361            public static String getGlobalLibDir() {
362                    return getPortal().getGlobalLibDir();
363            }
364    
365            public static String getGoogleGadgetURL(
366                            Portlet portlet, ThemeDisplay themeDisplay)
367                    throws PortalException, SystemException {
368    
369                    return getPortal().getGoogleGadgetURL(portlet, themeDisplay);
370            }
371    
372            public static String[] getGuestPermissions(HttpServletRequest request) {
373                    return getPortal().getGuestPermissions(request);
374            }
375    
376            public static String[] getGuestPermissions(PortletRequest portletRequest) {
377                    return getPortal().getGuestPermissions(portletRequest);
378            }
379    
380            public static String getHomeURL(HttpServletRequest request)
381                    throws PortalException, SystemException {
382    
383                    return getPortal().getHomeURL(request);
384            }
385    
386            public static String getHost(HttpServletRequest request) {
387                    return getPortal().getHost(request);
388            }
389    
390            public static String getHost(PortletRequest portletRequest) {
391                    return getPortal().getHost(portletRequest);
392            }
393    
394            public static HttpServletRequest getHttpServletRequest(
395                    PortletRequest portletRequest) {
396    
397                    return getPortal().getHttpServletRequest(portletRequest);
398            }
399    
400            public static HttpServletResponse getHttpServletResponse(
401                    PortletResponse portletResponse) {
402    
403                    return getPortal().getHttpServletResponse(portletResponse);
404            }
405    
406            public static String getJsSafePortletId(String portletId) {
407                    return getPortal().getJsSafePortletId(portletId);
408            }
409    
410            public static String getLayoutActualURL(Layout layout) {
411                    return getPortal().getLayoutActualURL(layout);
412            }
413    
414            public static String getLayoutActualURL(Layout layout, String mainPath) {
415                    return getPortal().getLayoutActualURL(layout, mainPath);
416            }
417    
418            public static String getLayoutActualURL(
419                            long groupId, boolean privateLayout, String mainPath,
420                            String friendlyURL)
421                    throws PortalException, SystemException {
422    
423                    return getPortal().getLayoutActualURL(
424                            groupId, privateLayout, mainPath, friendlyURL);
425            }
426    
427            public static String getLayoutActualURL(
428                            long groupId, boolean privateLayout, String mainPath,
429                            String friendlyURL, Map<String, String[]> params,
430                            Map<String, Object> requestContext)
431                    throws PortalException, SystemException {
432    
433                    return getPortal().getLayoutActualURL(
434                            groupId, privateLayout, mainPath, friendlyURL, params,
435                            requestContext);
436            }
437    
438            public static String getLayoutEditPage(Layout layout) {
439                    return getPortal().getLayoutEditPage(layout);
440            }
441    
442            public static String getLayoutEditPage(String type) {
443                    return getPortal().getLayoutEditPage(type);
444            }
445    
446            public static String getLayoutFriendlyURL(
447                            Layout layout, ThemeDisplay themeDisplay)
448                    throws PortalException, SystemException {
449    
450                    return getPortal().getLayoutFriendlyURL(layout, themeDisplay);
451            }
452    
453            public static String getLayoutFriendlyURL(
454                            Layout layout, ThemeDisplay themeDisplay, Locale locale)
455                    throws PortalException, SystemException {
456    
457                    return getPortal().getLayoutFriendlyURL(layout, themeDisplay, locale);
458            }
459    
460            public static String getLayoutFullURL(
461                            Layout layout, ThemeDisplay themeDisplay)
462                    throws PortalException, SystemException {
463    
464                    return getPortal().getLayoutFullURL(layout, themeDisplay);
465            }
466    
467            public static String getLayoutFullURL(
468                            Layout layout, ThemeDisplay themeDisplay, boolean doAsUser)
469                    throws PortalException, SystemException {
470    
471                    return getPortal().getLayoutFullURL(layout, themeDisplay, doAsUser);
472            }
473    
474            public static String getLayoutFullURL(long groupId, String portletId)
475                    throws PortalException, SystemException {
476    
477                    return getPortal().getLayoutFullURL(groupId, portletId);
478            }
479    
480            public static String getLayoutFullURL(ThemeDisplay themeDisplay)
481                    throws PortalException, SystemException {
482    
483                    return getPortal().getLayoutFullURL(themeDisplay);
484            }
485    
486            public static String getLayoutSetFriendlyURL(
487                            LayoutSet layoutSet, ThemeDisplay themeDisplay)
488                    throws PortalException, SystemException {
489    
490                    return getPortal().getLayoutSetFriendlyURL(layoutSet, themeDisplay);
491            }
492    
493            public static String getLayoutTarget(Layout layout) {
494                    return getPortal().getLayoutTarget(layout);
495            }
496    
497            public static String getLayoutURL(
498                            Layout layout, ThemeDisplay themeDisplay)
499                    throws PortalException, SystemException {
500    
501                    return getPortal().getLayoutURL(layout, themeDisplay);
502            }
503    
504            public static String getLayoutURL(
505                            Layout layout, ThemeDisplay themeDisplay, boolean doAsUser)
506                    throws PortalException, SystemException {
507    
508                    return getPortal().getLayoutURL(layout, themeDisplay, doAsUser);
509            }
510    
511            public static String getLayoutURL(ThemeDisplay themeDisplay)
512                    throws PortalException, SystemException {
513    
514                    return getPortal().getLayoutURL(themeDisplay);
515            }
516    
517            public static String getLayoutViewPage(Layout layout) {
518                    return getPortal().getLayoutViewPage(layout);
519            }
520    
521            public static String getLayoutViewPage(String type) {
522                    return getPortal().getLayoutViewPage(type);
523            }
524    
525            public static LiferayPortletResponse getLiferayPortletResponse(
526                    PortletResponse portletResponse) {
527    
528                    return getPortal().getLiferayPortletResponse(portletResponse);
529            }
530    
531            public static Locale getLocale(HttpServletRequest request) {
532                    return getPortal().getLocale(request);
533            }
534    
535            public static Locale getLocale(RenderRequest renderRequest) {
536                    return getPortal().getLocale(renderRequest);
537            }
538    
539            /**
540             * @deprecated {@link #getBaseModel(Resource)}
541             */
542            public static BaseModel<?> getModel(Resource resource)
543                    throws PortalException, SystemException {
544    
545                    return getPortal().getBaseModel(resource);
546            }
547    
548            /**
549             * @deprecated {@link #getBaseModel(ResourcePermission)}
550             */
551            public static BaseModel<?> getModel(ResourcePermission resourcePermission)
552                    throws PortalException, SystemException {
553    
554                    return getPortal().getBaseModel(resourcePermission);
555            }
556    
557            /**
558             * @deprecated {@link #getBaseModel(String, String)}
559             */
560            public static BaseModel<?> getModel(String modelName, String primKey)
561                    throws PortalException, SystemException {
562    
563                    return getPortal().getBaseModel(modelName, primKey);
564            }
565    
566            public static String getNetvibesURL(
567                            Portlet portlet, ThemeDisplay themeDisplay)
568                    throws PortalException, SystemException {
569    
570                    return getPortal().getNetvibesURL(portlet, themeDisplay);
571            }
572    
573            public static HttpServletRequest getOriginalServletRequest(
574                    HttpServletRequest request) {
575    
576                    return getPortal().getOriginalServletRequest(request);
577            }
578    
579            public static long getParentGroupId(long scopeGroupId)
580                    throws PortalException, SystemException {
581    
582                    return getPortal().getParentGroupId(scopeGroupId);
583            }
584    
585            public static String getPathContext() {
586                    return getPortal().getPathContext();
587            }
588    
589            public static String getPathFriendlyURLPrivateGroup() {
590                    return getPortal().getPathFriendlyURLPrivateGroup();
591            }
592    
593            public static String getPathFriendlyURLPrivateUser() {
594                    return getPortal().getPathFriendlyURLPrivateUser();
595            }
596    
597            public static String getPathFriendlyURLPublic() {
598                    return getPortal().getPathFriendlyURLPublic();
599            }
600    
601            public static String getPathImage() {
602                    return getPortal().getPathImage();
603            }
604    
605            public static String getPathMain() {
606                    return getPortal().getPathMain();
607            }
608    
609            public static long getPlidFromFriendlyURL(
610                    long companyId, String friendlyURL) {
611    
612                    return getPortal().getPlidFromFriendlyURL(companyId, friendlyURL);
613            }
614    
615            public static long getPlidFromPortletId(
616                            long groupId, boolean privateLayout, String portletId)
617                    throws PortalException, SystemException {
618    
619                    return getPortal().getPlidFromPortletId(
620                            groupId, privateLayout, portletId);
621            }
622    
623            public static long getPlidFromPortletId(long groupId, String portletId)
624                    throws PortalException, SystemException {
625    
626                    return getPortal().getPlidFromPortletId(groupId, portletId);
627            }
628    
629            public static Portal getPortal() {
630                    return _portal;
631            }
632    
633            public static String getPortalLibDir() {
634                    return getPortal().getPortalLibDir();
635            }
636    
637            public static int getPortalPort() {
638                    return getPortal().getPortalPort();
639            }
640    
641            public static Properties getPortalProperties() {
642                    return getPortal().getPortalProperties();
643            }
644    
645            public static String getPortalURL(HttpServletRequest request) {
646                    return getPortal().getPortalURL(request);
647            }
648    
649            public static String getPortalURL(
650                    HttpServletRequest request, boolean secure) {
651    
652                    return getPortal().getPortalURL(request, secure);
653            }
654    
655            public static String getPortalURL(PortletRequest portletRequest) {
656                    return getPortal().getPortalURL(portletRequest);
657            }
658    
659            public static String getPortalURL(
660                    PortletRequest portletRequest, boolean secure) {
661    
662                    return getPortal().getPortalURL(portletRequest, secure);
663            }
664    
665            public static String getPortalURL(
666                    String serverName, int serverPort, boolean secure) {
667    
668                    return getPortal().getPortalURL(serverName, serverPort, secure);
669            }
670    
671            public static String getPortalURL(ThemeDisplay themeDisplay)
672                    throws PortalException, SystemException {
673    
674                    return getPortal().getPortalURL(themeDisplay);
675            }
676    
677            public static String getPortalWebDir() {
678                    return getPortal().getPortalWebDir();
679            }
680    
681            public static List<KeyValuePair> getPortletBreadcrumbList(
682                    HttpServletRequest request) {
683    
684                    return getPortal().getPortletBreadcrumbList(request);
685            }
686    
687            public static String getPortletDescription(
688                    Portlet portlet, ServletContext servletContext, Locale locale) {
689    
690                    return getPortal().getPortletDescription(
691                            portlet, servletContext, locale);
692            }
693    
694            public static String getPortletDescription(Portlet portlet, User user) {
695                    return getPortal().getPortletDescription(portlet, user);
696            }
697    
698            public static String getPortletDescription(
699                    String portletId, Locale locale) {
700    
701                    return getPortal().getPortletDescription(portletId, locale);
702            }
703    
704            public static String getPortletDescription(
705                    String portletId, String languageId) {
706    
707                    return getPortal().getPortletDescription(portletId, languageId);
708            }
709    
710            public static String getPortletDescription(String portletId, User user) {
711                    return getPortal().getPortletDescription(portletId, user);
712            }
713    
714            public static String getPortletId(HttpServletRequest request) {
715                    return getPortal().getPortletId(request);
716            }
717    
718            public static String getPortletId(PortletRequest portletRequest) {
719                    return getPortal().getPortletId(portletRequest);
720            }
721    
722            public static String getPortletNamespace(String portletId) {
723                    return getPortal().getPortletNamespace(portletId);
724            }
725    
726            public static String getPortletTitle(Portlet portlet, Locale locale) {
727                    return getPortal().getPortletTitle(portlet, locale);
728            }
729    
730            public static String getPortletTitle(
731                    Portlet portlet, ServletContext servletContext, Locale locale) {
732    
733                    return getPortal().getPortletTitle(portlet, servletContext, locale);
734            }
735    
736            public static String getPortletTitle(Portlet portlet, String languageId) {
737                    return getPortal().getPortletTitle(portlet, languageId);
738            }
739    
740            public static String getPortletTitle(Portlet portlet, User user) {
741                    return getPortal().getPortletTitle(portlet, user);
742            }
743    
744            public static String getPortletTitle(RenderResponse renderResponse) {
745                    return getPortal().getPortletTitle(renderResponse);
746            }
747    
748            public static String getPortletTitle(String portletId, Locale locale) {
749                    return getPortal().getPortletTitle(portletId, locale);
750            }
751    
752            public static String getPortletTitle(String portletId, String languageId) {
753                    return getPortal().getPortletTitle(portletId, languageId);
754            }
755    
756            public static String getPortletTitle(String portletId, User user) {
757                    return getPortal().getPortletTitle(portletId, user);
758            }
759    
760            public static String getPortletXmlFileName() throws SystemException {
761                    return getPortal().getPortletXmlFileName();
762            }
763    
764            public static PortletPreferences getPreferences(
765                    HttpServletRequest request) {
766    
767                    return getPortal().getPreferences(request);
768            }
769    
770            public static PreferencesValidator getPreferencesValidator(
771                    Portlet portlet) {
772    
773                    return getPortal().getPreferencesValidator(portlet);
774            }
775    
776            public static long getScopeGroupId(HttpServletRequest request)
777                    throws PortalException, SystemException {
778    
779                    return getPortal().getScopeGroupId(request);
780            }
781    
782            public static long getScopeGroupId(
783                            HttpServletRequest request, String portletId)
784                    throws PortalException, SystemException {
785    
786                    return getPortal().getScopeGroupId(request, portletId);
787            }
788    
789            public static long getScopeGroupId(Layout layout) {
790                    return getPortal().getScopeGroupId(layout);
791            }
792    
793            public static long getScopeGroupId(Layout layout, String portletId) {
794                    return getPortal().getScopeGroupId(layout, portletId);
795            }
796    
797            public static long getScopeGroupId(long plid) {
798                    return getPortal().getScopeGroupId(plid);
799            }
800    
801            public static long getScopeGroupId(PortletRequest portletRequest)
802                    throws PortalException, SystemException {
803    
804                    return getPortal().getScopeGroupId(portletRequest);
805            }
806    
807            public static User getSelectedUser(HttpServletRequest request)
808                    throws PortalException, SystemException {
809    
810                    return getPortal().getSelectedUser(request);
811            }
812    
813            public static User getSelectedUser(
814                            HttpServletRequest request, boolean checkPermission)
815                    throws PortalException, SystemException {
816    
817                    return getPortal().getSelectedUser(request, checkPermission);
818            }
819    
820            public static User getSelectedUser(PortletRequest portletRequest)
821                    throws PortalException, SystemException {
822    
823                    return getPortal().getSelectedUser(portletRequest);
824            }
825    
826            public static User getSelectedUser(
827                            PortletRequest portletRequest, boolean checkPermission)
828                    throws PortalException, SystemException {
829    
830                    return getPortal().getSelectedUser(portletRequest, checkPermission);
831            }
832    
833            public static ServletContext getServletContext(
834                    Portlet portlet, ServletContext servletContext) {
835    
836                    return getPortal().getServletContext(portlet, servletContext);
837            }
838    
839            public static SocialEquityActionMapping getSocialEquityActionMapping(
840                    String name, String actionId) {
841    
842                    return getPortal().getSocialEquityActionMapping(name, actionId);
843            }
844    
845            public static List<SocialEquityActionMapping> getSocialEquityActionMappings(
846                    String name) {
847    
848                    return getPortal().getSocialEquityActionMappings(name);
849            }
850    
851            public static String[] getSocialEquityClassNames() {
852                    return getPortal().getSocialEquityClassNames();
853            }
854    
855            public static String getStaticResourceURL(
856                    HttpServletRequest request, String uri) {
857    
858                    return getPortal().getStaticResourceURL(request, uri);
859            }
860    
861            public static String getStaticResourceURL(
862                    HttpServletRequest request, String uri, long timestamp) {
863    
864                    return getPortal().getStaticResourceURL(request, uri, timestamp);
865            }
866    
867            public static String getStaticResourceURL(
868                    HttpServletRequest request, String uri, String queryString) {
869    
870                    return getPortal().getStaticResourceURL(request, uri, queryString);
871            }
872    
873            public static String getStaticResourceURL(
874                    HttpServletRequest request, String uri, String queryString,
875                    long timestamp) {
876    
877                    return getPortal().getStaticResourceURL(
878                            request, uri, queryString, timestamp);
879            }
880    
881            public static String getStrutsAction(HttpServletRequest request) {
882                    return getPortal().getStrutsAction(request);
883            }
884    
885            public static String[] getSystemCommunityRoles() {
886                    return getPortal().getSystemCommunityRoles();
887            }
888    
889            public static String[] getSystemGroups() {
890                    return getPortal().getSystemGroups();
891            }
892    
893            public static String[] getSystemOrganizationRoles() {
894                    return getPortal().getSystemOrganizationRoles();
895            }
896    
897            public static String[] getSystemRoles() {
898                    return getPortal().getSystemRoles();
899            }
900    
901            public static UploadServletRequest getUploadServletRequest(
902                    HttpServletRequest request) {
903    
904                    return getPortal().getUploadServletRequest(request);
905            }
906    
907            public static UploadPortletRequest getUploadPortletRequest(
908                    PortletRequest portletRequest) {
909    
910                    return getPortal().getUploadPortletRequest(portletRequest);
911            }
912    
913            public static Date getUptime() {
914                    return getPortal().getUptime();
915            }
916    
917            public static String getURLWithSessionId(String url, String sessionId) {
918                    return getPortal().getURLWithSessionId(url, sessionId);
919            }
920    
921            public static User getUser(HttpServletRequest request)
922                    throws PortalException, SystemException {
923    
924                    return getPortal().getUser(request);
925            }
926    
927            public static User getUser(PortletRequest portletRequest)
928                    throws PortalException, SystemException {
929    
930                    return getPortal().getUser(portletRequest);
931            }
932    
933            public static long getUserId(HttpServletRequest request) {
934                    return getPortal().getUserId(request);
935            }
936    
937            public static long getUserId(PortletRequest portletRequest) {
938                    return getPortal().getUserId(portletRequest);
939            }
940    
941            public static String getUserName(long userId, String defaultUserName) {
942                    return getPortal().getUserName(userId, defaultUserName);
943            }
944    
945            public static String getUserName(
946                    long userId, String defaultUserName, HttpServletRequest request) {
947    
948                    return getPortal().getUserName(userId, defaultUserName, request);
949            }
950    
951            public static String getUserName(
952                    long userId, String defaultUserName, String userAttribute) {
953    
954                    return getPortal().getUserName(userId, defaultUserName, userAttribute);
955            }
956    
957            public static String getUserName(
958                    long userId, String defaultUserName, String userAttribute,
959                    HttpServletRequest request) {
960    
961                    return getPortal().getUserName(
962                            userId, defaultUserName, userAttribute, request);
963            }
964    
965            public static String getUserPassword(HttpServletRequest request) {
966                    return getPortal().getUserPassword(request);
967            }
968    
969            public static String getUserPassword(HttpSession session) {
970                    return getPortal().getUserPassword(session);
971            }
972    
973            public static String getUserPassword(PortletRequest portletRequest) {
974                    return getPortal().getUserPassword(portletRequest);
975            }
976    
977            public static String getUserValue(
978                            long userId, String param, String defaultValue)
979                    throws SystemException {
980    
981                    return getPortal().getUserValue(userId, param, defaultValue);
982            }
983    
984            public static long getValidUserId(long companyId, long userId)
985                    throws PortalException, SystemException {
986    
987                    return getPortal().getValidUserId(companyId, userId);
988            }
989    
990            public static String getWidgetURL(
991                            Portlet portlet, ThemeDisplay themeDisplay)
992                    throws PortalException, SystemException {
993    
994                    return getPortal().getWidgetURL(portlet, themeDisplay);
995            }
996    
997            public static boolean isAllowAddPortletDefaultResource(
998                            HttpServletRequest request, Portlet portlet)
999                    throws PortalException, SystemException {
1000    
1001                    return getPortal().isAllowAddPortletDefaultResource(request, portlet);
1002            }
1003    
1004            public static boolean isCommunityAdmin(User user, long groupId)
1005                    throws Exception {
1006    
1007                    return getPortal().isCommunityAdmin(user, groupId);
1008            }
1009    
1010            public static boolean isCommunityOwner(User user, long groupId)
1011                    throws Exception {
1012    
1013                    return getPortal().isCommunityOwner(user, groupId);
1014            }
1015    
1016            public static boolean isCompanyAdmin(User user) throws Exception {
1017                    return getPortal().isCompanyAdmin(user);
1018            }
1019    
1020            public static boolean isControlPanelPortlet(
1021                            String portletId, String category, ThemeDisplay themeDisplay)
1022                    throws SystemException {
1023    
1024                    return getPortal().isControlPanelPortlet(
1025                            portletId, category, themeDisplay);
1026            }
1027    
1028            public static boolean isControlPanelPortlet(
1029                            String portletId, ThemeDisplay themeDisplay)
1030                    throws SystemException {
1031    
1032                    return getPortal().isControlPanelPortlet(portletId, themeDisplay);
1033            }
1034    
1035            public static boolean isLayoutFirstPageable(Layout layout) {
1036                    return getPortal().isLayoutFirstPageable(layout);
1037            }
1038    
1039            public static boolean isLayoutFirstPageable(String type) {
1040                    return getPortal().isLayoutFirstPageable(type);
1041            }
1042    
1043            public static boolean isLayoutFriendliable(Layout layout) {
1044                    return getPortal().isLayoutFriendliable(layout);
1045            }
1046    
1047            public static boolean isLayoutFriendliable(String type) {
1048                    return getPortal().isLayoutFriendliable(type);
1049            }
1050    
1051            public static boolean isLayoutParentable(Layout layout) {
1052                    return getPortal().isLayoutParentable(layout);
1053            }
1054    
1055            public static boolean isLayoutParentable(String type) {
1056                    return getPortal().isLayoutParentable(type);
1057            }
1058    
1059            public static boolean isLayoutSitemapable(Layout layout) {
1060                    return getPortal().isLayoutSitemapable(layout);
1061            }
1062    
1063            public static boolean isMethodGet(PortletRequest portletRequest) {
1064                    return getPortal().isMethodGet(portletRequest);
1065            }
1066    
1067            public static boolean isMethodPost(PortletRequest portletRequest) {
1068                    return getPortal().isMethodPost(portletRequest);
1069            }
1070    
1071            public static boolean isOmniadmin(long userId) {
1072                    return getPortal().isOmniadmin(userId);
1073            }
1074    
1075            public static boolean isReservedParameter(String name) {
1076                    return getPortal().isReservedParameter(name);
1077            }
1078    
1079            public static boolean isSystemGroup(String groupName) {
1080                    return getPortal().isSystemGroup(groupName);
1081            }
1082    
1083            public static boolean isSystemRole(String roleName) {
1084                    return getPortal().isSystemRole(roleName);
1085            }
1086    
1087            public static boolean isUpdateAvailable() throws SystemException {
1088                    return getPortal().isUpdateAvailable();
1089            }
1090    
1091            public static boolean isValidResourceId(String resourceId) {
1092                    return getPortal().isValidResourceId(resourceId);
1093            }
1094    
1095            public void removePortalPortEventListener(
1096                    PortalPortEventListener portalPortEventListener) {
1097    
1098                    getPortal().removePortalPortEventListener(portalPortEventListener);
1099            }
1100    
1101            public static String renderPage(
1102                            ServletContext servletContext, HttpServletRequest request,
1103                            HttpServletResponse response, String path, boolean writeOutput)
1104                    throws IOException, ServletException {
1105    
1106                    return getPortal().renderPage(servletContext, request, response, path);
1107            }
1108    
1109            public static String renderPortlet(
1110                            ServletContext servletContext, HttpServletRequest request,
1111                            HttpServletResponse response, Portlet portlet, String queryString,
1112                            boolean writeOutput)
1113                    throws IOException, ServletException {
1114    
1115                    return getPortal().renderPortlet(
1116                            servletContext, request, response, portlet, queryString,
1117                            writeOutput);
1118            }
1119    
1120            public static String renderPortlet(
1121                            ServletContext servletContext, HttpServletRequest request,
1122                            HttpServletResponse response, Portlet portlet, String queryString,
1123                            String columnId, Integer columnPos, Integer columnCount,
1124                            boolean writeOutput)
1125                    throws IOException, ServletException {
1126    
1127                    return getPortal().renderPortlet(
1128                            servletContext, request, response, portlet, queryString, columnId,
1129                            columnPos, columnCount, writeOutput);
1130            }
1131    
1132            public static String renderPortlet(
1133                            ServletContext servletContext, HttpServletRequest request,
1134                            HttpServletResponse response, Portlet portlet, String queryString,
1135                            String columnId, Integer columnPos, Integer columnCount,
1136                            String path, boolean writeOutput)
1137                    throws IOException, ServletException {
1138    
1139                    return getPortal().renderPortlet(
1140                            servletContext, request, response, portlet, queryString, columnId,
1141                            columnPos, columnCount, path, writeOutput);
1142            }
1143    
1144            /**
1145             * @deprecated {@link DB#runSQL(String)}
1146             */
1147            public static void runSQL(String sql) throws IOException, SQLException {
1148                    DBFactoryUtil.getDB().runSQL(sql);
1149            }
1150    
1151            public static void sendError(
1152                            Exception e, ActionRequest actionRequest,
1153                            ActionResponse actionResponse)
1154                    throws IOException {
1155    
1156                    getPortal().sendError(e, actionRequest, actionResponse);
1157            }
1158    
1159            public static void sendError(
1160                            Exception e, HttpServletRequest request,
1161                            HttpServletResponse response)
1162                    throws IOException, ServletException {
1163    
1164                    getPortal().sendError(e, request, response);
1165            }
1166    
1167            public static void sendError(
1168                            int status, Exception e, ActionRequest actionRequest,
1169                            ActionResponse actionResponse)
1170                    throws IOException {
1171    
1172                    getPortal().sendError(status, e, actionRequest, actionResponse);
1173            }
1174    
1175            public static void sendError(
1176                            int status, Exception e, HttpServletRequest request,
1177                            HttpServletResponse response)
1178                    throws IOException, ServletException {
1179    
1180                    getPortal().sendError(status, e, request, response);
1181            }
1182    
1183            /**
1184             * Sets the description for a page. This overrides the existing page
1185             * description.
1186             */
1187            public static void setPageDescription(
1188                    String description, HttpServletRequest request) {
1189    
1190                    getPortal().setPageDescription(description, request);
1191            }
1192    
1193            /**
1194             * Sets the keywords for a page. This overrides the existing page keywords.
1195             */
1196            public static void setPageKeywords(
1197                    String keywords, HttpServletRequest request) {
1198    
1199                    getPortal().setPageKeywords(keywords, request);
1200            }
1201    
1202            /**
1203             * Sets the subtitle for a page. This overrides the existing page subtitle.
1204             */
1205            public static void setPageSubtitle(
1206                    String subtitle, HttpServletRequest request) {
1207    
1208                    getPortal().setPageSubtitle(subtitle, request);
1209            }
1210    
1211            /**
1212             * Sets the whole title for a page. This overrides the existing page whole
1213             * title.
1214             */
1215            public static void setPageTitle(
1216                    String title, HttpServletRequest request) {
1217    
1218                    getPortal().setPageTitle(title, request);
1219            }
1220    
1221            /**
1222             * Sets the port obtained on the first request to the portal.
1223             */
1224            public static void setPortalPort(HttpServletRequest request) {
1225                    getPortal().setPortalPort(request);
1226            }
1227    
1228            public static void storePreferences(PortletPreferences preferences)
1229                    throws IOException, ValidatorException {
1230    
1231                    getPortal().storePreferences(preferences);
1232            }
1233    
1234            public static String transformCustomSQL(String sql) {
1235                    return getPortal().transformCustomSQL(sql);
1236            }
1237    
1238            public static PortletMode updatePortletMode(
1239                    String portletId, User user, Layout layout, PortletMode portletMode,
1240                    HttpServletRequest request) {
1241    
1242                    return getPortal().updatePortletMode(
1243                            portletId, user, layout, portletMode, request);
1244            }
1245    
1246            public static WindowState updateWindowState(
1247                    String portletId, User user, Layout layout, WindowState windowState,
1248                    HttpServletRequest request) {
1249    
1250                    return getPortal().updateWindowState(
1251                            portletId, user, layout, windowState, request);
1252            }
1253    
1254            public void setPortal(Portal portal) {
1255                    _portal = portal;
1256            }
1257    
1258            private static Portal _portal;
1259    
1260    }