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.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             * Returns the canonical URL of the page, to distinguish it among its
386             * translations.
387             *
388             * @param  completeURL the complete URL of the page
389             * @param  themeDisplay the current theme display
390             * @param  layout the layout. If it is <code>null</code>, then it is
391             *         generated for the current layout
392             * @param  forceLayoutFriendlyURL adds the page friendly URL to the
393             *         canonical URL even if it is not needed
394             * @return the canonical URL
395             * @throws PortalException if a friendly URL or the group could not be
396             *         retrieved
397             * @throws SystemException if a system exception occurred
398             */
399            public String getCanonicalURL(
400                            String completeURL, ThemeDisplay themeDisplay, Layout layout,
401                            boolean forceLayoutFriendlyURL)
402                    throws PortalException, SystemException;
403    
404            /**
405             * @deprecated Replaced by the more general {@link #getCDNHost(boolean)}
406             */
407            public String getCDNHost();
408    
409            /**
410             * Returns the secure (HTTPS) or insecure (HTTP) content distribution
411             * network (CDN) host address for this portal.
412             *
413             * @param  secure whether to get the secure or insecure CDN host address
414             * @return the CDN host address
415             */
416            public String getCDNHost(boolean secure);
417    
418            public String getCDNHost(HttpServletRequest request)
419                    throws PortalException, SystemException;
420    
421            /**
422             * Returns the insecure (HTTP) content distribution network (CDN) host
423             * address
424             *
425             * @return the CDN host address
426             */
427            public String getCDNHostHttp(long companyId);
428    
429            /**
430             * Returns the secure (HTTPS) content distribution network (CDN) host
431             * address
432             *
433             * @return the CDN host address
434             */
435            public String getCDNHostHttps(long companyId);
436    
437            /**
438             * Returns the fully qualified name of the class from its ID.
439             *
440             * @param  classNameId the ID of the class
441             * @return the fully qualified name of the class
442             */
443            public String getClassName(long classNameId);
444    
445            /**
446             * Returns the ID of the class from its class object.
447             *
448             * @param  clazz the class object
449             * @return the ID of the class
450             */
451            public long getClassNameId(Class<?> clazz);
452    
453            /**
454             * Returns the ID of the class from its fully qualified name.
455             *
456             * @param  value the fully qualified name of the class
457             * @return the ID of the class
458             */
459            public long getClassNameId(String value);
460    
461            /**
462             * Returns the ID of certain portlets from the fully qualified name of one
463             * of their classes. The portlets this method supports are: blogs,
464             * bookmarks, calendar, document library, image gallery, journal, message
465             * boards, and wiki.
466             *
467             * @param  className the fully qualified name of a class in a portlet
468             * @return the ID of the portlet the class is a part of, or an empty string
469             *         if the class is not supported
470             */
471            public String getClassNamePortletId(String className);
472    
473            public Company getCompany(HttpServletRequest request)
474                    throws PortalException, SystemException;
475    
476            public Company getCompany(PortletRequest portletRequest)
477                    throws PortalException, SystemException;
478    
479            public long getCompanyId(HttpServletRequest requestuest);
480    
481            public long getCompanyId(PortletRequest portletRequest);
482    
483            public long[] getCompanyIds();
484    
485            public String getComputerAddress();
486    
487            public String getComputerName();
488    
489            public String getControlPanelCategory(
490                            String portletId, ThemeDisplay themeDisplay)
491                    throws SystemException;
492    
493            public String getControlPanelFullURL(
494                            long scopeGroupId, String ppid, Map<String, String[]> params)
495                    throws PortalException, SystemException;
496    
497            public Set<Portlet> getControlPanelPortlets(long companyId, String category)
498                    throws SystemException;
499    
500            public List<Portlet> getControlPanelPortlets(
501                            String category, ThemeDisplay themeDisplay)
502                    throws SystemException;
503    
504            public String getCreateAccountURL(
505                            HttpServletRequest request, ThemeDisplay themeDisplay)
506                    throws Exception;
507    
508            public String getCurrentCompleteURL(HttpServletRequest request);
509    
510            public String getCurrentURL(HttpServletRequest request);
511    
512            public String getCurrentURL(PortletRequest portletRequest);
513    
514            public String getCustomSQLFunctionIsNotNull();
515    
516            public String getCustomSQLFunctionIsNull();
517    
518            /**
519             * Returns the date object for the specified month, day, and year.
520             *
521             * @param  month the month (0-based, meaning 0 for January)
522             * @param  day the day of the month
523             * @param  year the year
524             * @return the date object
525             */
526            public Date getDate(int month, int day, int year);
527    
528            /**
529             * Returns the date object for the specified month, day, and year,
530             * optionally throwing an exception if the date is invalid.
531             *
532             * @param  month the month (0-based, meaning 0 for January)
533             * @param  day the day of the month
534             * @param  year the year
535             * @param  clazz the exception class to throw if the date is invalid. If
536             *         <code>null</code>, no exception will be thrown for an invalid
537             *         date.
538             * @return the date object, or <code>null</code> if the date is invalid and
539             *         no exception to throw was provided
540             * @throws PortalException if the date was invalid and <code>pe</code> was
541             *         not <code>null</code>
542             */
543            public Date getDate(
544                            int month, int day, int year,
545                            Class<? extends PortalException> clazz)
546                    throws PortalException;
547    
548            /**
549             * Returns the date object for the specified month, day, year, hour, and
550             * minute, optionally throwing an exception if the date is invalid.
551             *
552             * @param  month the month (0-based, meaning 0 for January)
553             * @param  day the day of the month
554             * @param  year the year
555             * @param  hour the hour (0-24)
556             * @param  min the minute of the hour
557             * @param  clazz the exception class to throw if the date is invalid. If
558             *         <code>null</code>, no exception will be thrown for an invalid
559             *         date.
560             * @return the date object, or <code>null</code> if the date is invalid and
561             *         no exception to throw was provided
562             * @throws PortalException if the date was invalid and <code>pe</code> was
563             *         not <code>null</code>
564             */
565            public Date getDate(
566                            int month, int day, int year, int hour, int min,
567                            Class<? extends PortalException> clazz)
568                    throws PortalException;
569    
570            /**
571             * Returns the date object for the specified month, day, year, hour, and
572             * minute, 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      hour the hour (0-24)
578             * @param      min the minute of the hour
579             * @param      pe the exception to throw if the date is invalid. If
580             *             <code>null</code>, no exception will be thrown for an invalid
581             *             date.
582             * @return     the date object, or <code>null</code> if the date is invalid
583             *             and no exception to throw was provided
584             * @throws     PortalException if the date was invalid and <code>pe</code>
585             *             was not <code>null</code>
586             * @deprecated {@link #getDate(int, int, int, int, int, Class)}
587             */
588            public Date getDate(
589                            int month, int day, int year, int hour, int min, PortalException pe)
590                    throws PortalException;
591    
592            /**
593             * Returns the date object for the specified month, day, year, hour, minute,
594             * and time zone, optionally throwing an exception if the date is invalid.
595             *
596             * @param  month the month (0-based, meaning 0 for January)
597             * @param  day the day of the month
598             * @param  year the year
599             * @param  hour the hour (0-24)
600             * @param  min the minute of the hour
601             * @param  timeZone the time zone of the date
602             * @param  clazz the exception class to throw if the date is invalid. If
603             *         <code>null</code>, no exception will be thrown for an invalid
604             *         date.
605             * @return the date object, or <code>null</code> if the date is invalid and
606             *         no exception to throw was provided
607             * @throws PortalException if the date was invalid and <code>pe</code> was
608             *         not <code>null</code>
609             */
610            public Date getDate(
611                            int month, int day, int year, int hour, int min, TimeZone timeZone,
612                            Class<? extends PortalException> clazz)
613                    throws PortalException;
614    
615            /**
616             * Returns the date object for the specified month, day, year, hour, minute,
617             * and time zone, optionally throwing an exception if the date is invalid.
618             *
619             * @param      month the month (0-based, meaning 0 for January)
620             * @param      day the day of the month
621             * @param      year the year
622             * @param      hour the hour (0-24)
623             * @param      min the minute of the hour
624             * @param      timeZone the time zone of the date
625             * @param      pe the exception 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
629             *             and no exception to throw was provided
630             * @throws     PortalException if the date was invalid and <code>pe</code>
631             *             was not <code>null</code>
632             * @deprecated {@link #getDate(int, int, int, int, int, TimeZone, Class)}
633             */
634            public Date getDate(
635                            int month, int day, int year, int hour, int min, TimeZone timeZone,
636                            PortalException pe)
637                    throws PortalException;
638    
639            /**
640             * Returns the date object for the specified month, day, and year,
641             * optionally throwing an exception if the date is invalid.
642             *
643             * @param      month the month (0-based, meaning 0 for January)
644             * @param      day the day of the month
645             * @param      year the year
646             * @param      pe the exception to throw if the date is invalid. If
647             *             <code>null</code>, no exception will be thrown for an invalid
648             *             date.
649             * @return     the date object, or <code>null</code> if the date is invalid
650             *             and no exception to throw was provided
651             * @throws     PortalException if the date was invalid and <code>pe</code>
652             *             was not <code>null</code>
653             * @deprecated {@link #getDate(int, int, int, Class)}
654             */
655            public Date getDate(int month, int day, int year, PortalException pe)
656                    throws PortalException;
657    
658            /**
659             * Returns the date object for the specified month, day, year, and time
660             * zone, optionally throwing an exception if the date is invalid.
661             *
662             * @param  month the month (0-based, meaning 0 for January)
663             * @param  day the day of the month
664             * @param  year the year
665             * @param  timeZone the time zone of the date
666             * @param  clazz the exception class to throw if the date is invalid. If
667             *         <code>null</code>, no exception will be thrown for an invalid
668             *         date.
669             * @return the date object, or <code>null</code> if the date is invalid and
670             *         no exception to throw was provided
671             * @throws PortalException if the date was invalid and <code>pe</code> was
672             *         not <code>null</code>
673             */
674            public Date getDate(
675                            int month, int day, int year, TimeZone timeZone,
676                            Class<? extends PortalException> clazz)
677                    throws PortalException;
678    
679            /**
680             * Returns the date object for the specified month, day, year, and time
681             * zone, optionally throwing an exception if the date is invalid.
682             *
683             * @param      month the month (0-based, meaning 0 for January)
684             * @param      day the day of the month
685             * @param      year the year
686             * @param      timeZone the time zone of the date
687             * @param      pe the exception to throw if the date is invalid. If
688             *             <code>null</code>, no exception will be thrown for an invalid
689             *             date.
690             * @return     the date object, or <code>null</code> if the date is invalid
691             *             and no exception to throw was provided
692             * @throws     PortalException if the date was invalid and <code>pe</code>
693             *             was not <code>null</code>
694             * @deprecated {@link #getDate(int, int, int, TimeZone, Class)}
695             */
696            public Date getDate(
697                            int month, int day, int year, TimeZone timeZone, PortalException pe)
698                    throws PortalException;
699    
700            public long getDefaultCompanyId();
701    
702            public long getDigestAuthUserId(HttpServletRequest request)
703                    throws PortalException, SystemException;
704    
705            public String getEmailFromAddress(
706                            PortletPreferences preferences, long companyId, String defaultValue)
707                    throws SystemException;
708    
709            public String getEmailFromName(
710                            PortletPreferences preferences, long companyId, String defaultValue)
711                    throws SystemException;
712    
713            public Map<String, Serializable> getExpandoBridgeAttributes(
714                            ExpandoBridge expandoBridge, PortletRequest portletRequest)
715                    throws PortalException, SystemException;
716    
717            public Map<String, Serializable> getExpandoBridgeAttributes(
718                            ExpandoBridge expandoBridge,
719                            UploadPortletRequest uploadPortletRequest)
720                    throws PortalException, SystemException;
721    
722            public Serializable getExpandoValue(
723                            PortletRequest portletRequest, String name, int type,
724                            String displayType)
725                    throws PortalException, SystemException;
726    
727            public Serializable getExpandoValue(
728                            UploadPortletRequest uploadPortletRequest, String name, int type,
729                            String displayType)
730                    throws PortalException, SystemException;
731    
732            public String getFacebookURL(
733                            Portlet portlet, String facebookCanvasPageURL,
734                            ThemeDisplay themeDisplay)
735                    throws PortalException, SystemException;
736    
737            public String getFirstPageLayoutTypes(PageContext pageContext);
738    
739            public String getGlobalLibDir();
740    
741            public String getGoogleGadgetURL(Portlet portlet, ThemeDisplay themeDisplay)
742                    throws PortalException, SystemException;
743    
744            public String getGroupFriendlyURL(
745                            Group group, boolean privateLayoutSet, ThemeDisplay themeDisplay)
746                    throws PortalException, SystemException;
747    
748            public String getGroupFriendlyURL(
749                            Group group, boolean privateLayoutSet, ThemeDisplay themeDisplay,
750                            Locale locale)
751                    throws PortalException, SystemException;
752    
753            public String[] getGroupPermissions(HttpServletRequest request);
754    
755            public String[] getGroupPermissions(
756                    HttpServletRequest request, String className);
757    
758            public String[] getGroupPermissions(PortletRequest portletRequest);
759    
760            public String[] getGroupPermissions(
761                    PortletRequest portletRequest, String className);
762    
763            public String[] getGuestPermissions(HttpServletRequest request);
764    
765            public String[] getGuestPermissions(
766                    HttpServletRequest request, String className);
767    
768            public String[] getGuestPermissions(PortletRequest portletRequest);
769    
770            public String[] getGuestPermissions(
771                    PortletRequest portletRequest, String className);
772    
773            public String getHomeURL(HttpServletRequest request)
774                    throws PortalException, SystemException;
775    
776            public String getHost(HttpServletRequest request);
777    
778            public String getHost(PortletRequest portletRequest);
779    
780            public HttpServletRequest getHttpServletRequest(
781                    PortletRequest portletRequest);
782    
783            public HttpServletResponse getHttpServletResponse(
784                    PortletResponse portletResponse);
785    
786            public String getJournalArticleActualURL(
787                            long groupId, boolean privateLayout, String mainPath,
788                            String friendlyURL, Map<String, String[]> params,
789                            Map<String, Object> requestContext)
790                    throws PortalException, SystemException;
791    
792            public String getJsSafePortletId(String portletId);
793    
794            public String getLayoutActualURL(Layout layout);
795    
796            public String getLayoutActualURL(Layout layout, String mainPath);
797    
798            public String getLayoutActualURL(
799                            long groupId, boolean privateLayout, String mainPath,
800                            String friendlyURL)
801                    throws PortalException, SystemException;
802    
803            public String getLayoutActualURL(
804                            long groupId, boolean privateLayout, String mainPath,
805                            String friendlyURL, Map<String, String[]> params,
806                            Map<String, Object> requestContext)
807                    throws PortalException, SystemException;
808    
809            public String getLayoutEditPage(Layout layout);
810    
811            public String getLayoutEditPage(String type);
812    
813            public String getLayoutFriendlyURL(Layout layout, ThemeDisplay themeDisplay)
814                    throws PortalException, SystemException;
815    
816            public String getLayoutFriendlyURL(
817                            Layout layout, ThemeDisplay themeDisplay, Locale locale)
818                    throws PortalException, SystemException;
819    
820            public String getLayoutFullURL(Layout layout, ThemeDisplay themeDisplay)
821                    throws PortalException, SystemException;
822    
823            public String getLayoutFullURL(
824                            Layout layout, ThemeDisplay themeDisplay, boolean doAsUser)
825                    throws PortalException, SystemException;
826    
827            public String getLayoutFullURL(long groupId, String portletId)
828                    throws PortalException, SystemException;
829    
830            public String getLayoutFullURL(
831                            long groupId, String portletId, boolean secure)
832                    throws PortalException, SystemException;
833    
834            public String getLayoutFullURL(ThemeDisplay themeDisplay)
835                    throws PortalException, SystemException;
836    
837            public String getLayoutSetFriendlyURL(
838                            LayoutSet layoutSet, ThemeDisplay themeDisplay)
839                    throws PortalException, SystemException;
840    
841            public String getLayoutTarget(Layout layout);
842    
843            public String getLayoutURL(Layout layout, ThemeDisplay themeDisplay)
844                    throws PortalException, SystemException;
845    
846            public String getLayoutURL(
847                            Layout layout, ThemeDisplay themeDisplay, boolean doAsUser)
848                    throws PortalException, SystemException;
849    
850            public String getLayoutURL(ThemeDisplay themeDisplay)
851                    throws PortalException, SystemException;
852    
853            public String getLayoutViewPage(Layout layout);
854    
855            public String getLayoutViewPage(String type);
856    
857            public LiferayPortletRequest getLiferayPortletRequest(
858                    PortletRequest portletRequest);
859    
860            public LiferayPortletResponse getLiferayPortletResponse(
861                    PortletResponse portletResponse);
862    
863            public Locale getLocale(HttpServletRequest request);
864    
865            public Locale getLocale(
866                    HttpServletRequest request, HttpServletResponse response,
867                    boolean initialize);
868    
869            public Locale getLocale(RenderRequest renderRequest);
870    
871            public String getMailId(String mx, String popPortletPrefix, Object... ids);
872    
873            public String getNetvibesURL(Portlet portlet, ThemeDisplay themeDisplay)
874                    throws PortalException, SystemException;
875    
876            public String getNewPortletTitle(
877                    String portletTitle, String oldScopeName, String newScopeName);
878    
879            public HttpServletRequest getOriginalServletRequest(
880                    HttpServletRequest request);
881    
882            public long getParentGroupId(long scopeGroupId)
883                    throws PortalException, SystemException;
884    
885            public String getPathContext();
886    
887            public String getPathFriendlyURLPrivateGroup();
888    
889            public String getPathFriendlyURLPrivateUser();
890    
891            public String getPathFriendlyURLPublic();
892    
893            public String getPathImage();
894    
895            public String getPathMain();
896    
897            public String getPathProxy();
898    
899            public long getPlidFromFriendlyURL(long companyId, String friendlyURL);
900    
901            public long getPlidFromPortletId(
902                            long groupId, boolean privateLayout, String portletId)
903                    throws PortalException, SystemException;
904    
905            public long getPlidFromPortletId(long groupId, String portletId)
906                    throws PortalException, SystemException;
907    
908            public String getPortalLibDir();
909    
910            /**
911             * @deprecated Replaced by the more general {@link #getPortalPort(boolean)}
912             */
913            public int getPortalPort();
914    
915            public int getPortalPort(boolean secure);
916    
917            public Properties getPortalProperties();
918    
919            public String getPortalURL(HttpServletRequest request);
920    
921            public String getPortalURL(HttpServletRequest request, boolean secure);
922    
923            public String getPortalURL(Layout layout, ThemeDisplay themeDisplay)
924                    throws PortalException, SystemException;
925    
926            public String getPortalURL(PortletRequest portletRequest);
927    
928            public String getPortalURL(PortletRequest portletRequest, boolean secure);
929    
930            public String getPortalURL(
931                    String serverName, int serverPort, boolean secure);
932    
933            public String getPortalURL(ThemeDisplay themeDisplay)
934                    throws PortalException, SystemException;
935    
936            public String getPortalWebDir();
937    
938            public Set<String> getPortletAddDefaultResourceCheckWhitelist();
939    
940            public Set<String> getPortletAddDefaultResourceCheckWhitelistActions();
941    
942            /**
943             * @deprecated Renamed to {@link #getPortletBreadcrumbs(HttpServletRequest)}
944             */
945            public List<BreadcrumbEntry> getPortletBreadcrumbList(
946                    HttpServletRequest request);
947    
948            public List<BreadcrumbEntry> getPortletBreadcrumbs(
949                    HttpServletRequest request);
950    
951            public String getPortletDescription(
952                    Portlet portlet, ServletContext servletContext, Locale locale);
953    
954            public String getPortletDescription(Portlet portlet, User user);
955    
956            public String getPortletDescription(String portletId, Locale locale);
957    
958            public String getPortletDescription(String portletId, String languageId);
959    
960            public String getPortletDescription(String portletId, User user);
961    
962            public String getPortletId(HttpServletRequest request);
963    
964            public String getPortletId(PortletRequest portletRequest);
965    
966            public String getPortletLongTitle(Portlet portlet, Locale locale);
967    
968            public String getPortletLongTitle(
969                    Portlet portlet, ServletContext servletContext, Locale locale);
970    
971            public String getPortletLongTitle(Portlet portlet, String languageId);
972    
973            public String getPortletLongTitle(Portlet portlet, User user);
974    
975            public String getPortletLongTitle(String portletId, Locale locale);
976    
977            public String getPortletLongTitle(String portletId, String languageId);
978    
979            public String getPortletLongTitle(String portletId, User user);
980    
981            public String getPortletNamespace(String portletId);
982    
983            public String getPortletTitle(Portlet portlet, Locale locale);
984    
985            public String getPortletTitle(
986                    Portlet portlet, ServletContext servletContext, Locale locale);
987    
988            public String getPortletTitle(Portlet portlet, String languageId);
989    
990            public String getPortletTitle(Portlet portlet, User user);
991    
992            public String getPortletTitle(RenderResponse renderResponse);
993    
994            public String getPortletTitle(String portletId, Locale locale);
995    
996            public String getPortletTitle(String portletId, String languageId);
997    
998            public String getPortletTitle(String portletId, User user);
999    
1000            public String getPortletXmlFileName() throws SystemException;
1001    
1002            public PortletPreferences getPreferences(HttpServletRequest request);
1003    
1004            public PreferencesValidator getPreferencesValidator(Portlet portlet);
1005    
1006            public String getRelativeHomeURL(HttpServletRequest request)
1007                    throws PortalException, SystemException;
1008    
1009            public long getScopeGroupId(HttpServletRequest request)
1010                    throws PortalException, SystemException;
1011    
1012            public long getScopeGroupId(HttpServletRequest request, String portletId)
1013                    throws PortalException, SystemException;
1014    
1015            public long getScopeGroupId(
1016                            HttpServletRequest request, String portletId,
1017                            boolean checkStagingGroup)
1018                    throws PortalException, SystemException;
1019    
1020            public long getScopeGroupId(Layout layout);
1021    
1022            public long getScopeGroupId(Layout layout, String portletId);
1023    
1024            public long getScopeGroupId(long plid);
1025    
1026            public long getScopeGroupId(PortletRequest portletRequest)
1027                    throws PortalException, SystemException;
1028    
1029            public User getSelectedUser(HttpServletRequest request)
1030                    throws PortalException, SystemException;
1031    
1032            public User getSelectedUser(
1033                            HttpServletRequest request, boolean checkPermission)
1034                    throws PortalException, SystemException;
1035    
1036            public User getSelectedUser(PortletRequest portletRequest)
1037                    throws PortalException, SystemException;
1038    
1039            public User getSelectedUser(
1040                            PortletRequest portletRequest, boolean checkPermission)
1041                    throws PortalException, SystemException;
1042    
1043            public ServletContext getServletContext(
1044                    Portlet portlet, ServletContext servletContext);
1045    
1046            /**
1047             * Returns the URL of the login page for the current site if one is
1048             * available.
1049             *
1050             * @param  themeDisplay the theme display for the current page
1051             * @return the URL of the login page for the current site, or
1052             *         <code>null</code> if one is not available
1053             * @throws PortalException if a portal exception occurred
1054             * @throws SystemException if a system exception occurred
1055             */
1056            public String getSiteLoginURL(ThemeDisplay themeDisplay)
1057                    throws PortalException, SystemException;
1058    
1059            public String getStaticResourceURL(HttpServletRequest request, String uri);
1060    
1061            public String getStaticResourceURL(
1062                    HttpServletRequest request, String uri, long timestamp);
1063    
1064            public String getStaticResourceURL(
1065                    HttpServletRequest request, String uri, String queryString);
1066    
1067            public String getStaticResourceURL(
1068                    HttpServletRequest request, String uri, String queryString,
1069                    long timestamp);
1070    
1071            public String getStrutsAction(HttpServletRequest request);
1072    
1073            public String[] getSystemGroups();
1074    
1075            public String[] getSystemOrganizationRoles();
1076    
1077            public String[] getSystemRoles();
1078    
1079            public String[] getSystemSiteRoles();
1080    
1081            public String getUniqueElementId(
1082                    HttpServletRequest request, String namespace, String id);
1083    
1084            public String getUniqueElementId(
1085                    PortletRequest request, String namespace, String id);
1086    
1087            public UploadPortletRequest getUploadPortletRequest(
1088                    PortletRequest portletRequest);
1089    
1090            public UploadServletRequest getUploadServletRequest(
1091                    HttpServletRequest request);
1092    
1093            public Date getUptime();
1094    
1095            public String getURLWithSessionId(String url, String sessionId);
1096    
1097            public User getUser(HttpServletRequest request)
1098                    throws PortalException, SystemException;
1099    
1100            public User getUser(PortletRequest portletRequest)
1101                    throws PortalException, SystemException;
1102    
1103            public String getUserEmailAddress(long userId) throws SystemException;
1104    
1105            public long getUserId(HttpServletRequest request);
1106    
1107            public long getUserId(PortletRequest portletRequest);
1108    
1109            public String getUserName(BaseModel<?> baseModel);
1110    
1111            public String getUserName(long userId, String defaultUserName);
1112    
1113            public String getUserName(
1114                    long userId, String defaultUserName, HttpServletRequest request);
1115    
1116            public String getUserName(
1117                    long userId, String defaultUserName, String userAttribute);
1118    
1119            public String getUserName(
1120                    long userId, String defaultUserName, String userAttribute,
1121                    HttpServletRequest request);
1122    
1123            public String getUserPassword(HttpServletRequest request);
1124    
1125            public String getUserPassword(HttpSession session);
1126    
1127            public String getUserPassword(PortletRequest portletRequest);
1128    
1129            public String getUserValue(long userId, String param, String defaultValue)
1130                    throws SystemException;
1131    
1132            public long getValidUserId(long companyId, long userId)
1133                    throws PortalException, SystemException;
1134    
1135            public String getVirtualLayoutActualURL(
1136                            long groupId, boolean privateLayout, String mainPath,
1137                            String friendlyURL, Map<String, String[]> params,
1138                            Map<String, Object> requestContext)
1139                    throws PortalException, SystemException;
1140    
1141            public String getWidgetURL(Portlet portlet, ThemeDisplay themeDisplay)
1142                    throws PortalException, SystemException;
1143    
1144            public void initCustomSQL();
1145    
1146            public User initUser(HttpServletRequest request) throws Exception;
1147    
1148            public boolean isAllowAddPortletDefaultResource(
1149                            HttpServletRequest request, Portlet portlet)
1150                    throws PortalException, SystemException;
1151    
1152            public boolean isCDNDynamicResourcesEnabled(HttpServletRequest request)
1153                    throws PortalException, SystemException;
1154    
1155            public boolean isCDNDynamicResourcesEnabled(long companyId);
1156    
1157            /**
1158             * @deprecated As of 6.1.0, renamed to {@link #isGroupAdmin(User, long)}
1159             */
1160            public boolean isCommunityAdmin(User user, long groupId) throws Exception;
1161    
1162            /**
1163             * @deprecated As of 6.1.0, renamed to {@link #isGroupOwner(User, long)}
1164             */
1165            public boolean isCommunityOwner(User user, long groupId) throws Exception;
1166    
1167            public boolean isCompanyAdmin(User user) throws Exception;
1168    
1169            public boolean isCompanyControlPanelPortlet(
1170                            String portletId, String category, ThemeDisplay themeDisplay)
1171                    throws PortalException, SystemException;
1172    
1173            public boolean isCompanyControlPanelPortlet(
1174                            String portletId, ThemeDisplay themeDisplay)
1175                    throws PortalException, SystemException;
1176    
1177            public boolean isCompanyControlPanelVisible(ThemeDisplay themeDisplay)
1178                    throws PortalException, SystemException;
1179    
1180            public boolean isControlPanelPortlet(
1181                            String portletId, String category, ThemeDisplay themeDisplay)
1182                    throws SystemException;
1183    
1184            public boolean isControlPanelPortlet(
1185                            String portletId, ThemeDisplay themeDisplay)
1186                    throws SystemException;
1187    
1188            public boolean isGroupAdmin(User user, long groupId) throws Exception;
1189    
1190            public boolean isGroupFriendlyURL(
1191                    String fullURL, String groupFriendlyURL, String layoutFriendlyURL);
1192    
1193            public boolean isGroupOwner(User user, long groupId) throws Exception;
1194    
1195            public boolean isLayoutDescendant(Layout layout, long layoutId)
1196                    throws PortalException, SystemException;
1197    
1198            public boolean isLayoutFirstPageable(Layout layout);
1199    
1200            public boolean isLayoutFirstPageable(String type);
1201    
1202            public boolean isLayoutFriendliable(Layout layout);
1203    
1204            public boolean isLayoutFriendliable(String type);
1205    
1206            public boolean isLayoutParentable(Layout layout);
1207    
1208            public boolean isLayoutParentable(String type);
1209    
1210            public boolean isLayoutSitemapable(Layout layout);
1211    
1212            public boolean isMethodGet(PortletRequest portletRequest);
1213    
1214            public boolean isMethodPost(PortletRequest portletRequest);
1215    
1216            public boolean isMultipartRequest(HttpServletRequest request);
1217    
1218            public boolean isOmniadmin(long userId);
1219    
1220            public boolean isReservedParameter(String name);
1221    
1222            public boolean isSecure(HttpServletRequest request);
1223    
1224            public boolean isSystemGroup(String groupName);
1225    
1226            public boolean isSystemRole(String roleName);
1227    
1228            public boolean isUpdateAvailable() throws SystemException;
1229    
1230            public boolean isValidResourceId(String resourceId);
1231    
1232            public void removePortalPortEventListener(
1233                    PortalPortEventListener portalPortEventListener);
1234    
1235            public String renderPage(
1236                            ServletContext servletContext, HttpServletRequest request,
1237                            HttpServletResponse response, String path)
1238                    throws IOException, ServletException;
1239    
1240            public String renderPortlet(
1241                            ServletContext servletContext, HttpServletRequest request,
1242                            HttpServletResponse response, Portlet portlet, String queryString,
1243                            boolean writeOutput)
1244                    throws IOException, ServletException;
1245    
1246            public String renderPortlet(
1247                            ServletContext servletContext, HttpServletRequest request,
1248                            HttpServletResponse response, Portlet portlet, String queryString,
1249                            String columnId, Integer columnPos, Integer columnCount,
1250                            boolean writeOutput)
1251                    throws IOException, ServletException;
1252    
1253            public String renderPortlet(
1254                            ServletContext servletContext, HttpServletRequest request,
1255                            HttpServletResponse response, Portlet portlet, String queryString,
1256                            String columnId, Integer columnPos, Integer columnCount,
1257                            String path, boolean writeOutput)
1258                    throws IOException, ServletException;
1259    
1260            public void resetCDNHosts();
1261    
1262            public Set<String> resetPortletAddDefaultResourceCheckWhitelist();
1263    
1264            public Set<String> resetPortletAddDefaultResourceCheckWhitelistActions();
1265    
1266            public void sendError(
1267                            Exception e, ActionRequest actionRequest,
1268                            ActionResponse actionResponse)
1269                    throws IOException;
1270    
1271            public void sendError(
1272                            Exception e, HttpServletRequest request,
1273                            HttpServletResponse response)
1274                    throws IOException, ServletException;
1275    
1276            public void sendError(
1277                            int status, Exception e, ActionRequest actionRequest,
1278                            ActionResponse actionResponse)
1279                    throws IOException;
1280    
1281            public void sendError(
1282                            int status, Exception e, HttpServletRequest request,
1283                            HttpServletResponse response)
1284                    throws IOException, ServletException;
1285    
1286            /**
1287             * Sets the description for the page, overriding the existing page
1288             * description.
1289             */
1290            public void setPageDescription(
1291                    String description, HttpServletRequest request);
1292    
1293            /**
1294             * Sets the keywords for the page, overriding the existing page keywords.
1295             */
1296            public void setPageKeywords(String keywords, HttpServletRequest request);
1297    
1298            /**
1299             * Sets the subtitle for the page, overriding the existing page subtitle.
1300             */
1301            public void setPageSubtitle(String subtitle, HttpServletRequest request);
1302    
1303            /**
1304             * Sets the whole title for the page, overriding the existing page whole
1305             * title.
1306             */
1307            public void setPageTitle(String title, HttpServletRequest request);
1308    
1309            /**
1310             * Sets the port obtained on the first request to the portal.
1311             */
1312            public void setPortalPort(HttpServletRequest request);
1313    
1314            public void storePreferences(PortletPreferences portletPreferences)
1315                    throws IOException, ValidatorException;
1316    
1317            public String[] stripURLAnchor(String url, String separator);
1318    
1319            public String transformCustomSQL(String sql);
1320    
1321            public String transformSQL(String sql);
1322    
1323            public PortletMode updatePortletMode(
1324                    String portletId, User user, Layout layout, PortletMode portletMode,
1325                    HttpServletRequest request);
1326    
1327            public String updateRedirect(
1328                    String redirect, String oldPath, String newPath);
1329    
1330            public WindowState updateWindowState(
1331                    String portletId, User user, Layout layout, WindowState windowState,
1332                    HttpServletRequest request);
1333    
1334    }