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