1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.util;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.dao.db.DB;
28  import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
29  import com.liferay.portal.kernel.upload.UploadPortletRequest;
30  import com.liferay.portal.kernel.upload.UploadServletRequest;
31  import com.liferay.portal.model.BaseModel;
32  import com.liferay.portal.model.Company;
33  import com.liferay.portal.model.Layout;
34  import com.liferay.portal.model.LayoutSet;
35  import com.liferay.portal.model.Portlet;
36  import com.liferay.portal.model.Resource;
37  import com.liferay.portal.model.ResourcePermission;
38  import com.liferay.portal.model.User;
39  import com.liferay.portal.service.persistence.BasePersistence;
40  import com.liferay.portal.theme.ThemeDisplay;
41  import com.liferay.portlet.expando.model.ExpandoBridge;
42  
43  import java.io.IOException;
44  import java.io.Serializable;
45  
46  import java.sql.SQLException;
47  
48  import java.util.Date;
49  import java.util.List;
50  import java.util.Locale;
51  import java.util.Map;
52  import java.util.Properties;
53  import java.util.TimeZone;
54  
55  import javax.portlet.ActionRequest;
56  import javax.portlet.ActionResponse;
57  import javax.portlet.PortletMode;
58  import javax.portlet.PortletPreferences;
59  import javax.portlet.PortletRequest;
60  import javax.portlet.PortletResponse;
61  import javax.portlet.PreferencesValidator;
62  import javax.portlet.RenderRequest;
63  import javax.portlet.ValidatorException;
64  import javax.portlet.WindowState;
65  
66  import javax.servlet.ServletContext;
67  import javax.servlet.ServletException;
68  import javax.servlet.http.HttpServletRequest;
69  import javax.servlet.http.HttpServletResponse;
70  import javax.servlet.http.HttpSession;
71  import javax.servlet.jsp.PageContext;
72  
73  /**
74   * <a href="PortalUtil.java.html"><b><i>View Source</i></b></a>
75   *
76   * @author Brian Wing Shun Chan
77   * @author Eduardo Lundgren
78   */
79  public class PortalUtil {
80  
81      /**
82       * Adds the description for a page. This appends to the existing page
83       * description.
84       */
85      public static void addPageDescription(
86          String description, HttpServletRequest request) {
87  
88          getPortal().addPageDescription(description, request);
89      }
90  
91      /**
92       * Adds the keywords for a page. This appends to the existing page keywords.
93       */
94      public static void addPageKeywords(
95          String keywords, HttpServletRequest request) {
96  
97          getPortal().addPageKeywords(keywords, request);
98      }
99  
100     /**
101      * Adds the subtitle for a page. This appends to the existing page subtitle.
102      */
103     public static void addPageSubtitle(
104         String subtitle, HttpServletRequest request) {
105 
106         getPortal().addPageSubtitle(subtitle, request);
107     }
108 
109     /**
110      * Adds the whole title for a page. This appends to the existing page whole
111      * title.
112      */
113     public static void addPageTitle(String title, HttpServletRequest request) {
114         getPortal().addPageTitle(title, request);
115     }
116 
117     public static void clearRequestParameters(RenderRequest renderRequest) {
118         getPortal().clearRequestParameters(renderRequest);
119     }
120 
121     public static void copyRequestParameters(
122         ActionRequest actionRequest, ActionResponse actionResponse) {
123 
124         getPortal().copyRequestParameters(actionRequest, actionResponse);
125     }
126 
127     public static String escapeRedirect(String url) {
128         return getPortal().escapeRedirect(url);
129     }
130 
131     public static BaseModel<?> getBaseModel(Resource resource)
132         throws PortalException, SystemException {
133 
134         return getPortal().getBaseModel(resource);
135     }
136 
137     public static BaseModel<?> getBaseModel(
138             ResourcePermission resourcePermission)
139         throws PortalException, SystemException {
140 
141         return getPortal().getBaseModel(resourcePermission);
142     }
143 
144     public static BaseModel<?> getBaseModel(String modelName, String primKey)
145         throws PortalException, SystemException {
146 
147         return getPortal().getBaseModel(modelName, primKey);
148     }
149 
150     public static BasePersistence<?> getBasePersistence(
151         BaseModel<?> baseModel) {
152 
153         return getPortal().getBasePersistence(baseModel);
154     }
155 
156     public static BasePersistence<?> getBasePersistence(
157         String servletContextName, String className) {
158 
159         return getPortal().getBasePersistence(servletContextName, className);
160     }
161 
162     public static long getBasicAuthUserId(HttpServletRequest request)
163         throws PortalException, SystemException {
164 
165         return getPortal().getBasicAuthUserId(request);
166     }
167 
168     public static long getBasicAuthUserId(
169             HttpServletRequest request, long companyId)
170         throws PortalException, SystemException {
171 
172         return getPortal().getBasicAuthUserId(request, companyId);
173     }
174 
175     /**
176      * @deprecated {@link #getCDNHost(boolean)}
177      */
178     public static String getCDNHost() {
179         return getPortal().getCDNHost();
180     }
181 
182     public static String getCDNHost(boolean secure) {
183         return getPortal().getCDNHost(secure);
184     }
185 
186     public static String getCDNHostHttp() {
187         return getPortal().getCDNHostHttp();
188     }
189 
190     public static String getCDNHostHttps() {
191         return getPortal().getCDNHostHttps();
192     }
193 
194     public static String getClassName(long classNameId) {
195         return getPortal().getClassName(classNameId);
196     }
197 
198     public static long getClassNameId(Class<?> classObj) {
199         return getPortal().getClassNameId(classObj);
200     }
201 
202     public static long getClassNameId(String value) {
203         return getPortal().getClassNameId(value);
204     }
205 
206     public static String getClassNamePortletId(String className) {
207         return getPortal().getClassNamePortletId(className);
208     }
209 
210     public static String getCommunityLoginURL(ThemeDisplay themeDisplay)
211         throws PortalException, SystemException {
212 
213         return getPortal().getCommunityLoginURL(themeDisplay);
214     }
215 
216     public static String[] getCommunityPermissions(HttpServletRequest request) {
217         return getPortal().getCommunityPermissions(request);
218     }
219 
220     public static String[] getCommunityPermissions(
221         PortletRequest portletRequest) {
222 
223         return getPortal().getCommunityPermissions(portletRequest);
224     }
225 
226     public static Company getCompany(HttpServletRequest request)
227         throws PortalException, SystemException {
228 
229         return getPortal().getCompany(request);
230     }
231 
232     public static Company getCompany(PortletRequest portletRequest)
233         throws PortalException, SystemException {
234 
235         return getPortal().getCompany(portletRequest);
236     }
237 
238     public static long getCompanyId(HttpServletRequest request) {
239         return getPortal().getCompanyId(request);
240     }
241 
242     public static long getCompanyId(PortletRequest portletRequest) {
243         return getPortal().getCompanyId(portletRequest);
244     }
245 
246     public static long[] getCompanyIds() {
247         return getPortal().getCompanyIds();
248     }
249 
250     public static String getComputerAddress() {
251         return getPortal().getComputerAddress();
252     }
253 
254     public static String getComputerName() {
255         return getPortal().getComputerName();
256     }
257 
258     public static String getControlPanelCategory(
259             String portletId, ThemeDisplay themeDisplay)
260         throws SystemException {
261 
262         return getPortal().getControlPanelCategory(portletId, themeDisplay);
263     }
264 
265     public static List<Portlet> getControlPanelPortlets(
266             String category, ThemeDisplay themeDisplay)
267         throws SystemException {
268 
269         return getPortal().getControlPanelPortlets(
270             category, themeDisplay);
271     }
272 
273     public static String getCurrentCompleteURL(HttpServletRequest request) {
274         return getPortal().getCurrentCompleteURL(request);
275     }
276 
277     public static String getCurrentURL(HttpServletRequest request) {
278         return getPortal().getCurrentURL(request);
279     }
280 
281     public static String getCurrentURL(PortletRequest portletRequest) {
282         return getPortal().getCurrentURL(portletRequest);
283     }
284 
285     public static String getCustomSQLFunctionIsNotNull() {
286         return getPortal().getCustomSQLFunctionIsNotNull();
287     }
288 
289     public static String getCustomSQLFunctionIsNull() {
290         return getPortal().getCustomSQLFunctionIsNull();
291     }
292 
293     public static Date getDate(
294             int month, int day, int year, int hour, int min, PortalException pe)
295         throws PortalException {
296 
297         return getPortal().getDate(month, day, year, hour, min, pe);
298     }
299 
300     public static Date getDate(
301             int month, int day, int year, int hour, int min, TimeZone timeZone,
302             PortalException pe)
303         throws PortalException {
304 
305         return getPortal().getDate(month, day, year, hour, min, timeZone, pe);
306     }
307 
308     public static Date getDate(int month, int day, int year, PortalException pe)
309         throws PortalException {
310 
311         return getPortal().getDate(month, day, year, pe);
312     }
313 
314     public static Date getDate(
315             int month, int day, int year, TimeZone timeZone, PortalException pe)
316         throws PortalException {
317 
318         return getPortal().getDate(month, day, year, timeZone, pe);
319     }
320 
321     /**
322      * @deprecated {@link DBFactoryUtil#getDB()}
323      */
324     public static DB getDB() {
325         return DBFactoryUtil.getDB();
326     }
327 
328     public static long getDefaultCompanyId() {
329         return getPortal().getDefaultCompanyId();
330     }
331 
332     public static Map<String, Serializable> getExpandoBridgeAttributes(
333             ExpandoBridge expandoBridge, PortletRequest portletRequest)
334         throws PortalException, SystemException {
335 
336         return getPortal().getExpandoBridgeAttributes(
337             expandoBridge, portletRequest);
338     }
339 
340     public static String getFirstPageLayoutTypes(PageContext pageContext) {
341         return getPortal().getFirstPageLayoutTypes(pageContext);
342     }
343 
344     public static String getGlobalLibDir() {
345         return getPortal().getGlobalLibDir();
346     }
347 
348     public static String getGoogleGadgetURL(
349         Portlet portlet, ThemeDisplay themeDisplay) {
350 
351         return getPortal().getGoogleGadgetURL(portlet, themeDisplay);
352     }
353 
354     public static String[] getGuestPermissions(HttpServletRequest request) {
355         return getPortal().getGuestPermissions(request);
356     }
357 
358     public static String[] getGuestPermissions(PortletRequest portletRequest) {
359         return getPortal().getGuestPermissions(portletRequest);
360     }
361 
362     public static String getHomeURL(HttpServletRequest request)
363         throws PortalException, SystemException {
364 
365         return getPortal().getHomeURL(request);
366     }
367 
368     public static String getHost(HttpServletRequest request) {
369         return getPortal().getHost(request);
370     }
371 
372     public static String getHost(PortletRequest portletRequest) {
373         return getPortal().getHost(portletRequest);
374     }
375 
376     public static HttpServletRequest getHttpServletRequest(
377         PortletRequest portletRequest) {
378 
379         return getPortal().getHttpServletRequest(portletRequest);
380     }
381 
382     public static HttpServletResponse getHttpServletResponse(
383         PortletResponse portletResponse) {
384 
385         return getPortal().getHttpServletResponse(portletResponse);
386     }
387 
388     public static String getJsSafePortletId(String portletId) {
389         return getPortal().getJsSafePortletId(portletId);
390     }
391 
392     public static String getLayoutActualURL(Layout layout) {
393         return getPortal().getLayoutActualURL(layout);
394     }
395 
396     public static String getLayoutActualURL(Layout layout, String mainPath) {
397         return getPortal().getLayoutActualURL(layout, mainPath);
398     }
399 
400     public static String getLayoutActualURL(
401             long groupId, boolean privateLayout, String mainPath,
402             String friendlyURL)
403         throws PortalException, SystemException {
404 
405         return getPortal().getLayoutActualURL(
406             groupId, privateLayout, mainPath, friendlyURL);
407     }
408 
409     public static String getLayoutActualURL(
410             long groupId, boolean privateLayout, String mainPath,
411             String friendlyURL, Map<String, String[]> params)
412         throws PortalException, SystemException {
413 
414         return getPortal().getLayoutActualURL(
415             groupId, privateLayout, mainPath, friendlyURL, params);
416     }
417 
418     public static String getLayoutEditPage(Layout layout) {
419         return getPortal().getLayoutEditPage(layout);
420     }
421 
422     public static String getLayoutFriendlyURL(
423         Layout layout, ThemeDisplay themeDisplay) {
424 
425         return getPortal().getLayoutFriendlyURL(layout, themeDisplay);
426     }
427 
428     public static String getLayoutFriendlyURL(
429         Layout layout, ThemeDisplay themeDisplay, Locale locale) {
430 
431         return getPortal().getLayoutFriendlyURL(layout, themeDisplay, locale);
432     }
433 
434     public static String getLayoutFullURL(
435         Layout layout, ThemeDisplay themeDisplay) {
436 
437         return getPortal().getLayoutFullURL(layout, themeDisplay);
438     }
439 
440     public static String getLayoutFullURL(
441         Layout layout, ThemeDisplay themeDisplay, boolean doAsUser) {
442 
443         return getPortal().getLayoutFullURL(layout, themeDisplay, doAsUser);
444     }
445 
446     public static String getLayoutFullURL(long groupId, String portletId)
447         throws PortalException, SystemException {
448 
449         return getPortal().getLayoutFullURL(groupId, portletId);
450     }
451 
452     public static String getLayoutFullURL(ThemeDisplay themeDisplay) {
453         return getPortal().getLayoutFullURL(themeDisplay);
454     }
455 
456     public static String getLayoutSetFriendlyURL(
457             LayoutSet layoutSet, ThemeDisplay themeDisplay)
458         throws PortalException, SystemException {
459 
460         return getPortal().getLayoutSetFriendlyURL(layoutSet, themeDisplay);
461     }
462 
463     public static String getLayoutTarget(Layout layout) {
464         return getPortal().getLayoutTarget(layout);
465     }
466 
467     public static String getLayoutURL(
468         Layout layout, ThemeDisplay themeDisplay) {
469 
470         return getPortal().getLayoutURL(layout, themeDisplay);
471     }
472 
473     public static String getLayoutURL(
474         Layout layout, ThemeDisplay themeDisplay, boolean doAsUser) {
475 
476         return getPortal().getLayoutURL(layout, themeDisplay, doAsUser);
477     }
478 
479     public static String getLayoutURL(ThemeDisplay themeDisplay) {
480         return getPortal().getLayoutURL(themeDisplay);
481     }
482 
483     public static String getLayoutViewPage(Layout layout) {
484         return getPortal().getLayoutViewPage(layout);
485     }
486 
487     public static Locale getLocale(HttpServletRequest request) {
488         return getPortal().getLocale(request);
489     }
490 
491     public static Locale getLocale(RenderRequest renderRequest) {
492         return getPortal().getLocale(renderRequest);
493     }
494 
495     /**
496      * @deprecated {@link #getBaseModel(Resource)}
497      */
498     public static BaseModel<?> getModel(Resource resource)
499         throws PortalException, SystemException {
500 
501         return getPortal().getBaseModel(resource);
502     }
503 
504     /**
505      * @deprecated {@link #getBaseModel(ResourcePermission)}
506      */
507     public static BaseModel<?> getModel(ResourcePermission resourcePermission)
508         throws PortalException, SystemException {
509 
510         return getPortal().getBaseModel(resourcePermission);
511     }
512 
513     /**
514      * @deprecated {@link #getBaseModel(String, String)}
515      */
516     public static BaseModel<?> getModel(String modelName, String primKey)
517         throws PortalException, SystemException {
518 
519         return getPortal().getBaseModel(modelName, primKey);
520     }
521 
522     public static String getNetvibesURL(
523         Portlet portlet, ThemeDisplay themeDisplay) {
524 
525         return getPortal().getNetvibesURL(portlet, themeDisplay);
526     }
527 
528     public static HttpServletRequest getOriginalServletRequest(
529         HttpServletRequest request) {
530 
531         return getPortal().getOriginalServletRequest(request);
532     }
533 
534     public static String getPathContext() {
535         return getPortal().getPathContext();
536     }
537 
538     public static String getPathFriendlyURLPrivateGroup() {
539         return getPortal().getPathFriendlyURLPrivateGroup();
540     }
541 
542     public static String getPathFriendlyURLPrivateUser() {
543         return getPortal().getPathFriendlyURLPrivateUser();
544     }
545 
546     public static String getPathFriendlyURLPublic() {
547         return getPortal().getPathFriendlyURLPublic();
548     }
549 
550     public static String getPathImage() {
551         return getPortal().getPathImage();
552     }
553 
554     public static String getPathMain() {
555         return getPortal().getPathMain();
556     }
557 
558     public static long getPlidFromFriendlyURL(
559         long companyId, String friendlyURL) {
560 
561         return getPortal().getPlidFromFriendlyURL(companyId, friendlyURL);
562     }
563 
564     public static long getPlidFromPortletId(
565         long groupId, boolean privateLayout, String portletId) {
566 
567         return getPortal().getPlidFromPortletId(
568             groupId, privateLayout, portletId);
569     }
570 
571     public static long getPlidFromPortletId(long groupId, String portletId) {
572         return getPortal().getPlidFromPortletId(groupId, portletId);
573     }
574 
575     public static Portal getPortal() {
576         return _portal;
577     }
578 
579     public static String getPortalLibDir() {
580         return getPortal().getPortalLibDir();
581     }
582 
583     public static int getPortalPort() {
584         return getPortal().getPortalPort();
585     }
586 
587     public static Properties getPortalProperties() {
588         return getPortal().getPortalProperties();
589     }
590 
591     public static String getPortalURL(HttpServletRequest request) {
592         return getPortal().getPortalURL(request);
593     }
594 
595     public static String getPortalURL(
596         HttpServletRequest request, boolean secure) {
597 
598         return getPortal().getPortalURL(request, secure);
599     }
600 
601     public static String getPortalURL(PortletRequest portletRequest) {
602         return getPortal().getPortalURL(portletRequest);
603     }
604 
605     public static String getPortalURL(
606         PortletRequest portletRequest, boolean secure) {
607 
608         return getPortal().getPortalURL(portletRequest, secure);
609     }
610 
611     public static String getPortalURL(
612         String serverName, int serverPort, boolean secure) {
613 
614         return getPortal().getPortalURL(serverName, serverPort, secure);
615     }
616 
617     public static String getPortalURL(ThemeDisplay themeDisplay) {
618         return getPortal().getPortalURL(themeDisplay);
619     }
620 
621     public static String getPortalWebDir() {
622         return getPortal().getPortalWebDir();
623     }
624 
625     public static String getPortletDescription(
626         Portlet portlet, ServletContext servletContext, Locale locale) {
627 
628         return getPortal().getPortletDescription(
629             portlet, servletContext, locale);
630     }
631 
632     public static String getPortletDescription(Portlet portlet, User user) {
633         return getPortal().getPortletDescription(portlet, user);
634     }
635 
636     public static String getPortletDescription(
637         String portletId, Locale locale) {
638 
639         return getPortal().getPortletDescription(portletId, locale);
640     }
641 
642     /**
643      * @deprecated
644      */
645     public static String getPortletDescription(
646         String portletId, long companyId, Locale locale) {
647 
648         return getPortal().getPortletDescription(portletId, locale);
649     }
650 
651     /**
652      * @deprecated
653      */
654     public static String getPortletDescription(
655         String portletId, long companyId, String languageId) {
656 
657         return getPortal().getPortletDescription(portletId, languageId);
658     }
659 
660     public static String getPortletDescription(
661         String portletId, String languageId) {
662 
663         return getPortal().getPortletDescription(portletId, languageId);
664     }
665 
666     public static String getPortletDescription(String portletId, User user) {
667         return getPortal().getPortletDescription(portletId, user);
668     }
669 
670     public static Object[] getPortletFriendlyURLMapper(
671             long groupId, boolean privateLayout, String url)
672         throws PortalException, SystemException {
673 
674         return getPortal().getPortletFriendlyURLMapper(
675             groupId, privateLayout, url);
676     }
677 
678     public static Object[] getPortletFriendlyURLMapper(
679             long groupId, boolean privateLayout, String url,
680             Map<String, String[]> params)
681         throws PortalException, SystemException {
682 
683         return getPortal().getPortletFriendlyURLMapper(
684             groupId, privateLayout, url, params);
685     }
686 
687     /**
688      * @deprecated Use <code>getScopeGroupId</code>.
689      */
690     public static long getPortletGroupId(ActionRequest actionRequest) {
691         return getPortal().getPortletGroupId(actionRequest);
692     }
693 
694     /**
695      * @deprecated Use <code>getScopeGroupId</code>.
696      */
697     public static long getPortletGroupId(HttpServletRequest request) {
698         return getPortal().getPortletGroupId(request);
699     }
700 
701     /**
702      * @deprecated Use <code>getScopeGroupId</code>.
703      */
704     public static long getPortletGroupId(Layout layout) {
705         return getPortal().getPortletGroupId(layout);
706     }
707 
708     /**
709      * @deprecated Use <code>getScopeGroupId</code>.
710      */
711     public static long getPortletGroupId(long plid) {
712         return getPortal().getPortletGroupId(plid);
713     }
714 
715     /**
716      * @deprecated Use <code>getScopeGroupId</code>.
717      */
718     public static long getPortletGroupId(RenderRequest renderRequest) {
719         return getPortal().getPortletGroupId(renderRequest);
720     }
721 
722     public static String getPortletId(HttpServletRequest request) {
723         return getPortal().getPortletId(request);
724     }
725 
726     public static String getPortletId(PortletRequest portletRequest) {
727         return getPortal().getPortletId(portletRequest);
728     }
729 
730     public static String getPortletNamespace(String portletId) {
731         return getPortal().getPortletNamespace(portletId);
732     }
733 
734     public static String getPortletTitle(Portlet portlet, Locale locale) {
735         return getPortal().getPortletTitle(portlet, locale);
736     }
737 
738     /**
739      * @deprecated
740      */
741     public static String getPortletTitle(
742         Portlet portlet, long companyId, Locale locale) {
743 
744         return getPortal().getPortletTitle(portlet, locale);
745     }
746 
747     /**
748      * @deprecated
749      */
750     public static String getPortletTitle(
751         Portlet portlet, long companyId, String languageId) {
752 
753         return getPortal().getPortletTitle(portlet, languageId);
754     }
755 
756     public static String getPortletTitle(
757         Portlet portlet, ServletContext servletContext, Locale locale) {
758 
759         return getPortal().getPortletTitle(portlet, servletContext, locale);
760     }
761 
762     public static String getPortletTitle(Portlet portlet, String languageId) {
763         return getPortal().getPortletTitle(portlet, languageId);
764     }
765 
766     public static String getPortletTitle(Portlet portlet, User user) {
767         return getPortal().getPortletTitle(portlet, user);
768     }
769 
770     public static String getPortletTitle(String portletId, Locale locale) {
771         return getPortal().getPortletTitle(portletId, locale);
772     }
773 
774     /**
775      * @deprecated
776      */
777     public static String getPortletTitle(
778         String portletId, long companyId, Locale locale) {
779 
780         return getPortal().getPortletTitle(portletId, locale);
781     }
782 
783     /**
784      * @deprecated
785      */
786     public static String getPortletTitle(
787         String portletId, long companyId, String languageId) {
788 
789         return getPortal().getPortletTitle(portletId, languageId);
790     }
791 
792     public static String getPortletTitle(String portletId, String languageId) {
793         return getPortal().getPortletTitle(portletId, languageId);
794     }
795 
796     public static String getPortletTitle(String portletId, User user) {
797         return getPortal().getPortletTitle(portletId, user);
798     }
799 
800     public static String getPortletXmlFileName() throws SystemException {
801         return getPortal().getPortletXmlFileName();
802     }
803 
804     public static PortletPreferences getPreferences(
805         HttpServletRequest request) {
806 
807         return getPortal().getPreferences(request);
808     }
809 
810     public static PreferencesValidator getPreferencesValidator(
811         Portlet portlet) {
812 
813         return getPortal().getPreferencesValidator(portlet);
814     }
815 
816     public static long getScopeGroupId(HttpServletRequest request) {
817         return getPortal().getScopeGroupId(request);
818     }
819 
820     public static long getScopeGroupId(
821         HttpServletRequest request, String portletId) {
822 
823         return getPortal().getScopeGroupId(request, portletId);
824     }
825 
826     public static long getScopeGroupId(Layout layout) {
827         return getPortal().getScopeGroupId(layout);
828     }
829 
830     public static long getScopeGroupId(Layout layout, String portletId) {
831         return getPortal().getScopeGroupId(layout, portletId);
832     }
833 
834     public static long getScopeGroupId(long plid) {
835         return getPortal().getScopeGroupId(plid);
836     }
837 
838     public static long getScopeGroupId(PortletRequest portletRequest) {
839         return getPortal().getScopeGroupId(portletRequest);
840     }
841 
842     public static User getSelectedUser(HttpServletRequest request)
843         throws PortalException, SystemException {
844 
845         return getPortal().getSelectedUser(request);
846     }
847 
848     public static User getSelectedUser(
849             HttpServletRequest request, boolean checkPermission)
850         throws PortalException, SystemException {
851 
852         return getPortal().getSelectedUser(request, checkPermission);
853     }
854 
855     public static User getSelectedUser(PortletRequest portletRequest)
856         throws PortalException, SystemException {
857 
858         return getPortal().getSelectedUser(portletRequest);
859     }
860 
861     public static User getSelectedUser(
862             PortletRequest portletRequest, boolean checkPermission)
863         throws PortalException, SystemException {
864 
865         return getPortal().getSelectedUser(portletRequest, checkPermission);
866     }
867 
868     public static String getServletContextName(BaseModel<?> baseModel) {
869         return getPortal().getServletContextName(baseModel);
870     }
871 
872     public static String getStaticResourceURL(
873         HttpServletRequest request, String uri) {
874 
875         return getPortal().getStaticResourceURL(request, uri);
876     }
877 
878     public static String getStaticResourceURL(
879         HttpServletRequest request, String uri, long timestamp) {
880 
881         return getPortal().getStaticResourceURL(request, uri, timestamp);
882     }
883 
884     public static String getStaticResourceURL(
885         HttpServletRequest request, String uri, String queryString) {
886 
887         return getPortal().getStaticResourceURL(request, uri, queryString);
888     }
889 
890     public static String getStaticResourceURL(
891         HttpServletRequest request, String uri, String queryString,
892         long timestamp) {
893 
894         return getPortal().getStaticResourceURL(
895             request, uri, queryString, timestamp);
896     }
897 
898     public static String getStrutsAction(HttpServletRequest request) {
899         return getPortal().getStrutsAction(request);
900     }
901 
902     public static String[] getSystemCommunityRoles() {
903         return getPortal().getSystemCommunityRoles();
904     }
905 
906     public static String[] getSystemGroups() {
907         return getPortal().getSystemGroups();
908     }
909 
910     public static String[] getSystemOrganizationRoles() {
911         return getPortal().getSystemOrganizationRoles();
912     }
913 
914     public static String[] getSystemRoles() {
915         return getPortal().getSystemRoles();
916     }
917 
918     public static String[] getTagsCategories(PortletRequest portletRequest) {
919         return getPortal().getTagsCategories(portletRequest);
920     }
921 
922     public static String[] getTagsEntries(PortletRequest portletRequest) {
923         return getPortal().getTagsEntries(portletRequest);
924     }
925 
926     public static UploadPortletRequest getUploadPortletRequest(
927         ActionRequest actionRequest) {
928 
929         return getPortal().getUploadPortletRequest(actionRequest);
930     }
931 
932     public static UploadServletRequest getUploadServletRequest(
933         HttpServletRequest request) {
934 
935         return getPortal().getUploadServletRequest(request);
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 String getWidgetURL(
1010        Portlet portlet, ThemeDisplay themeDisplay) {
1011
1012        return getPortal().getWidgetURL(portlet, themeDisplay);
1013    }
1014
1015    public static boolean isLayoutFirstPageable(String type) {
1016        return getPortal().isLayoutFirstPageable(type);
1017    }
1018
1019    public static boolean isLayoutFriendliable(Layout layout) {
1020        return getPortal().isLayoutFriendliable(layout);
1021    }
1022
1023    public static boolean isLayoutParentable(Layout layout) {
1024        return getPortal().isLayoutParentable(layout);
1025    }
1026
1027    public static boolean isLayoutParentable(String type) {
1028        return getPortal().isLayoutParentable(type);
1029    }
1030
1031    public static boolean isLayoutSitemapable(Layout layout) {
1032        return getPortal().isLayoutSitemapable(layout);
1033    }
1034
1035    public static boolean isMethodGet(PortletRequest portletRequest) {
1036        return getPortal().isMethodGet(portletRequest);
1037    }
1038
1039    public static boolean isMethodPost(PortletRequest portletRequest) {
1040        return getPortal().isMethodPost(portletRequest);
1041    }
1042
1043    public static boolean isReservedParameter(String name) {
1044        return getPortal().isReservedParameter(name);
1045    }
1046
1047    public static boolean isSystemGroup(String groupName) {
1048        return getPortal().isSystemGroup(groupName);
1049    }
1050
1051    public static boolean isSystemRole(String roleName) {
1052        return getPortal().isSystemRole(roleName);
1053    }
1054
1055    public static boolean isUpdateAvailable() throws SystemException {
1056        return getPortal().isUpdateAvailable();
1057    }
1058
1059    public static void renderPage(
1060            StringBuilder sb, ServletContext servletContext,
1061            HttpServletRequest request, HttpServletResponse response,
1062            String path)
1063        throws IOException, ServletException {
1064
1065        getPortal().renderPage(sb, servletContext, request, response, path);
1066    }
1067
1068    public static void renderPortlet(
1069            StringBuilder sb, ServletContext servletContext,
1070            HttpServletRequest request, HttpServletResponse response,
1071            Portlet portlet, String queryString)
1072        throws IOException, ServletException {
1073
1074        getPortal().renderPortlet(
1075            sb, servletContext, request, response, portlet, queryString);
1076    }
1077
1078    public static void renderPortlet(
1079            StringBuilder sb, ServletContext servletContext,
1080            HttpServletRequest request, HttpServletResponse response,
1081            Portlet portlet, String queryString, String columnId,
1082            Integer columnPos, Integer columnCount)
1083        throws IOException, ServletException {
1084
1085        getPortal().renderPortlet(
1086            sb, servletContext, request, response, portlet, queryString,
1087            columnId, columnPos, columnCount);
1088    }
1089
1090    public static void renderPortlet(
1091            StringBuilder sb, ServletContext servletContext,
1092            HttpServletRequest request, HttpServletResponse response,
1093            Portlet portlet, String queryString, String columnId,
1094            Integer columnPos, Integer columnCount, String path)
1095        throws IOException, ServletException {
1096
1097        getPortal().renderPortlet(
1098            sb, servletContext, request, response, portlet, queryString,
1099            columnId, columnPos, columnCount, path);
1100    }
1101
1102    /**
1103     * @deprecated {@link DB#runSQL(String)}
1104     */
1105    public static void runSQL(String sql) throws IOException, SQLException {
1106        DBFactoryUtil.getDB().runSQL(sql);
1107    }
1108
1109    public static void sendError(
1110            Exception e, ActionRequest actionRequest,
1111            ActionResponse actionResponse)
1112        throws IOException {
1113
1114        getPortal().sendError(e, actionRequest, actionResponse);
1115    }
1116
1117    public static void sendError(
1118            Exception e, HttpServletRequest request,
1119            HttpServletResponse response)
1120        throws IOException, ServletException {
1121
1122        getPortal().sendError(e, request, response);
1123    }
1124
1125    public static void sendError(
1126            int status, Exception e, ActionRequest actionRequest,
1127            ActionResponse actionResponse)
1128        throws IOException {
1129
1130        getPortal().sendError(status, e, actionRequest, actionResponse);
1131    }
1132
1133    public static void sendError(
1134            int status, Exception e, HttpServletRequest request,
1135            HttpServletResponse response)
1136        throws IOException, ServletException {
1137
1138        getPortal().sendError(status, e, request, response);
1139    }
1140
1141    /**
1142     * Sets the description for a page. This overrides the existing page
1143     * description.
1144     */
1145    public static void setPageDescription(
1146        String description, HttpServletRequest request) {
1147
1148        getPortal().setPageDescription(description, request);
1149    }
1150
1151    /**
1152     * Sets the keywords for a page. This overrides the existing page keywords.
1153     */
1154    public static void setPageKeywords(
1155        String keywords, HttpServletRequest request) {
1156
1157        getPortal().setPageKeywords(keywords, request);
1158    }
1159
1160    /**
1161     * Sets the subtitle for a page. This overrides the existing page subtitle.
1162     */
1163    public static void setPageSubtitle(
1164        String subtitle, HttpServletRequest request) {
1165
1166        getPortal().setPageSubtitle(subtitle, request);
1167    }
1168
1169    /**
1170     * Sets the whole title for a page. This overrides the existing page whole
1171     * title.
1172     */
1173    public static void setPageTitle(
1174        String title, HttpServletRequest request) {
1175
1176        getPortal().setPageTitle(title, request);
1177    }
1178
1179    /**
1180     * Sets the port obtained on the first request to the portal.
1181     */
1182    public static void setPortalPort(HttpServletRequest request) {
1183        getPortal().setPortalPort(request);
1184    }
1185
1186    public static void storePreferences(PortletPreferences preferences)
1187        throws IOException, ValidatorException {
1188
1189        getPortal().storePreferences(preferences);
1190    }
1191
1192    public static String transformCustomSQL(String sql) {
1193        return getPortal().transformCustomSQL(sql);
1194    }
1195
1196    public static PortletMode updatePortletMode(
1197        String portletId, User user, Layout layout, PortletMode portletMode,
1198        HttpServletRequest request) {
1199
1200        return getPortal().updatePortletMode(
1201            portletId, user, layout, portletMode, request);
1202    }
1203
1204    public static WindowState updateWindowState(
1205        String portletId, User user, Layout layout, WindowState windowState,
1206        HttpServletRequest request) {
1207
1208        return getPortal().updateWindowState(
1209            portletId, user, layout, windowState, request);
1210    }
1211
1212    public void setPortal(Portal portal) {
1213        _portal = portal;
1214    }
1215
1216    private static Portal _portal;
1217
1218}