001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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 String getOuterPortletId(HttpServletRequest request) {
621                    return getPortal().getOuterPortletId(request);
622            }
623    
624            public static long getParentGroupId(long scopeGroupId)
625                    throws PortalException, SystemException {
626    
627                    return getPortal().getParentGroupId(scopeGroupId);
628            }
629    
630            public static String getPathContext() {
631                    return getPortal().getPathContext();
632            }
633    
634            public static String getPathFriendlyURLPrivateGroup() {
635                    return getPortal().getPathFriendlyURLPrivateGroup();
636            }
637    
638            public static String getPathFriendlyURLPrivateUser() {
639                    return getPortal().getPathFriendlyURLPrivateUser();
640            }
641    
642            public static String getPathFriendlyURLPublic() {
643                    return getPortal().getPathFriendlyURLPublic();
644            }
645    
646            public static String getPathImage() {
647                    return getPortal().getPathImage();
648            }
649    
650            public static String getPathMain() {
651                    return getPortal().getPathMain();
652            }
653    
654            public static long getPlidFromFriendlyURL(
655                    long companyId, String friendlyURL) {
656    
657                    return getPortal().getPlidFromFriendlyURL(companyId, friendlyURL);
658            }
659    
660            public static long getPlidFromPortletId(
661                            long groupId, boolean privateLayout, String portletId)
662                    throws PortalException, SystemException {
663    
664                    return getPortal().getPlidFromPortletId(
665                            groupId, privateLayout, portletId);
666            }
667    
668            public static long getPlidFromPortletId(long groupId, String portletId)
669                    throws PortalException, SystemException {
670    
671                    return getPortal().getPlidFromPortletId(groupId, portletId);
672            }
673    
674            public static Portal getPortal() {
675                    return _portal;
676            }
677    
678            public static String getPortalLibDir() {
679                    return getPortal().getPortalLibDir();
680            }
681    
682            public static int getPortalPort() {
683                    return getPortal().getPortalPort();
684            }
685    
686            public static Properties getPortalProperties() {
687                    return getPortal().getPortalProperties();
688            }
689    
690            public static String getPortalURL(HttpServletRequest request) {
691                    return getPortal().getPortalURL(request);
692            }
693    
694            public static String getPortalURL(
695                    HttpServletRequest request, boolean secure) {
696    
697                    return getPortal().getPortalURL(request, secure);
698            }
699    
700            public static String getPortalURL(PortletRequest portletRequest) {
701                    return getPortal().getPortalURL(portletRequest);
702            }
703    
704            public static String getPortalURL(
705                    PortletRequest portletRequest, boolean secure) {
706    
707                    return getPortal().getPortalURL(portletRequest, secure);
708            }
709    
710            public static String getPortalURL(
711                    String serverName, int serverPort, boolean secure) {
712    
713                    return getPortal().getPortalURL(serverName, serverPort, secure);
714            }
715    
716            public static String getPortalURL(ThemeDisplay themeDisplay)
717                    throws PortalException, SystemException {
718    
719                    return getPortal().getPortalURL(themeDisplay);
720            }
721    
722            public static String getPortalWebDir() {
723                    return getPortal().getPortalWebDir();
724            }
725    
726            public static List<KeyValuePair> getPortletBreadcrumbList(
727                    HttpServletRequest request) {
728    
729                    return getPortal().getPortletBreadcrumbList(request);
730            }
731    
732            public static String getPortletDescription(
733                    Portlet portlet, ServletContext servletContext, Locale locale) {
734    
735                    return getPortal().getPortletDescription(
736                            portlet, servletContext, locale);
737            }
738    
739            public static String getPortletDescription(Portlet portlet, User user) {
740                    return getPortal().getPortletDescription(portlet, user);
741            }
742    
743            public static String getPortletDescription(
744                    String portletId, Locale locale) {
745    
746                    return getPortal().getPortletDescription(portletId, locale);
747            }
748    
749            public static String getPortletDescription(
750                    String portletId, String languageId) {
751    
752                    return getPortal().getPortletDescription(portletId, languageId);
753            }
754    
755            public static String getPortletDescription(String portletId, User user) {
756                    return getPortal().getPortletDescription(portletId, user);
757            }
758    
759            public static String getPortletId(HttpServletRequest request) {
760                    return getPortal().getPortletId(request);
761            }
762    
763            public static String getPortletId(PortletRequest portletRequest) {
764                    return getPortal().getPortletId(portletRequest);
765            }
766    
767            public static String getPortletNamespace(String portletId) {
768                    return getPortal().getPortletNamespace(portletId);
769            }
770    
771            public static String getPortletTitle(Portlet portlet, Locale locale) {
772                    return getPortal().getPortletTitle(portlet, locale);
773            }
774    
775            public static String getPortletTitle(
776                    Portlet portlet, ServletContext servletContext, Locale locale) {
777    
778                    return getPortal().getPortletTitle(portlet, servletContext, locale);
779            }
780    
781            public static String getPortletTitle(Portlet portlet, String languageId) {
782                    return getPortal().getPortletTitle(portlet, languageId);
783            }
784    
785            public static String getPortletTitle(Portlet portlet, User user) {
786                    return getPortal().getPortletTitle(portlet, user);
787            }
788    
789            public static String getPortletTitle(RenderResponse renderResponse) {
790                    return getPortal().getPortletTitle(renderResponse);
791            }
792    
793            public static String getPortletTitle(String portletId, Locale locale) {
794                    return getPortal().getPortletTitle(portletId, locale);
795            }
796    
797            public static String getPortletTitle(String portletId, String languageId) {
798                    return getPortal().getPortletTitle(portletId, languageId);
799            }
800    
801            public static String getPortletTitle(String portletId, User user) {
802                    return getPortal().getPortletTitle(portletId, user);
803            }
804    
805            public static String getPortletXmlFileName() throws SystemException {
806                    return getPortal().getPortletXmlFileName();
807            }
808    
809            public static PortletPreferences getPreferences(
810                    HttpServletRequest request) {
811    
812                    return getPortal().getPreferences(request);
813            }
814    
815            public static PreferencesValidator getPreferencesValidator(
816                    Portlet portlet) {
817    
818                    return getPortal().getPreferencesValidator(portlet);
819            }
820    
821            public static long getScopeGroupId(HttpServletRequest request)
822                    throws PortalException, SystemException {
823    
824                    return getPortal().getScopeGroupId(request);
825            }
826    
827            public static long getScopeGroupId(
828                            HttpServletRequest request, String portletId)
829                    throws PortalException, SystemException {
830    
831                    return getPortal().getScopeGroupId(request, portletId);
832            }
833    
834            public static long getScopeGroupId(Layout layout) {
835                    return getPortal().getScopeGroupId(layout);
836            }
837    
838            public static long getScopeGroupId(Layout layout, String portletId) {
839                    return getPortal().getScopeGroupId(layout, portletId);
840            }
841    
842            public static long getScopeGroupId(long plid) {
843                    return getPortal().getScopeGroupId(plid);
844            }
845    
846            public static long getScopeGroupId(PortletRequest portletRequest)
847                    throws PortalException, SystemException {
848    
849                    return getPortal().getScopeGroupId(portletRequest);
850            }
851    
852            public static User getSelectedUser(HttpServletRequest request)
853                    throws PortalException, SystemException {
854    
855                    return getPortal().getSelectedUser(request);
856            }
857    
858            public static User getSelectedUser(
859                            HttpServletRequest request, boolean checkPermission)
860                    throws PortalException, SystemException {
861    
862                    return getPortal().getSelectedUser(request, checkPermission);
863            }
864    
865            public static User getSelectedUser(PortletRequest portletRequest)
866                    throws PortalException, SystemException {
867    
868                    return getPortal().getSelectedUser(portletRequest);
869            }
870    
871            public static User getSelectedUser(
872                            PortletRequest portletRequest, boolean checkPermission)
873                    throws PortalException, SystemException {
874    
875                    return getPortal().getSelectedUser(portletRequest, checkPermission);
876            }
877    
878            public static ServletContext getServletContext(
879                    Portlet portlet, ServletContext servletContext) {
880    
881                    return getPortal().getServletContext(portlet, servletContext);
882            }
883    
884            public static SocialEquityActionMapping getSocialEquityActionMapping(
885                    String name, String actionId) {
886    
887                    return getPortal().getSocialEquityActionMapping(name, actionId);
888            }
889    
890            public static List<SocialEquityActionMapping> getSocialEquityActionMappings(
891                    String name) {
892    
893                    return getPortal().getSocialEquityActionMappings(name);
894            }
895    
896            public static String[] getSocialEquityClassNames() {
897                    return getPortal().getSocialEquityClassNames();
898            }
899    
900            public static String getStaticResourceURL(
901                    HttpServletRequest request, String uri) {
902    
903                    return getPortal().getStaticResourceURL(request, uri);
904            }
905    
906            public static String getStaticResourceURL(
907                    HttpServletRequest request, String uri, long timestamp) {
908    
909                    return getPortal().getStaticResourceURL(request, uri, timestamp);
910            }
911    
912            public static String getStaticResourceURL(
913                    HttpServletRequest request, String uri, String queryString) {
914    
915                    return getPortal().getStaticResourceURL(request, uri, queryString);
916            }
917    
918            public static String getStaticResourceURL(
919                    HttpServletRequest request, String uri, String queryString,
920                    long timestamp) {
921    
922                    return getPortal().getStaticResourceURL(
923                            request, uri, queryString, timestamp);
924            }
925    
926            public static String getStrutsAction(HttpServletRequest request) {
927                    return getPortal().getStrutsAction(request);
928            }
929    
930            public static String[] getSystemCommunityRoles() {
931                    return getPortal().getSystemCommunityRoles();
932            }
933    
934            public static String[] getSystemGroups() {
935                    return getPortal().getSystemGroups();
936            }
937    
938            public static String[] getSystemOrganizationRoles() {
939                    return getPortal().getSystemOrganizationRoles();
940            }
941    
942            public static String[] getSystemRoles() {
943                    return getPortal().getSystemRoles();
944            }
945    
946            public static UploadServletRequest getUploadServletRequest(
947                    HttpServletRequest request) {
948    
949                    return getPortal().getUploadServletRequest(request);
950            }
951    
952            public static UploadPortletRequest getUploadPortletRequest(
953                    PortletRequest portletRequest) {
954    
955                    return getPortal().getUploadPortletRequest(portletRequest);
956            }
957    
958            public static Date getUptime() {
959                    return getPortal().getUptime();
960            }
961    
962            public static String getURLWithSessionId(String url, String sessionId) {
963                    return getPortal().getURLWithSessionId(url, sessionId);
964            }
965    
966            public static User getUser(HttpServletRequest request)
967                    throws PortalException, SystemException {
968    
969                    return getPortal().getUser(request);
970            }
971    
972            public static User getUser(PortletRequest portletRequest)
973                    throws PortalException, SystemException {
974    
975                    return getPortal().getUser(portletRequest);
976            }
977    
978            public static long getUserId(HttpServletRequest request) {
979                    return getPortal().getUserId(request);
980            }
981    
982            public static long getUserId(PortletRequest portletRequest) {
983                    return getPortal().getUserId(portletRequest);
984            }
985    
986            public static String getUserName(long userId, String defaultUserName) {
987                    return getPortal().getUserName(userId, defaultUserName);
988            }
989    
990            public static String getUserName(
991                    long userId, String defaultUserName, HttpServletRequest request) {
992    
993                    return getPortal().getUserName(userId, defaultUserName, request);
994            }
995    
996            public static String getUserName(
997                    long userId, String defaultUserName, String userAttribute) {
998    
999                    return getPortal().getUserName(userId, defaultUserName, userAttribute);
1000            }
1001    
1002            public static String getUserName(
1003                    long userId, String defaultUserName, String userAttribute,
1004                    HttpServletRequest request) {
1005    
1006                    return getPortal().getUserName(
1007                            userId, defaultUserName, userAttribute, request);
1008            }
1009    
1010            public static String getUserPassword(HttpServletRequest request) {
1011                    return getPortal().getUserPassword(request);
1012            }
1013    
1014            public static String getUserPassword(HttpSession session) {
1015                    return getPortal().getUserPassword(session);
1016            }
1017    
1018            public static String getUserPassword(PortletRequest portletRequest) {
1019                    return getPortal().getUserPassword(portletRequest);
1020            }
1021    
1022            public static String getUserValue(
1023                            long userId, String param, String defaultValue)
1024                    throws SystemException {
1025    
1026                    return getPortal().getUserValue(userId, param, defaultValue);
1027            }
1028    
1029            public static long getValidUserId(long companyId, long userId)
1030                    throws PortalException, SystemException {
1031    
1032                    return getPortal().getValidUserId(companyId, userId);
1033            }
1034    
1035            public static String getWidgetURL(
1036                            Portlet portlet, ThemeDisplay themeDisplay)
1037                    throws PortalException, SystemException {
1038    
1039                    return getPortal().getWidgetURL(portlet, themeDisplay);
1040            }
1041    
1042            public static boolean isAllowAddPortletDefaultResource(
1043                            HttpServletRequest request, Portlet portlet)
1044                    throws PortalException, SystemException {
1045    
1046                    return getPortal().isAllowAddPortletDefaultResource(request, portlet);
1047            }
1048    
1049            public static boolean isCommunityAdmin(User user, long groupId)
1050                    throws Exception {
1051    
1052                    return getPortal().isCommunityAdmin(user, groupId);
1053            }
1054    
1055            public static boolean isCommunityOwner(User user, long groupId)
1056                    throws Exception {
1057    
1058                    return getPortal().isCommunityOwner(user, groupId);
1059            }
1060    
1061            public static boolean isCompanyAdmin(User user) throws Exception {
1062                    return getPortal().isCompanyAdmin(user);
1063            }
1064    
1065            public static boolean isControlPanelPortlet(
1066                            String portletId, String category, ThemeDisplay themeDisplay)
1067                    throws SystemException {
1068    
1069                    return getPortal().isControlPanelPortlet(
1070                            portletId, category, themeDisplay);
1071            }
1072    
1073            public static boolean isControlPanelPortlet(
1074                            String portletId, ThemeDisplay themeDisplay)
1075                    throws SystemException {
1076    
1077                    return getPortal().isControlPanelPortlet(portletId, themeDisplay);
1078            }
1079    
1080            public static boolean isLayoutFirstPageable(Layout layout) {
1081                    return getPortal().isLayoutFirstPageable(layout);
1082            }
1083    
1084            public static boolean isLayoutFirstPageable(String type) {
1085                    return getPortal().isLayoutFirstPageable(type);
1086            }
1087    
1088            public static boolean isLayoutFriendliable(Layout layout) {
1089                    return getPortal().isLayoutFriendliable(layout);
1090            }
1091    
1092            public static boolean isLayoutFriendliable(String type) {
1093                    return getPortal().isLayoutFriendliable(type);
1094            }
1095    
1096            public static boolean isLayoutParentable(Layout layout) {
1097                    return getPortal().isLayoutParentable(layout);
1098            }
1099    
1100            public static boolean isLayoutParentable(String type) {
1101                    return getPortal().isLayoutParentable(type);
1102            }
1103    
1104            public static boolean isLayoutSitemapable(Layout layout) {
1105                    return getPortal().isLayoutSitemapable(layout);
1106            }
1107    
1108            public static boolean isMethodGet(PortletRequest portletRequest) {
1109                    return getPortal().isMethodGet(portletRequest);
1110            }
1111    
1112            public static boolean isMethodPost(PortletRequest portletRequest) {
1113                    return getPortal().isMethodPost(portletRequest);
1114            }
1115    
1116            public static boolean isOmniadmin(long userId) {
1117                    return getPortal().isOmniadmin(userId);
1118            }
1119    
1120            public static boolean isReservedParameter(String name) {
1121                    return getPortal().isReservedParameter(name);
1122            }
1123    
1124            public static boolean isSystemGroup(String groupName) {
1125                    return getPortal().isSystemGroup(groupName);
1126            }
1127    
1128            public static boolean isSystemRole(String roleName) {
1129                    return getPortal().isSystemRole(roleName);
1130            }
1131    
1132            public static boolean isUpdateAvailable() throws SystemException {
1133                    return getPortal().isUpdateAvailable();
1134            }
1135    
1136            public static boolean isValidResourceId(String resourceId) {
1137                    return getPortal().isValidResourceId(resourceId);
1138            }
1139    
1140            public void removePortalPortEventListener(
1141                    PortalPortEventListener portalPortEventListener) {
1142    
1143                    getPortal().removePortalPortEventListener(portalPortEventListener);
1144            }
1145    
1146            public static String renderPage(
1147                            ServletContext servletContext, HttpServletRequest request,
1148                            HttpServletResponse response, String path, boolean writeOutput)
1149                    throws IOException, ServletException {
1150    
1151                    return getPortal().renderPage(servletContext, request, response, path);
1152            }
1153    
1154            public static String renderPortlet(
1155                            ServletContext servletContext, HttpServletRequest request,
1156                            HttpServletResponse response, Portlet portlet, String queryString,
1157                            boolean writeOutput)
1158                    throws IOException, ServletException {
1159    
1160                    return getPortal().renderPortlet(
1161                            servletContext, request, response, portlet, queryString,
1162                            writeOutput);
1163            }
1164    
1165            public static String renderPortlet(
1166                            ServletContext servletContext, HttpServletRequest request,
1167                            HttpServletResponse response, Portlet portlet, String queryString,
1168                            String columnId, Integer columnPos, Integer columnCount,
1169                            boolean writeOutput)
1170                    throws IOException, ServletException {
1171    
1172                    return getPortal().renderPortlet(
1173                            servletContext, request, response, portlet, queryString, columnId,
1174                            columnPos, columnCount, writeOutput);
1175            }
1176    
1177            public static String renderPortlet(
1178                            ServletContext servletContext, HttpServletRequest request,
1179                            HttpServletResponse response, Portlet portlet, String queryString,
1180                            String columnId, Integer columnPos, Integer columnCount,
1181                            String path, boolean writeOutput)
1182                    throws IOException, ServletException {
1183    
1184                    return getPortal().renderPortlet(
1185                            servletContext, request, response, portlet, queryString, columnId,
1186                            columnPos, columnCount, path, writeOutput);
1187            }
1188    
1189            /**
1190             * @deprecated {@link DB#runSQL(String)}
1191             */
1192            public static void runSQL(String sql) throws IOException, SQLException {
1193                    DBFactoryUtil.getDB().runSQL(sql);
1194            }
1195    
1196            public static void sendError(
1197                            Exception e, ActionRequest actionRequest,
1198                            ActionResponse actionResponse)
1199                    throws IOException {
1200    
1201                    getPortal().sendError(e, actionRequest, actionResponse);
1202            }
1203    
1204            public static void sendError(
1205                            Exception e, HttpServletRequest request,
1206                            HttpServletResponse response)
1207                    throws IOException, ServletException {
1208    
1209                    getPortal().sendError(e, request, response);
1210            }
1211    
1212            public static void sendError(
1213                            int status, Exception e, ActionRequest actionRequest,
1214                            ActionResponse actionResponse)
1215                    throws IOException {
1216    
1217                    getPortal().sendError(status, e, actionRequest, actionResponse);
1218            }
1219    
1220            public static void sendError(
1221                            int status, Exception e, HttpServletRequest request,
1222                            HttpServletResponse response)
1223                    throws IOException, ServletException {
1224    
1225                    getPortal().sendError(status, e, request, response);
1226            }
1227    
1228            /**
1229             * Sets the description for a page. This overrides the existing page
1230             * description.
1231             */
1232            public static void setPageDescription(
1233                    String description, HttpServletRequest request) {
1234    
1235                    getPortal().setPageDescription(description, request);
1236            }
1237    
1238            /**
1239             * Sets the keywords for a page. This overrides the existing page keywords.
1240             */
1241            public static void setPageKeywords(
1242                    String keywords, HttpServletRequest request) {
1243    
1244                    getPortal().setPageKeywords(keywords, request);
1245            }
1246    
1247            /**
1248             * Sets the subtitle for a page. This overrides the existing page subtitle.
1249             */
1250            public static void setPageSubtitle(
1251                    String subtitle, HttpServletRequest request) {
1252    
1253                    getPortal().setPageSubtitle(subtitle, request);
1254            }
1255    
1256            /**
1257             * Sets the whole title for a page. This overrides the existing page whole
1258             * title.
1259             */
1260            public static void setPageTitle(
1261                    String title, HttpServletRequest request) {
1262    
1263                    getPortal().setPageTitle(title, request);
1264            }
1265    
1266            /**
1267             * Sets the port obtained on the first request to the portal.
1268             */
1269            public static void setPortalPort(HttpServletRequest request) {
1270                    getPortal().setPortalPort(request);
1271            }
1272    
1273            public static void storePreferences(PortletPreferences preferences)
1274                    throws IOException, ValidatorException {
1275    
1276                    getPortal().storePreferences(preferences);
1277            }
1278    
1279            public static String transformCustomSQL(String sql) {
1280                    return getPortal().transformCustomSQL(sql);
1281            }
1282    
1283            public static PortletMode updatePortletMode(
1284                    String portletId, User user, Layout layout, PortletMode portletMode,
1285                    HttpServletRequest request) {
1286    
1287                    return getPortal().updatePortletMode(
1288                            portletId, user, layout, portletMode, request);
1289            }
1290    
1291            public static WindowState updateWindowState(
1292                    String portletId, User user, Layout layout, WindowState windowState,
1293                    HttpServletRequest request) {
1294    
1295                    return getPortal().updateWindowState(
1296                            portletId, user, layout, windowState, request);
1297            }
1298    
1299            public void setPortal(Portal portal) {
1300                    _portal = portal;
1301            }
1302    
1303            private static Portal _portal;
1304    
1305    }