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