001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
020    import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
021    import com.liferay.portal.kernel.servlet.taglib.ui.BreadcrumbEntry;
022    import com.liferay.portal.kernel.upload.UploadPortletRequest;
023    import com.liferay.portal.kernel.upload.UploadServletRequest;
024    import com.liferay.portal.model.BaseModel;
025    import com.liferay.portal.model.Company;
026    import com.liferay.portal.model.Group;
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    
036    import java.io.IOException;
037    import java.io.Serializable;
038    
039    import java.util.Date;
040    import java.util.List;
041    import java.util.Locale;
042    import java.util.Map;
043    import java.util.Properties;
044    import java.util.Set;
045    import java.util.TimeZone;
046    
047    import javax.portlet.ActionRequest;
048    import javax.portlet.ActionResponse;
049    import javax.portlet.PortletMode;
050    import javax.portlet.PortletPreferences;
051    import javax.portlet.PortletRequest;
052    import javax.portlet.PortletResponse;
053    import javax.portlet.PreferencesValidator;
054    import javax.portlet.RenderRequest;
055    import javax.portlet.RenderResponse;
056    import javax.portlet.ValidatorException;
057    import javax.portlet.WindowState;
058    
059    import javax.servlet.ServletContext;
060    import javax.servlet.ServletException;
061    import javax.servlet.http.HttpServletRequest;
062    import javax.servlet.http.HttpServletResponse;
063    import javax.servlet.http.HttpSession;
064    import javax.servlet.jsp.PageContext;
065    
066    /**
067     * @author Brian Wing Shun Chan
068     * @author Eduardo Lundgren
069     */
070    public interface Portal {
071    
072            public static final String FRIENDLY_URL_SEPARATOR = "/-/";
073    
074            public static final String PATH_IMAGE = "/image";
075    
076            public static final String PATH_MAIN = "/c";
077    
078            public static final String PATH_PORTAL_LAYOUT = "/portal/layout";
079    
080            public static final String PORTAL_REALM = "PortalRealm";
081    
082            public static final String PORTLET_XML_FILE_NAME_CUSTOM =
083                    "portlet-custom.xml";
084    
085            public static final String PORTLET_XML_FILE_NAME_STANDARD = "portlet.xml";
086    
087            public static final String TEMP_OBFUSCATION_VALUE =
088                    "TEMP_OBFUSCATION_VALUE";
089    
090            /**
091             * Appends the description to the current meta description of the page.
092             *
093             * @param description the description to append to the current meta
094             *        description
095             * @param request the servlet request for the page
096             */
097            public void addPageDescription(
098                    String description, HttpServletRequest request);
099    
100            /**
101             * Appends the keywords to the current meta keywords of the page.
102             *
103             * @param keywords the keywords to add to the current meta keywords
104             *        (comma-separated)
105             * @param request the servlet request for the page
106             */
107            public void addPageKeywords(String keywords, HttpServletRequest request);
108    
109            /**
110             * Appends the subtitle to the current subtitle of the page.
111             *
112             * @param subtitle the subtitle to append to the current subtitle
113             * @param request the servlet request for the page
114             */
115            public void addPageSubtitle(String subtitle, HttpServletRequest request);
116    
117            /**
118             * Appends the title to the current title of the page.
119             *
120             * @param title the title to append to the current title
121             * @param request the servlet request for the page
122             */
123            public void addPageTitle(String title, HttpServletRequest request);
124    
125            /**
126             * Adds the portal port event listener to the portal. The listener will be
127             * notified whenever the portal port is set.
128             *
129             * @param portalPortEventListener the portal port event listener to add
130             */
131            public void addPortalPortEventListener(
132                    PortalPortEventListener portalPortEventListener);
133    
134            /**
135             * Adds an entry to the portlet breadcrumbs for the page.
136             *
137             * @param request the servlet request for the page
138             * @param title the title of the new breakcrumb entry
139             * @param url the URL of the new breadcrumb entry
140             */
141            public void addPortletBreadcrumbEntry(
142                    HttpServletRequest request, String title, String url);
143    
144            /**
145             * Adds an entry to the portlet breadcrumbs for the page.
146             *
147             * @param request the servlet request for the page
148             * @param title the title of the new breakcrumb entry
149             * @param url the URL of the new breadcrumb entry
150             * @param data the HTML5 data parameters of the new breadcrumb entry
151             */
152            public void addPortletBreadcrumbEntry(
153                    HttpServletRequest request, String title, String url,
154                    Map<String, Object> data);
155    
156            /**
157             * Adds the default resource permissions for the portlet to the page.
158             *
159             * @param  request the servlet request for the page
160             * @param  portlet the portlet
161             * @throws PortalException if adding the default resource permissions failed
162             * @throws SystemException if a system exception occurred
163             */
164            public void addPortletDefaultResource(
165                            HttpServletRequest request, Portlet portlet)
166                    throws PortalException, SystemException;
167    
168            public void addPortletDefaultResource(
169                            long companyId, Layout layout, Portlet portlet)
170                    throws PortalException, SystemException;
171    
172            /**
173             * Adds the preserved parameters doAsGroupId and refererPlid to the URL,
174             * optionally adding doAsUserId and doAsUserLanguageId as well.
175             *
176             * <p>
177             * Preserved parameters are parameters that should be sent with every
178             * request as the user navigates the portal.
179             * </p>
180             *
181             * @param  themeDisplay the current theme display
182             * @param  layout the current layout
183             * @param  url the URL
184             * @param  doAsUser whether to include doAsUserId and doAsLanguageId in the
185             *         URL if they are available. If <code>false</code>, doAsUserId and
186             *         doAsUserLanguageId will never be added.
187             * @return the URL with the preserved parameters added
188             */
189            public String addPreservedParameters(
190                    ThemeDisplay themeDisplay, Layout layout, String url, boolean doAsUser);
191    
192            /**
193             * Adds the preserved parameters doAsUserId, doAsUserLanguageId,
194             * doAsGroupId, refererPlid, and controlPanelCategory to the URL.
195             *
196             * @param  themeDisplay the current theme display
197             * @param  url the URL
198             * @return the URL with the preserved parameters added
199             */
200            public String addPreservedParameters(ThemeDisplay themeDisplay, String url);
201    
202            /**
203             * Clears the render parameters in the request if the portlet is in the
204             * action phase.
205             *
206             * @param renderRequest the render request
207             */
208            public void clearRequestParameters(RenderRequest renderRequest);
209    
210            /**
211             * Copies the request parameters to the render parameters, unless a
212             * parameter with that name already exists in the render parameters.
213             *
214             * @param actionRequest the request from which to get the request parameters
215             * @param actionResponse the response to receive the render parameters
216             */
217            public void copyRequestParameters(
218                    ActionRequest actionRequest, ActionResponse actionResponse);
219    
220            /**
221             * Escapes the URL for use in a redirect and checks that security settings
222             * allow the URL is allowed for redirects.
223             *
224             * @param  url the URL to escape
225             * @return the escaped URL, or <code>null</code> if the URL is not an
226             *         allowed for redirects
227             */
228            public String escapeRedirect(String url);
229    
230            /**
231             * Generates a random key to identify the request based on the input string.
232             *
233             * @param  request the servlet request for the page
234             * @param  input the input string
235             * @return the generated key
236             */
237            public String generateRandomKey(HttpServletRequest request, String input);
238    
239            public String getActualURL(
240                            long groupId, boolean privateLayout, String mainPath,
241                            String friendlyURL, Map<String, String[]> params,
242                            Map<String, Object> requestContext)
243                    throws PortalException, SystemException;
244    
245            /**
246             * Returns an array with the alternate locales, considering if the page is
247             * showing just a content and the translations of this content.
248             *
249             * @param  request the servlet request for the page
250             * @return the array of alternate locales
251             */
252            public Locale[] getAlternateLocales(HttpServletRequest request)
253                    throws PortalException, SystemException;
254    
255            /**
256             * @deprecated {@link #getAlternateURL(String, ThemeDisplay, Locale)}
257             */
258            public String getAlternateURL(
259                    HttpServletRequest request, String canonicalURL, Locale locale);
260    
261            /**
262             * Returns the alternate URL of the page, to distinguish it from its
263             * canonical URL.
264             *
265             * @param  canonicalURL the canonical URL previously obtained
266             * @param  themeDisplay the theme display
267             * @param  locale the locale of the translated page
268             * @return the alternate URL
269             */
270            public String getAlternateURL(
271                    String canonicalURL, ThemeDisplay themeDisplay, Locale locale);
272    
273            /**
274             * Returns the set of struts actions that should not be checked for an
275             * authentication token.
276             *
277             * @return the set of struts actions that should not be checked for an
278             *         authentication token
279             */
280            public Set<String> getAuthTokenIgnoreActions();
281    
282            /**
283             * Returns the set of IDs of portlets that should not be checked for an
284             * authentication token.
285             *
286             * @return the set of IDs of portlets that should not be checked for an
287             *         authentication token
288             */
289            public Set<String> getAuthTokenIgnorePortlets();
290    
291            /**
292             * Returns the base model instance for the resource.
293             *
294             * @param  resource the resource
295             * @return the base model instance, or <code>null</code> if the resource
296             *         does not have a base model instance (such as if its a portlet)
297             * @throws PortalException if a base model instance for the resource could
298             *         not be found
299             * @throws SystemException if a system exception occurred
300             */
301            public BaseModel<?> getBaseModel(Resource resource)
302                    throws PortalException, SystemException;
303    
304            /**
305             * Returns the base model instance for the resource permission.
306             *
307             * @param  resourcePermission the resource permission
308             * @return the base model instance, or <code>null</code> if the resource
309             *         permission does not have a base model instance (such as if its a
310             *         portlet)
311             * @throws PortalException if a base model instance for the resource
312             *         permission could not be found
313             * @throws SystemException if a system exception occurred
314             */
315            public BaseModel<?> getBaseModel(ResourcePermission resourcePermission)
316                    throws PortalException, SystemException;
317    
318            /**
319             * Returns the base model instance for the model name and primary key.
320             *
321             * @param  modelName the fully qualified class name of the model
322             * @param  primKey the primary key of the model instance to get
323             * @return the base model instance, or <code>null</code> if the model does
324             *         not have a base model instance (such as if its a portlet)
325             * @throws PortalException if a base model instance with the primary key
326             *         could not be found
327             * @throws SystemException if a system exception occurred
328             */
329            public BaseModel<?> getBaseModel(String modelName, String primKey)
330                    throws PortalException, SystemException;
331    
332            /**
333             * Returns the user's ID from the HTTP authentication headers after
334             * validating their credentials.
335             *
336             * @param  request the servlet request from which to retrieve the HTTP
337             *         authentication headers
338             * @return the user's ID if HTTP authentication headers are present and
339             *         their credentials are valid; 0 otherwise
340             * @throws PortalException if an authentication exception occurred
341             * @throws SystemException if a system exception occurred
342             */
343            public long getBasicAuthUserId(HttpServletRequest request)
344                    throws PortalException, SystemException;
345    
346            /**
347             * Returns the user's ID from the HTTP authentication headers after
348             * validation their credentials.
349             *
350             * @param  request the servlet request to retrieve the HTTP authentication
351             *         headers from
352             * @param  companyId unused
353             * @return the user's ID if HTTP authentication headers are present and
354             *         their credentials are valid; 0 otherwise
355             * @throws PortalException if an authentication exception occurred
356             * @throws SystemException if a system exception occurred
357             */
358            public long getBasicAuthUserId(HttpServletRequest request, long companyId)
359                    throws PortalException, SystemException;
360    
361            /**
362             * @deprecated {@link #getCanonicalURL(String, ThemeDisplay, Layout)}
363             */
364            public String getCanonicalURL(String completeURL, ThemeDisplay themeDisplay)
365                    throws PortalException, SystemException;
366    
367            /**
368             * Returns the canonical URL of the page, to distinguish it among its
369             * translations.
370             *
371             * @param  completeURL the complete URL of the page
372             * @param  themeDisplay the current theme display
373             * @param  layout the layout. If it is <code>null</code>, then it is
374             *         generated for the current layout
375             * @return the canonical URL
376             * @throws PortalException if a friendly URL or the group could not be
377             *         retrieved
378             * @throws SystemException if a system exception occurred
379             */
380            public String getCanonicalURL(
381                            String completeURL, ThemeDisplay themeDisplay, Layout layout)
382                    throws PortalException, SystemException;
383    
384            /**
385             * @deprecated Replaced by the more general {@link #getCDNHost(boolean)}
386             */
387            public String getCDNHost();
388    
389            /**
390             * Returns the secure (HTTPS) or insecure (HTTP) content distribution
391             * network (CDN) host address for this portal.
392             *
393             * @param  secure whether to get the secure or insecure CDN host address
394             * @return the CDN host address
395             */
396            public String getCDNHost(boolean secure);
397    
398            public String getCDNHost(HttpServletRequest request)
399                    throws PortalException, SystemException;
400    
401            /**
402             * Returns the insecure (HTTP) content distribution network (CDN) host
403             * address
404             *
405             * @return the CDN host address
406             */
407            public String getCDNHostHttp(long companyId);
408    
409            /**
410             * Returns the secure (HTTPS) content distribution network (CDN) host
411             * address
412             *
413             * @return the CDN host address
414             */
415            public String getCDNHostHttps(long companyId);
416    
417            /**
418             * Returns the fully qualified name of the class from its ID.
419             *
420             * @param  classNameId the ID of the class
421             * @return the fully qualified name of the class
422             */
423            public String getClassName(long classNameId);
424    
425            /**
426             * Returns the ID of the class from its class object.
427             *
428             * @param  clazz the class object
429             * @return the ID of the class
430             */
431            public long getClassNameId(Class<?> clazz);
432    
433            /**
434             * Returns the ID of the class from its fully qualified name.
435             *
436             * @param  value the fully qualified name of the class
437             * @return the ID of the class
438             */
439            public long getClassNameId(String value);
440    
441            /**
442             * Returns the ID of certain portlets from the fully qualified name of one
443             * of their classes. The portlets this method supports are: blogs,
444             * bookmarks, calendar, document library, image gallery, journal, message
445             * boards, and wiki.
446             *
447             * @param  className the fully qualified name of a class in a portlet
448             * @return the ID of the portlet the class is a part of, or an empty string
449             *         if the class is not supported
450             */
451            public String getClassNamePortletId(String className);
452    
453            public Company getCompany(HttpServletRequest request)
454                    throws PortalException, SystemException;
455    
456            public Company getCompany(PortletRequest portletRequest)
457                    throws PortalException, SystemException;
458    
459            public long getCompanyId(HttpServletRequest requestuest);
460    
461            public long getCompanyId(PortletRequest portletRequest);
462    
463            public long[] getCompanyIds();
464    
465            public String getComputerAddress();
466    
467            public String getComputerName();
468    
469            public String getControlPanelCategory(
470                            String portletId, ThemeDisplay themeDisplay)
471                    throws SystemException;
472    
473            public String getControlPanelFullURL(
474                            long scopeGroupId, String ppid, Map<String, String[]> params)
475                    throws PortalException, SystemException;
476    
477            public Set<Portlet> getControlPanelPortlets(long companyId, String category)
478                    throws SystemException;
479    
480            public List<Portlet> getControlPanelPortlets(
481                            String category, ThemeDisplay themeDisplay)
482                    throws SystemException;
483    
484            public String getCreateAccountURL(
485                            HttpServletRequest request, ThemeDisplay themeDisplay)
486                    throws Exception;
487    
488            public String getCurrentCompleteURL(HttpServletRequest request);
489    
490            public String getCurrentURL(HttpServletRequest request);
491    
492            public String getCurrentURL(PortletRequest portletRequest);
493    
494            public String getCustomSQLFunctionIsNotNull();
495    
496            public String getCustomSQLFunctionIsNull();
497    
498            /**
499             * Returns the date object for the specified month, day, and year.
500             *
501             * @param  month the month (0-based, meaning 0 for January)
502             * @param  day the day of the month
503             * @param  year the year
504             * @return the date object
505             */
506            public Date getDate(int month, int day, int year);
507    
508            /**
509             * Returns the date object for the specified month, day, year, hour, and
510             * minute, optionally throwing an exception if the date is invalid.
511             *
512             * @param  month the month (0-based, meaning 0 for January)
513             * @param  day the day of the month
514             * @param  year the year
515             * @param  hour the hour (0-24)
516             * @param  min the minute of the hour
517             * @param  pe the exception to throw if the date is invalid. If
518             *         <code>null</code>, no exception will be thrown for an invalid
519             *         date.
520             * @return the date object, or <code>null</code> if the date is invalid and
521             *         no exception to throw was provided
522             * @throws PortalException if the date was invalid and <code>pe</code> was
523             *         not <code>null</code>
524             */
525            public Date getDate(
526                            int month, int day, int year, int hour, int min, PortalException pe)
527                    throws PortalException;
528    
529            /**
530             * Returns the date object for the specified month, day, year, hour, minute,
531             * and time zone, optionally throwing an exception if the date is invalid.
532             *
533             * @param  month the month (0-based, meaning 0 for January)
534             * @param  day the day of the month
535             * @param  year the year
536             * @param  hour the hour (0-24)
537             * @param  min the minute of the hour
538             * @param  timeZone the time zone of the date
539             * @param  pe the exception to throw if the date is invalid. If
540             *         <code>null</code>, no exception will be thrown for an invalid
541             *         date.
542             * @return the date object, or <code>null</code> if the date is invalid and
543             *         no exception to throw was provided
544             * @throws PortalException if the date was invalid and <code>pe</code> was
545             *         not <code>null</code>
546             */
547            public Date getDate(
548                            int month, int day, int year, int hour, int min, TimeZone timeZone,
549                            PortalException pe)
550                    throws PortalException;
551    
552            /**
553             * Returns the date object for the specified month, day, and year,
554             * optionally throwing an exception if the date is invalid.
555             *
556             * @param  month the month (0-based, meaning 0 for January)
557             * @param  day the day of the month
558             * @param  year the year
559             * @param  pe the exception to throw if the date is invalid. If
560             *         <code>null</code>, no exception will be thrown for an invalid
561             *         date.
562             * @return the date object, or <code>null</code> if the date is invalid and
563             *         no exception to throw was provided
564             * @throws PortalException if the date was invalid and <code>pe</code> was
565             *         not <code>null</code>
566             */
567            public Date getDate(int month, int day, int year, PortalException pe)
568                    throws PortalException;
569    
570            /**
571             * Returns the date object for the specified month, day, year, and time
572             * zone, optionally throwing an exception if the date is invalid.
573             *
574             * @param  month the month (0-based, meaning 0 for January)
575             * @param  day the day of the month
576             * @param  year the year
577             * @param  timeZone the time zone of the date
578             * @param  pe the exception to throw if the date is invalid. If
579             *         <code>null</code>, no exception will be thrown for an invalid
580             *         date.
581             * @return the date object, or <code>null</code> if the date is invalid and
582             *         no exception to throw was provided
583             * @throws PortalException if the date was invalid and <code>pe</code> was
584             *         not <code>null</code>
585             */
586            public Date getDate(
587                            int month, int day, int year, TimeZone timeZone, PortalException pe)
588                    throws PortalException;
589    
590            public long getDefaultCompanyId();
591    
592            public long getDigestAuthUserId(HttpServletRequest request)
593                    throws PortalException, SystemException;
594    
595            public String getEmailFromAddress(
596                            PortletPreferences preferences, long companyId, String defaultValue)
597                    throws SystemException;
598    
599            public String getEmailFromName(
600                            PortletPreferences preferences, long companyId, String defaultValue)
601                    throws SystemException;
602    
603            public Map<String, Serializable> getExpandoBridgeAttributes(
604                            ExpandoBridge expandoBridge, PortletRequest portletRequest)
605                    throws PortalException, SystemException;
606    
607            public Map<String, Serializable> getExpandoBridgeAttributes(
608                            ExpandoBridge expandoBridge,
609                            UploadPortletRequest uploadPortletRequest)
610                    throws PortalException, SystemException;
611    
612            public Serializable getExpandoValue(
613                            PortletRequest portletRequest, String name, int type,
614                            String displayType)
615                    throws PortalException, SystemException;
616    
617            public Serializable getExpandoValue(
618                            UploadPortletRequest uploadPortletRequest, String name, int type,
619                            String displayType)
620                    throws PortalException, SystemException;
621    
622            public String getFacebookURL(
623                            Portlet portlet, String facebookCanvasPageURL,
624                            ThemeDisplay themeDisplay)
625                    throws PortalException, SystemException;
626    
627            public String getFirstPageLayoutTypes(PageContext pageContext);
628    
629            public String getGlobalLibDir();
630    
631            public String getGoogleGadgetURL(Portlet portlet, ThemeDisplay themeDisplay)
632                    throws PortalException, SystemException;
633    
634            public String getGroupFriendlyURL(
635                            Group group, boolean privateLayoutSet, ThemeDisplay themeDisplay)
636                    throws PortalException, SystemException;
637    
638            public String[] getGroupPermissions(HttpServletRequest request);
639    
640            public String[] getGroupPermissions(PortletRequest portletRequest);
641    
642            public String[] getGuestPermissions(HttpServletRequest request);
643    
644            public String[] getGuestPermissions(PortletRequest portletRequest);
645    
646            public String getHomeURL(HttpServletRequest request)
647                    throws PortalException, SystemException;
648    
649            public String getHost(HttpServletRequest request);
650    
651            public String getHost(PortletRequest portletRequest);
652    
653            public HttpServletRequest getHttpServletRequest(
654                    PortletRequest portletRequest);
655    
656            public HttpServletResponse getHttpServletResponse(
657                    PortletResponse portletResponse);
658    
659            public String getJournalArticleActualURL(
660                            long groupId, String mainPath, String friendlyURL,
661                            Map<String, String[]> params, Map<String, Object> requestContext)
662                    throws PortalException, SystemException;
663    
664            public String getJsSafePortletId(String portletId) ;
665    
666            public String getLayoutActualURL(Layout layout);
667    
668            public String getLayoutActualURL(Layout layout, String mainPath);
669    
670            public String getLayoutActualURL(
671                            long groupId, boolean privateLayout, String mainPath,
672                            String friendlyURL)
673                    throws PortalException, SystemException;
674    
675            public String getLayoutActualURL(
676                            long groupId, boolean privateLayout, String mainPath,
677                            String friendlyURL, Map<String, String[]> params,
678                            Map<String, Object> requestContext)
679                    throws PortalException, SystemException;
680    
681            public String getLayoutEditPage(Layout layout);
682    
683            public String getLayoutEditPage(String type);
684    
685            public String getLayoutFriendlyURL(Layout layout, ThemeDisplay themeDisplay)
686                    throws PortalException, SystemException;
687    
688            public String getLayoutFriendlyURL(
689                            Layout layout, ThemeDisplay themeDisplay, Locale locale)
690                    throws PortalException, SystemException;
691    
692            public String getLayoutFullURL(Layout layout, ThemeDisplay themeDisplay)
693                    throws PortalException, SystemException;
694    
695            public String getLayoutFullURL(
696                            Layout layout, ThemeDisplay themeDisplay, boolean doAsUser)
697                    throws PortalException, SystemException;
698    
699            public String getLayoutFullURL(long groupId, String portletId)
700                    throws PortalException, SystemException;
701    
702            public String getLayoutFullURL(
703                            long groupId, String portletId, boolean secure)
704                    throws PortalException, SystemException;
705    
706            public String getLayoutFullURL(ThemeDisplay themeDisplay)
707                    throws PortalException, SystemException;
708    
709            public String getLayoutSetFriendlyURL(
710                            LayoutSet layoutSet, ThemeDisplay themeDisplay)
711                    throws PortalException, SystemException;
712    
713            public String getLayoutTarget(Layout layout);
714    
715            public String getLayoutURL(Layout layout, ThemeDisplay themeDisplay)
716                    throws PortalException, SystemException;
717    
718            public String getLayoutURL(
719                            Layout layout, ThemeDisplay themeDisplay, boolean doAsUser)
720                    throws PortalException, SystemException;
721    
722            public String getLayoutURL(ThemeDisplay themeDisplay)
723                    throws PortalException, SystemException;
724    
725            public String getLayoutViewPage(Layout layout);
726    
727            public String getLayoutViewPage(String type);
728    
729            public LiferayPortletRequest getLiferayPortletRequest(
730                    PortletRequest portletRequest);
731    
732            public LiferayPortletResponse getLiferayPortletResponse(
733                    PortletResponse portletResponse);
734    
735            public Locale getLocale(HttpServletRequest request);
736    
737            public Locale getLocale(RenderRequest renderRequest);
738    
739            public String getMailId(String mx, String popPortletPrefix, Object... ids);
740    
741            public String getNetvibesURL(Portlet portlet, ThemeDisplay themeDisplay)
742                    throws PortalException, SystemException;
743    
744            public String getNewPortletTitle(
745                    String portletTitle, String oldScopeName, String newScopeName);
746    
747            public HttpServletRequest getOriginalServletRequest(
748                    HttpServletRequest request);
749    
750            public String getOuterPortletId(HttpServletRequest request);
751    
752            public long getParentGroupId(long scopeGroupId)
753                    throws PortalException, SystemException;
754    
755            public String getPathContext();
756    
757            public String getPathFriendlyURLPrivateGroup();
758    
759            public String getPathFriendlyURLPrivateUser();
760    
761            public String getPathFriendlyURLPublic();
762    
763            public String getPathImage();
764    
765            public String getPathMain();
766    
767            public String getPathProxy();
768    
769            public long getPlidFromFriendlyURL(long companyId, String friendlyURL);
770    
771            public long getPlidFromPortletId(
772                            long groupId, boolean privateLayout, String portletId)
773                    throws PortalException, SystemException;
774    
775            public long getPlidFromPortletId(long groupId, String portletId)
776                    throws PortalException, SystemException;
777    
778            public String getPortalLibDir();
779    
780            /**
781             * @deprecated Replaced by the more general {@link #getPortalPort(boolean)}
782             */
783            public int getPortalPort();
784    
785            public int getPortalPort(boolean secure);
786    
787            public Properties getPortalProperties();
788    
789            public String getPortalURL(HttpServletRequest request);
790    
791            public String getPortalURL(HttpServletRequest request, boolean secure);
792    
793            public String getPortalURL(Layout layout, ThemeDisplay themeDisplay)
794                    throws PortalException, SystemException;
795    
796            public String getPortalURL(PortletRequest portletRequest);
797    
798            public String getPortalURL(PortletRequest portletRequest, boolean secure);
799    
800            public String getPortalURL(
801                    String serverName, int serverPort, boolean secure);
802    
803            public String getPortalURL(ThemeDisplay themeDisplay)
804                    throws PortalException, SystemException;
805    
806            public String getPortalWebDir();
807    
808            public Set<String> getPortletAddDefaultResourceCheckWhitelist();
809    
810            public Set<String> getPortletAddDefaultResourceCheckWhitelistActions();
811    
812            /**
813             * @deprecated Renamed to {@link #getPortletBreadcrumbs(HttpServletRequest)}
814             */
815            public List<BreadcrumbEntry> getPortletBreadcrumbList(
816                    HttpServletRequest request);
817    
818            public List<BreadcrumbEntry> getPortletBreadcrumbs(
819                    HttpServletRequest request);
820    
821            public String getPortletDescription(
822                    Portlet portlet, ServletContext servletContext, Locale locale);
823    
824            public String getPortletDescription(Portlet portlet, User user);
825    
826            public String getPortletDescription(String portletId, Locale locale);
827    
828            public String getPortletDescription(String portletId, String languageId);
829    
830            public String getPortletDescription(String portletId, User user);
831    
832            public String getPortletId(HttpServletRequest request);
833    
834            public String getPortletId(PortletRequest portletRequest);
835    
836            public String getPortletLongTitle(Portlet portlet, Locale locale);
837    
838            public String getPortletLongTitle(
839                    Portlet portlet, ServletContext servletContext, Locale locale);
840    
841            public String getPortletLongTitle(Portlet portlet, String languageId);
842    
843            public String getPortletLongTitle(Portlet portlet, User user);
844    
845            public String getPortletLongTitle(String portletId, Locale locale);
846    
847            public String getPortletLongTitle(String portletId, String languageId);
848    
849            public String getPortletLongTitle(String portletId, User user);
850    
851            public String getPortletNamespace(String portletId);
852    
853            public String getPortletTitle(Portlet portlet, Locale locale);
854    
855            public String getPortletTitle(
856                    Portlet portlet, ServletContext servletContext, Locale locale);
857    
858            public String getPortletTitle(Portlet portlet, String languageId);
859    
860            public String getPortletTitle(Portlet portlet, User user);
861    
862            public String getPortletTitle(RenderResponse renderResponse);
863    
864            public String getPortletTitle(String portletId, Locale locale);
865    
866            public String getPortletTitle(String portletId, String languageId);
867    
868            public String getPortletTitle(String portletId, User user);
869    
870            public String getPortletXmlFileName() throws SystemException;
871    
872            public PortletPreferences getPreferences(HttpServletRequest request);
873    
874            public PreferencesValidator getPreferencesValidator(Portlet portlet);
875    
876            public String getRelativeHomeURL(HttpServletRequest request)
877                    throws PortalException, SystemException;
878    
879            public long getScopeGroupId(HttpServletRequest request)
880                    throws PortalException, SystemException;
881    
882            public long getScopeGroupId(HttpServletRequest request, String portletId)
883                    throws PortalException, SystemException;
884    
885            public long getScopeGroupId(
886                            HttpServletRequest request, String portletId,
887                            boolean checkStagingGroup)
888                    throws PortalException, SystemException;
889    
890            public long getScopeGroupId(Layout layout);
891    
892            public long getScopeGroupId(Layout layout, String portletId);
893    
894            public long getScopeGroupId(long plid);
895    
896            public long getScopeGroupId(PortletRequest portletRequest)
897                    throws PortalException, SystemException;
898    
899            public User getSelectedUser(HttpServletRequest request)
900                    throws PortalException, SystemException;
901    
902            public User getSelectedUser(
903                            HttpServletRequest request, boolean checkPermission)
904                    throws PortalException, SystemException;
905    
906            public User getSelectedUser(PortletRequest portletRequest)
907                    throws PortalException, SystemException;
908    
909            public User getSelectedUser(
910                            PortletRequest portletRequest, boolean checkPermission)
911                    throws PortalException, SystemException;
912    
913            public ServletContext getServletContext(
914                    Portlet portlet, ServletContext servletContext);
915    
916            /**
917             * Returns the URL of the login page for the current site if one is
918             * available.
919             *
920             * @param  themeDisplay the theme display for the current page
921             * @return the URL of the login page for the current site, or
922             *         <code>null</code> if one is not available
923             * @throws PortalException if a portal exception occurred
924             * @throws SystemException if a system exception occurred
925             */
926            public String getSiteLoginURL(ThemeDisplay themeDisplay)
927                    throws PortalException, SystemException;
928    
929            public String getStaticResourceURL(HttpServletRequest request, String uri);
930    
931            public String getStaticResourceURL(
932                    HttpServletRequest request, String uri, long timestamp);
933    
934            public String getStaticResourceURL(
935                    HttpServletRequest request, String uri, String queryString);
936    
937            public String getStaticResourceURL(
938                    HttpServletRequest request, String uri, String queryString,
939                    long timestamp);
940    
941            public String getStrutsAction(HttpServletRequest request);
942    
943            public String[] getSystemGroups();
944    
945            public String[] getSystemOrganizationRoles();
946    
947            public String[] getSystemRoles();
948    
949            public String[] getSystemSiteRoles();
950    
951            public UploadPortletRequest getUploadPortletRequest(
952                    PortletRequest portletRequest);
953    
954            public UploadServletRequest getUploadServletRequest(
955                    HttpServletRequest request);
956    
957            public Date getUptime();
958    
959            public String getURLWithSessionId(String url, String sessionId);
960    
961            public User getUser(HttpServletRequest request)
962                    throws PortalException, SystemException;
963    
964            public User getUser(PortletRequest portletRequest)
965                    throws PortalException, SystemException;
966    
967            public String getUserEmailAddress(long userId) throws SystemException;
968    
969            public long getUserId(HttpServletRequest request);
970    
971            public long getUserId(PortletRequest portletRequest);
972    
973            public String getUserName(long userId, String defaultUserName);
974    
975            public String getUserName(
976                    long userId, String defaultUserName, HttpServletRequest request);
977    
978            public String getUserName(
979                    long userId, String defaultUserName, String userAttribute);
980    
981            public String getUserName(
982                    long userId, String defaultUserName, String userAttribute,
983                    HttpServletRequest request);
984    
985            public String getUserPassword(HttpServletRequest request);
986    
987            public String getUserPassword(HttpSession session);
988    
989            public String getUserPassword(PortletRequest portletRequest);
990    
991            public String getUserValue(long userId, String param, String defaultValue)
992                    throws SystemException;
993    
994            public long getValidUserId(long companyId, long userId)
995                    throws PortalException, SystemException;
996    
997            public String getVirtualLayoutActualURL(
998                            long groupId, boolean privateLayout, String mainPath,
999                            String friendlyURL, Map<String, String[]> params,
1000                            Map<String, Object> requestContext)
1001                    throws PortalException, SystemException;
1002    
1003            public String getWidgetURL(Portlet portlet, ThemeDisplay themeDisplay)
1004                    throws PortalException, SystemException;
1005    
1006            public void initCustomSQL();
1007    
1008            public boolean isAllowAddPortletDefaultResource(
1009                            HttpServletRequest request, Portlet portlet)
1010                    throws PortalException, SystemException;
1011    
1012            public boolean isCDNDynamicResourcesEnabled(HttpServletRequest request)
1013                    throws PortalException, SystemException;
1014    
1015            public boolean isCDNDynamicResourcesEnabled(long companyId);
1016    
1017            /**
1018             * @deprecated As of 6.1, renamed to {@link #isGroupAdmin(User, long)}
1019             */
1020            public boolean isCommunityAdmin(User user, long groupId) throws Exception;
1021    
1022            /**
1023             * @deprecated As of 6.1, renamed to {@link #isGroupOwner(User, long)}
1024             */
1025            public boolean isCommunityOwner(User user, long groupId) throws Exception;
1026    
1027            public boolean isCompanyAdmin(User user) throws Exception;
1028    
1029            public boolean isCompanyControlPanelPortlet(
1030                            String portletId, String category, ThemeDisplay themeDisplay)
1031                    throws PortalException, SystemException;
1032    
1033            public boolean isCompanyControlPanelPortlet(
1034                            String portletId, ThemeDisplay themeDisplay)
1035                    throws PortalException, SystemException;
1036    
1037            public boolean isCompanyControlPanelVisible(ThemeDisplay themeDisplay)
1038                    throws PortalException, SystemException;
1039    
1040            public boolean isControlPanelPortlet(
1041                            String portletId, String category, ThemeDisplay themeDisplay)
1042                    throws SystemException;
1043    
1044            public boolean isControlPanelPortlet(
1045                            String portletId, ThemeDisplay themeDisplay)
1046                    throws SystemException;
1047    
1048            public boolean isGroupAdmin(User user, long groupId) throws Exception;
1049    
1050            public boolean isGroupOwner(User user, long groupId) throws Exception;
1051    
1052            public boolean isLayoutDescendant(Layout layout, long layoutId)
1053                    throws PortalException, SystemException;
1054    
1055            public boolean isLayoutFirstPageable(Layout layout);
1056    
1057            public boolean isLayoutFirstPageable(String type);
1058    
1059            public boolean isLayoutFriendliable(Layout layout);
1060    
1061            public boolean isLayoutFriendliable(String type);
1062    
1063            public boolean isLayoutParentable(Layout layout);
1064    
1065            public boolean isLayoutParentable(String type);
1066    
1067            public boolean isLayoutSitemapable(Layout layout);
1068    
1069            public boolean isMethodGet(PortletRequest portletRequest);
1070    
1071            public boolean isMethodPost(PortletRequest portletRequest);
1072    
1073            public boolean isMultipartRequest(HttpServletRequest request);
1074    
1075            public boolean isOmniadmin(long userId);
1076    
1077            public boolean isReservedParameter(String name);
1078    
1079            public boolean isSecure(HttpServletRequest request);
1080    
1081            public boolean isSystemGroup(String groupName);
1082    
1083            public boolean isSystemRole(String roleName);
1084    
1085            public boolean isUpdateAvailable() throws SystemException;
1086    
1087            public boolean isValidResourceId(String resourceId);
1088    
1089            public void removePortalPortEventListener(
1090                    PortalPortEventListener portalPortEventListener);
1091    
1092            public String renderPage(
1093                            ServletContext servletContext, HttpServletRequest request,
1094                            HttpServletResponse response, String path)
1095                    throws IOException, ServletException;
1096    
1097            public String renderPortlet(
1098                            ServletContext servletContext, HttpServletRequest request,
1099                            HttpServletResponse response, Portlet portlet, String queryString,
1100                            boolean writeOutput)
1101                    throws IOException, ServletException;
1102    
1103            public String renderPortlet(
1104                            ServletContext servletContext, HttpServletRequest request,
1105                            HttpServletResponse response, Portlet portlet, String queryString,
1106                            String columnId, Integer columnPos, Integer columnCount,
1107                            boolean writeOutput)
1108                    throws IOException, ServletException;
1109    
1110            public String renderPortlet(
1111                            ServletContext servletContext, HttpServletRequest request,
1112                            HttpServletResponse response, Portlet portlet, String queryString,
1113                            String columnId, Integer columnPos, Integer columnCount,
1114                            String path, boolean writeOutput)
1115                    throws IOException, ServletException;
1116    
1117            public void resetCDNHosts();
1118    
1119            public Set<String> resetPortletAddDefaultResourceCheckWhitelist();
1120    
1121            public Set<String> resetPortletAddDefaultResourceCheckWhitelistActions();
1122    
1123            public void sendError(
1124                            Exception e, ActionRequest actionRequest,
1125                            ActionResponse actionResponse)
1126                    throws IOException;
1127    
1128            public void sendError(
1129                            Exception e, HttpServletRequest request,
1130                            HttpServletResponse response)
1131                    throws IOException, ServletException;
1132    
1133            public void sendError(
1134                            int status, Exception e, ActionRequest actionRequest,
1135                            ActionResponse actionResponse)
1136                    throws IOException;
1137    
1138            public void sendError(
1139                            int status, Exception e, HttpServletRequest request,
1140                            HttpServletResponse response)
1141                    throws IOException, ServletException;
1142    
1143            /**
1144             * Sets the description for the page, overriding the existing page
1145             * description.
1146             */
1147            public void setPageDescription(
1148                    String description, HttpServletRequest request);
1149    
1150            /**
1151             * Sets the keywords for the page, overriding the existing page keywords.
1152             */
1153            public void setPageKeywords(String keywords, HttpServletRequest request);
1154    
1155            /**
1156             * Sets the subtitle for the page, overriding the existing page subtitle.
1157             */
1158            public void setPageSubtitle(String subtitle, HttpServletRequest request);
1159    
1160            /**
1161             * Sets the whole title for the page, overriding the existing page whole
1162             * title.
1163             */
1164            public void setPageTitle(String title, HttpServletRequest request);
1165    
1166            /**
1167             * Sets the port obtained on the first request to the portal.
1168             */
1169            public void setPortalPort(HttpServletRequest request);
1170    
1171            public void storePreferences(PortletPreferences portletPreferences)
1172                    throws IOException, ValidatorException;
1173    
1174            public String[] stripURLAnchor(String url, String separator);
1175    
1176            public String transformCustomSQL(String sql);
1177    
1178            public PortletMode updatePortletMode(
1179                    String portletId, User user, Layout layout, PortletMode portletMode,
1180                    HttpServletRequest request);
1181    
1182            public String updateRedirect(
1183                    String redirect, String oldPath, String newPath);
1184    
1185            public WindowState updateWindowState(
1186                    String portletId, User user, Layout layout, WindowState windowState,
1187                    HttpServletRequest request);
1188    
1189    }