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