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