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