001    /**
002     * Copyright (c) 2000-present 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.theme;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.json.JSON;
021    import com.liferay.portal.kernel.language.LanguageUtil;
022    import com.liferay.portal.kernel.log.Log;
023    import com.liferay.portal.kernel.log.LogFactoryUtil;
024    import com.liferay.portal.kernel.mobile.device.Device;
025    import com.liferay.portal.kernel.portlet.PortletProvider;
026    import com.liferay.portal.kernel.portlet.PortletProviderUtil;
027    import com.liferay.portal.kernel.util.Http;
028    import com.liferay.portal.kernel.util.HttpUtil;
029    import com.liferay.portal.kernel.util.LocaleThreadLocal;
030    import com.liferay.portal.kernel.util.Mergeable;
031    import com.liferay.portal.kernel.util.StringPool;
032    import com.liferay.portal.kernel.util.TimeZoneThreadLocal;
033    import com.liferay.portal.kernel.util.Validator;
034    import com.liferay.portal.model.Account;
035    import com.liferay.portal.model.ColorScheme;
036    import com.liferay.portal.model.Company;
037    import com.liferay.portal.model.Contact;
038    import com.liferay.portal.model.Group;
039    import com.liferay.portal.model.Layout;
040    import com.liferay.portal.model.LayoutSet;
041    import com.liferay.portal.model.LayoutTypePortlet;
042    import com.liferay.portal.model.Theme;
043    import com.liferay.portal.model.ThemeSetting;
044    import com.liferay.portal.model.User;
045    import com.liferay.portal.security.permission.PermissionChecker;
046    import com.liferay.portal.service.GroupLocalServiceUtil;
047    import com.liferay.portal.service.LayoutLocalServiceUtil;
048    import com.liferay.portal.util.PortalUtil;
049    import com.liferay.portal.util.PortletKeys;
050    import com.liferay.portlet.admin.util.PortalMyAccountApplicationType;
051    import com.liferay.portlet.exportimport.staging.StagingUtil;
052    import com.liferay.portlet.mobiledevicerules.MDRRuleGroupInstance;
053    
054    import java.io.Serializable;
055    
056    import java.util.List;
057    import java.util.Locale;
058    import java.util.Map;
059    import java.util.Properties;
060    import java.util.TimeZone;
061    
062    import javax.portlet.PortletRequest;
063    import javax.portlet.PortletURL;
064    
065    import javax.servlet.http.HttpServletRequest;
066    import javax.servlet.http.HttpServletResponse;
067    
068    /**
069     * Provides general configuration methods for the portal, providing access to
070     * the portal's pages, sites, themes, locales, URLs, and more. This class is an
071     * information context object that holds data commonly referred to for various
072     * kinds of front-end information.
073     *
074     * <p>
075     * Liferay makes the <code>ThemeDisplay</code> available as a request attribute
076     * and in various scripting and templating scopes. A typical way to obtain
077     * <code>ThemeDisplay</code> is from a request:
078     * </p>
079     *
080     * <p>
081     * <pre>
082     * <code>
083     * themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
084     * </code>
085     * </pre>
086     * </p>
087     *
088     * @author Brian Wing Shun Chan
089     */
090    @JSON
091    @ProviderType
092    public class ThemeDisplay
093            implements Cloneable, Mergeable<ThemeDisplay>, Serializable {
094    
095            public ThemeDisplay() {
096                    if (_log.isDebugEnabled()) {
097                            _log.debug("Creating new instance " + hashCode());
098                    }
099    
100                    _portletDisplay.setThemeDisplay(this);
101            }
102    
103            @Override
104            public Object clone() throws CloneNotSupportedException {
105                    ThemeDisplay themeDisplay = (ThemeDisplay)super.clone();
106    
107                    PortletDisplay portletDisplay = new PortletDisplay();
108    
109                    _portletDisplay.copyTo(portletDisplay);
110    
111                    themeDisplay._portletDisplay = portletDisplay;
112    
113                    portletDisplay.setThemeDisplay(themeDisplay);
114    
115                    return themeDisplay;
116            }
117    
118            public Account getAccount() {
119                    return _account;
120            }
121    
122            /**
123             * Returns the content delivery network (CDN) base URL, or the current
124             * portal URL if the CDN base URL is <code>null</code>. The CDN base URL can
125             * be configured by setting the <code>cdn.host.http</code> or
126             * <code>cdn.host.https</code> property in a
127             * <code>portal-ext.properties</code> file.
128             *
129             * @return the CDN base URL, or the current portal URL if the CDN base URL
130             *         is <code>null</code>
131             */
132            public String getCDNBaseURL() {
133                    if (_cdnBaseURL != null) {
134                            return _cdnBaseURL;
135                    }
136    
137                    String host = getCDNHost();
138    
139                    if (Validator.isNull(host)) {
140                            String portalURL = getPortalURL();
141    
142                            try {
143                                    portalURL = PortalUtil.getPortalURL(getLayout(), this);
144                            }
145                            catch (Exception e) {
146                                    _log.error(e, e);
147                            }
148    
149                            host = portalURL;
150                    }
151    
152                    _cdnBaseURL = host;
153    
154                    return _cdnBaseURL;
155            }
156    
157            /**
158             * Returns the content delivery network (CDN) dynamic resources host, or the
159             * current portal URL if the CDN dynamic resources host is
160             * <code>null</code>. By setting the
161             * <code>cdn.dynamic.resources.enabled</code> property to <code>true</code>
162             * in a <code>portal-ext.properties</code> file, the CDN can be used for
163             * dynamic resources, like minified CSS and JS files.
164             *
165             * @return the CDN dynamic resources host, or the current portal URL if the
166             *         CDN dynamic resources host is <code>null</code>
167             */
168            public String getCDNDynamicResourcesHost() {
169                    return _cdnDynamicResourcesHost;
170            }
171    
172            public String getCDNHost() {
173                    return _cdnHost;
174            }
175    
176            public ColorScheme getColorScheme() {
177                    return _colorScheme;
178            }
179    
180            /**
181             * Returns the color scheme ID as defined in the theme's
182             * <code>liferay-look-and-feel.xml</code>.
183             *
184             * @return the color scheme ID as defined in the theme's
185             *         <code>liferay-look-and-feel.xml</code>
186             */
187            public String getColorSchemeId() {
188                    return _colorScheme.getColorSchemeId();
189            }
190    
191            /**
192             * Returns the portal instance bean.
193             *
194             * <p>
195             * Company is Liferay's technical name for a portal instance.
196             * <p>
197             *
198             * @return the portal instance bean
199             */
200            public Company getCompany() {
201                    return _company;
202            }
203    
204            public long getCompanyGroupId() {
205                    return _companyGroupId;
206            }
207    
208            /**
209             * Returns the portal instance ID.
210             *
211             * <p>
212             * Company is Liferay's technical name for a portal instance.
213             * <p>
214             *
215             * @return the portal instance ID
216             */
217            public long getCompanyId() {
218                    return _company.getCompanyId();
219            }
220    
221            /**
222             * Returns the server's relative path to the portal instance's logo.
223             *
224             * <p>
225             * Company is Liferay's technical name for a portal instance.
226             * <p>
227             *
228             * @return the server's relative path to the portal instance's logo
229             */
230            public String getCompanyLogo() {
231                    return _companyLogo;
232            }
233    
234            /**
235             * Returns the height of the portal instance's logo in pixels.
236             *
237             * <p>
238             * Company is Liferay's technical name for a portal instance.
239             * <p>
240             *
241             * @return the height of the portal instance's logo in pixels
242             */
243            public int getCompanyLogoHeight() {
244                    return _companyLogoHeight;
245            }
246    
247            /**
248             * Returns the width of the portal instance's logo in pixels.
249             *
250             * <p>
251             * Company is Liferay's technical name for a portal instance.
252             * <p>
253             *
254             * @return the width of the portal instance's logo in pixels
255             */
256            public int getCompanyLogoWidth() {
257                    return _companyLogoWidth;
258            }
259    
260            public Contact getContact() {
261                    return _contact;
262            }
263    
264            /**
265             * Returns the portal instance's default user.
266             *
267             * @return the portal instance's default user
268             */
269            public User getDefaultUser() throws PortalException {
270                    if (_defaultUser == null) {
271                            _defaultUser = _company.getDefaultUser();
272                    }
273    
274                    return _defaultUser;
275            }
276    
277            /**
278             * Returns the ID of the portal instance's default user.
279             *
280             * @return the ID of the portal instance's default user
281             */
282            public long getDefaultUserId() throws PortalException {
283                    return getDefaultUser().getUserId();
284            }
285    
286            /**
287             * Returns the information about the detected device, such as the device's
288             * brand, browser, operating system, screen resolution, etc.
289             *
290             * @return the information about the detected device
291             */
292            public Device getDevice() {
293                    return _device;
294            }
295    
296            public long getDoAsGroupId() {
297                    return _doAsGroupId;
298            }
299    
300            /**
301             * Returns the encrypted ID of the "do as" user, which can be used by an
302             * administrative user to impersonate another user, on that user's behalf.
303             *
304             * @return the encrypted ID of the "do as" user, which can be used by an
305             *         administrative user to impersonate another user, on that user's
306             *         behalf
307             */
308            public String getDoAsUserId() {
309                    return _doAsUserId;
310            }
311    
312            public String getDoAsUserLanguageId() {
313                    return _doAsUserLanguageId;
314            }
315    
316            public String getFacebookCanvasPageURL() {
317                    return _facebookCanvasPageURL;
318            }
319    
320            /**
321             * Returns the current internationalization language's code.
322             *
323             * <p>
324             * For example:
325             * </p>
326             *
327             * <p>
328             * English (U.K.) returns <code>en_GB</code>
329             * </p>
330             *
331             * @return the current internationalization language's code
332             */
333            public String getI18nLanguageId() {
334                    return _i18nLanguageId;
335            }
336    
337            /**
338             * Returns the path element for the current internationalization language.
339             *
340             * <p>
341             * For example, the German localization returns <code>/de</code>. Liferay's
342             * UI language can be changed by adding the language code into the URL path.
343             * The following URL uses the German localization:
344             * <code>http://localhost:8080/de/web/guest/home</code>.
345             * </p>
346             *
347             * @return the path element for the current internationalization language
348             */
349            public String getI18nPath() {
350                    return _i18nPath;
351            }
352    
353            /**
354             * Returns the current language's code.
355             *
356             * <p>
357             * For example:
358             * </p>
359             *
360             * <p>
361             * English (U.K.) returns <code>en_GB</code>
362             * </p>
363             *
364             * @return the current language's code
365             */
366            public String getLanguageId() {
367                    return _languageId;
368            }
369    
370            /**
371             * Returns the site's page.
372             *
373             * <p>
374             * Layout is Liferay's technical name for a page.
375             * </p>
376             *
377             * @return the site's page
378             */
379            public Layout getLayout() {
380                    return _layout;
381            }
382    
383            /**
384             * Returns the site's top-level pages.
385             *
386             * <p>
387             * Layout is Liferay's technical name for a page.
388             * </p>
389             *
390             * @return the site's top-level pages
391             */
392            public List<Layout> getLayouts() {
393                    return _layouts;
394            }
395    
396            /**
397             * Returns the current layout set, being either a public layout set or a
398             * private layout set.
399             *
400             * <p>
401             * A site can have public and private pages (layouts), which are contained
402             * in a public layout set and a private page set, respectively.
403             * </p>
404             *
405             * @return the current layout set, being either a public layout set or a
406             *         private layout set
407             */
408            public LayoutSet getLayoutSet() {
409                    return _layoutSet;
410            }
411    
412            /**
413             * Returns the path to the site's configured logo, or <code>null</code> if
414             * there is no configured logo.
415             *
416             * @return the path to the site's configured logo, or <code>null</code> if
417             *         there is no configured logo
418             */
419            public String getLayoutSetLogo() {
420                    return _layoutSetLogo;
421            }
422    
423            public LayoutTypePortlet getLayoutTypePortlet() {
424                    return _layoutTypePortlet;
425            }
426    
427            /**
428             * Returns the numeric portlet lifecycle indicator.
429             *
430             * <p>
431             * For example:
432             * </p>
433             *
434             * <p>
435             * <pre>
436             * <code>
437             * returns "0" for RENDER phase
438             * returns "1" for ACTION phase
439             * returns "2" for RESOURCE phase
440             * returns "3" for EVENT phase
441             * </code>
442             * </pre>
443             * </p>
444             *
445             * @return the numeric portlet lifecycle indicator
446             */
447            public String getLifecycle() {
448                    return _lifecycle;
449            }
450    
451            /**
452             * Returns the locale used for displaying content.
453             *
454             * @return the locale used for displaying content
455             */
456            public Locale getLocale() {
457                    return _locale;
458            }
459    
460            public MDRRuleGroupInstance getMDRRuleGroupInstance() {
461                    return _mdrRuleGroupInstance;
462            }
463    
464            public String getPathApplet() {
465                    return _pathApplet;
466            }
467    
468            public String getPathCms() {
469                    return _pathCms;
470            }
471    
472            /**
473             * Returns the base URL for the color scheme's images, which can be
474             * configured in the theme's <code>liferay-look-and-feel.xml</code>.
475             *
476             * @return the base URL for the color scheme's images
477             */
478            public String getPathColorSchemeImages() {
479                    return _pathColorSchemeImages;
480            }
481    
482            public String getPathContext() {
483                    return _pathContext;
484            }
485    
486            public String getPathFlash() {
487                    return _pathFlash;
488            }
489    
490            /**
491             * Returns the URL for the site's private layout set. This method typically
492             * returns <code>/group</code>.
493             *
494             * @return the URL for the site's private layout set
495             */
496            public String getPathFriendlyURLPrivateGroup() {
497                    return _pathFriendlyURLPrivateGroup;
498            }
499    
500            /**
501             * Returns the URL for the user's private page set. This method typically
502             * returns <code>/user</code>.
503             *
504             * @return the URL for the user's private page set
505             */
506            public String getPathFriendlyURLPrivateUser() {
507                    return _pathFriendlyURLPrivateUser;
508            }
509    
510            /**
511             * Returns the URL for the site's public page set. This method typically
512             * returns <code>/web</code>.
513             *
514             * @return the URL for the site's public page set
515             */
516            public String getPathFriendlyURLPublic() {
517                    return _pathFriendlyURLPublic;
518            }
519    
520            /**
521             * Returns the URL for the portal instance's images. This method typically
522             * returns <code>/image</code>.
523             *
524             * @return the URL for the portal instance's images
525             */
526            public String getPathImage() {
527                    return _pathImage;
528            }
529    
530            /**
531             * Returns the URL for the portal instance's JavaScript resources.
532             *
533             * @return the URL for the portal instance's JavaScript resources
534             */
535            public String getPathJavaScript() {
536                    return _pathJavaScript;
537            }
538    
539            /**
540             * Returns the URL for the portal instance's main servlet. This method
541             * typically returns <code>/c</code>.
542             *
543             * @return the URL for the portal instance's main servlet
544             */
545            public String getPathMain() {
546                    return _pathMain;
547            }
548    
549            public String getPathSound() {
550                    return _pathSound;
551            }
552    
553            /**
554             * Returns the URL for the theme's CSS directory.
555             *
556             * @return the URL for the theme's CSS directory
557             */
558            public String getPathThemeCss() {
559                    return _pathThemeCss;
560            }
561    
562            /**
563             * Returns the URL for the theme's images.
564             *
565             * @return the URL for the theme's images
566             */
567            public String getPathThemeImages() {
568                    return _pathThemeImages;
569            }
570    
571            /**
572             * Returns the URL for the theme's JavaScript directory.
573             *
574             * @return the URL for the theme's JavaScript directory
575             */
576            public String getPathThemeJavaScript() {
577                    return _pathThemeJavaScript;
578            }
579    
580            /**
581             * Returns the base URL for the theme.
582             *
583             * @return the base URL for the theme
584             */
585            public String getPathThemeRoot() {
586                    return _pathThemeRoot;
587            }
588    
589            /**
590             * Returns the URL for the theme's templates.
591             *
592             * @return the URL for the theme's templates
593             */
594            public String getPathThemeTemplates() {
595                    return _pathThemeTemplates;
596            }
597    
598            /**
599             * Returns the permission checker, which is used to ensure users making
600             * resource requests have the necessary access permissions.
601             *
602             * @return the permission checker
603             */
604            @JSON(include = false)
605            public PermissionChecker getPermissionChecker() {
606                    return _permissionChecker;
607            }
608    
609            /**
610             * Returns the primary key of the page.
611             *
612             * <p>
613             * Historically, "plid" was short for "portlet layout ID", which is the
614             * primary key (ID) of the current layout (page).
615             * </p>
616             *
617             * @return the primary key of the page
618             */
619            public long getPlid() {
620                    return _plid;
621            }
622    
623            /**
624             * Returns the portal instance's base URL, which can be configured by
625             * setting the <code>web.server.host</code> property in a
626             * <code>portal-ext.properties</code> file.
627             *
628             * @return the portal instance's base URL
629             */
630            public String getPortalURL() {
631                    return _portalURL;
632            }
633    
634            @JSON(include = false)
635            public PortletDisplay getPortletDisplay() {
636                    return _portletDisplay;
637            }
638    
639            public String getPpid() {
640                    return _ppid;
641            }
642    
643            public String getProtocol() {
644                    return HttpUtil.getProtocol(_secure);
645            }
646    
647            public String getRealCompanyLogo() {
648                    return _realCompanyLogo;
649            }
650    
651            public int getRealCompanyLogoHeight() {
652                    return _realCompanyLogoHeight;
653            }
654    
655            public int getRealCompanyLogoWidth() {
656                    return _realCompanyLogoWidth;
657            }
658    
659            /**
660             * Returns the logged in user. Since administrative users are able to
661             * impersonate other users, this method reveals the identity of the user who
662             * actually logged in.
663             *
664             * @return the logged in user
665             * @see    #getUser()
666             */
667            public User getRealUser() {
668                    return _realUser;
669            }
670    
671            /**
672             * Returns the ID of the logged in user.
673             *
674             * @return the ID of the logged in user
675             * @see    #getRealUser()
676             */
677            public long getRealUserId() {
678                    return _realUser.getUserId();
679            }
680    
681            public Group getRefererGroup() {
682                    return _refererGroup;
683            }
684    
685            public long getRefererGroupId() {
686                    return _refererGroupId;
687            }
688    
689            public long getRefererPlid() {
690                    return _refererPlid;
691            }
692    
693            /**
694             * Returns the currently served HTTP servlet request.
695             *
696             * @return the currently served HTTP servlet request
697             */
698            @JSON(include = false)
699            public HttpServletRequest getRequest() {
700                    return _request;
701            }
702    
703            /**
704             * Returns the currently served HTTP servlet response.
705             *
706             * @return the currently served HTTP servlet response
707             */
708            @JSON(include = false)
709            public HttpServletResponse getResponse() {
710                    return _response;
711            }
712    
713            /**
714             * Returns the scoped or sub-scoped active group (e.g. site).
715             *
716             * @return the scoped or sub-scoped active group
717             */
718            public Group getScopeGroup() {
719                    return _scopeGroup;
720            }
721    
722            /**
723             * Returns the ID of the scoped or sub-scoped active group (e.g. site).
724             *
725             * @return the ID of the scoped or sub-scoped active group
726             */
727            public long getScopeGroupId() {
728                    return _scopeGroupId;
729            }
730    
731            /**
732             * Returns the name of the scoped or sub-scoped active group (e.g. site).
733             *
734             * @return the name of the scoped or sub-scoped active group
735             */
736            public String getScopeGroupName() throws PortalException {
737                    if (_scopeGroup == null) {
738                            return StringPool.BLANK;
739                    }
740    
741                    return _scopeGroup.getDescriptiveName();
742            }
743    
744            public Layout getScopeLayout() throws PortalException {
745                    if (_layout.hasScopeGroup()) {
746                            return _layout;
747                    }
748                    else if (_scopeGroup.isLayout()) {
749                            return LayoutLocalServiceUtil.getLayout(_scopeGroup.getClassPK());
750                    }
751                    else {
752                            return null;
753                    }
754            }
755    
756            /**
757             * Returns the portal instance's server name, which can be configured by
758             * setting the <code>web.server.host</code> property in a
759             * <code>portal-ext.properties</code> file.
760             *
761             * @return the server name, which can be configured by setting the
762             *         <code>web.server.host</code> property in a
763             *         <code>portal-ext.properties</code> file
764             */
765            public String getServerName() {
766                    return _serverName;
767            }
768    
769            /**
770             * Returns the server port, which can be configured by setting the
771             * <code>web.server.http.port</code> or <code>web.server.https.port</code>
772             * property in a <code>portal-ext.properties</code> file.
773             *
774             * @return the server port, which can be configured by setting the
775             *         <code>web.server.http.port</code> or
776             *         <code>web.server.https.port</code> property in a
777             *         <code>portal-ext.properties</code> file
778             */
779            public int getServerPort() {
780                    return _serverPort;
781            }
782    
783            /**
784             * Returns the session ID, or a blank string if the session ID is not
785             * available to the application.
786             *
787             * @return the session ID, or returns a blank string if the session ID is
788             *         not available to the application
789             */
790            public String getSessionId() {
791                    return _sessionId;
792            }
793    
794            public Locale getSiteDefaultLocale() {
795                    return _siteDefaultLocale;
796            }
797    
798            public Group getSiteGroup() {
799                    return _siteGroup;
800            }
801    
802            public long getSiteGroupId() {
803                    return _siteGroupId;
804            }
805    
806            public long getSiteGroupIdOrLiveGroupId() {
807                    return StagingUtil.getLiveGroupId(_siteGroupId);
808            }
809    
810            public String getSiteGroupName() throws PortalException {
811                    if (_siteGroup == null) {
812                            return StringPool.BLANK;
813                    }
814    
815                    return _siteGroup.getDescriptiveName();
816            }
817    
818            public Theme getTheme() {
819                    return _theme;
820            }
821    
822            public String getThemeId() {
823                    return _theme.getThemeId();
824            }
825    
826            /**
827             * Returns the theme's configurable settings, which are declared in
828             * <code>liferay-look-and-feel.xml</code> and are configurable in the user
829             * interface.
830             *
831             * @param  key the theme's key
832             * @return the theme's configurable settings
833             */
834            public String getThemeSetting(String key) {
835                    Theme theme = getTheme();
836    
837                    String device = theme.getDevice();
838    
839                    Layout layout = getLayout();
840    
841                    return layout.getThemeSetting(key, device);
842            }
843    
844            /**
845             * Returns the theme's configurable settings, which are declared in
846             * <code>liferay-look-and-feel.xml</code> and are configurable in the user
847             * interface.
848             *
849             * @return a list of the theme's configurable settings
850             */
851            public Properties getThemeSettings() {
852                    Theme theme = getTheme();
853    
854                    Properties properties = new Properties();
855    
856                    Map<String, ThemeSetting> themeSettings = theme.getSettings();
857    
858                    for (String key : themeSettings.keySet()) {
859                            ThemeSetting themeSetting = themeSettings.get(key);
860    
861                            String value = null;
862    
863                            if (themeSetting.isConfigurable()) {
864                                    value = getThemeSetting(key);
865                            }
866                            else {
867                                    value = themeSetting.getValue();
868                            }
869    
870                            if (value != null) {
871                                    properties.put(key, value);
872                            }
873                    }
874    
875                    return properties;
876            }
877    
878            public String getTilesContent() {
879                    return _tilesContent;
880            }
881    
882            public String getTilesTitle() {
883                    return _tilesTitle;
884            }
885    
886            public TimeZone getTimeZone() {
887                    return _timeZone;
888            }
889    
890            public List<Layout> getUnfilteredLayouts() {
891                    return _unfilteredLayouts;
892            }
893    
894            /**
895             * @deprecated As of 7.0.0, with no direct replacement
896             */
897            @Deprecated
898            public String getURLAddContent() {
899                    return StringPool.BLANK;
900            }
901    
902            public String getURLControlPanel() {
903                    return _urlControlPanel;
904            }
905    
906            public String getURLCurrent() {
907                    return _urlCurrent;
908            }
909    
910            public String getURLHome() {
911                    return _urlHome;
912            }
913    
914            /**
915             * @deprecated As of 7.0.0, with no direct replacement
916             */
917            @Deprecated
918            public String getURLLayoutTemplates() {
919                    if (Validator.isNull(_urlLayoutTemplates)) {
920                            return getURLPageSettings() + "#layout";
921                    }
922    
923                    return _urlLayoutTemplates;
924            }
925    
926            @JSON(include = false)
927            public PortletURL getURLMyAccount() {
928                    if (_urlMyAccount == null) {
929                            String portletId = PortletProviderUtil.getPortletId(
930                                    PortalMyAccountApplicationType.MyAccount.CLASS_NAME,
931                                    PortletProvider.Action.VIEW);
932    
933                            _urlMyAccount = PortalUtil.getControlPanelPortletURL(
934                                    getRequest(), portletId, PortletRequest.RENDER_PHASE);
935                    }
936    
937                    return _urlMyAccount;
938            }
939    
940            /**
941             * @deprecated As of 7.0.0, with no direct replacement
942             */
943            @Deprecated
944            @JSON(include = false)
945            public PortletURL getURLPageSettings() {
946                    if (_urlPageSettings == null) {
947                            String portletId = PortletProviderUtil.getPortletId(
948                                    Layout.class.getName(), PortletProvider.Action.EDIT);
949    
950                            _urlPageSettings = PortalUtil.getControlPanelPortletURL(
951                                    getRequest(), portletId, PortletRequest.RENDER_PHASE);
952                    }
953    
954                    return _urlPageSettings;
955            }
956    
957            public String getURLPortal() {
958                    return _urlPortal;
959            }
960    
961            @JSON(include = false)
962            public PortletURL getURLPublishToLive() {
963                    return _urlPublishToLive;
964            }
965    
966            public String getURLSignIn() {
967                    return _urlSignIn;
968            }
969    
970            public String getURLSignOut() {
971                    return _urlSignOut;
972            }
973    
974            @JSON(include = false)
975            public PortletURL getURLUpdateManager() {
976                    if (_urlUpdateManager == null) {
977                            _urlUpdateManager = PortalUtil.getControlPanelPortletURL(
978                                    getRequest(), PortletKeys.MARKETPLACE_STORE,
979                                    PortletRequest.RENDER_PHASE);
980                    }
981    
982                    return _urlUpdateManager;
983            }
984    
985            /**
986             * The user for which the current request is being handled. Note, that an
987             * administrative user can impersonate another user.
988             *
989             * @return the user for which the current request is being handled
990             * @see    #getRealUser()
991             */
992            public User getUser() {
993                    return _user;
994            }
995    
996            /**
997             * Returns the ID of the user for which the current request is being
998             * handled. Note that an administrative user can impersonate another user.
999             *
1000             * @return the ID of the user for which the current request is being handled
1001             */
1002            public long getUserId() {
1003                    return _user.getUserId();
1004            }
1005    
1006            public boolean isAddSessionIdToURL() {
1007                    return _addSessionIdToURL;
1008            }
1009    
1010            public boolean isAjax() {
1011                    return _ajax;
1012            }
1013    
1014            public boolean isFacebook() {
1015                    return _facebook;
1016            }
1017    
1018            public boolean isFreeformLayout() {
1019                    return _freeformLayout;
1020            }
1021    
1022            public boolean isI18n() {
1023                    return _i18n;
1024            }
1025    
1026            /**
1027             * Returns <code>true</code> if the user is being impersonated by an
1028             * administrative user.
1029             *
1030             * @return <code>true</code> if the user is being impersonated by an
1031             *         administrative user; <code>false</code> otherwise
1032             * @see    #getRealUser()
1033             * @see    #getUser()
1034             */
1035            public boolean isImpersonated() {
1036                    if (getUserId() == getRealUserId()) {
1037                            return false;
1038                    }
1039    
1040                    return true;
1041            }
1042    
1043            public boolean isIncludedJs(String js) {
1044                    String path = getPathJavaScript();
1045    
1046                    if (isIncludePortletCssJs() &&
1047                            js.startsWith(path + "/liferay/portlet_css.js")) {
1048    
1049                            return true;
1050                    }
1051    
1052                    return false;
1053            }
1054    
1055            public boolean isIncludePortletCssJs() {
1056                    return _includePortletCssJs;
1057            }
1058    
1059            public boolean isIsolated() {
1060                    return _isolated;
1061            }
1062    
1063            public boolean isLifecycleAction() {
1064                    return _lifecycleAction;
1065            }
1066    
1067            public boolean isLifecycleEvent() {
1068                    return _lifecycleEvent;
1069            }
1070    
1071            public boolean isLifecycleRender() {
1072                    return _lifecycleRender;
1073            }
1074    
1075            public boolean isLifecycleResource() {
1076                    return _lifecycleResource;
1077            }
1078    
1079            public boolean isSecure() {
1080                    return _secure;
1081            }
1082    
1083            /**
1084             * @deprecated As of 7.0.0, with no direct replacement
1085             */
1086            @Deprecated
1087            public boolean isShowAddContentIcon() {
1088                    return false;
1089            }
1090    
1091            /**
1092             * @deprecated As of 7.0.0, with no direct replacement
1093             */
1094            @Deprecated
1095            public boolean isShowAddContentIconPermission() {
1096                    return false;
1097            }
1098    
1099            public boolean isShowControlPanelIcon() {
1100                    return _showControlPanelIcon;
1101            }
1102    
1103            public boolean isShowHomeIcon() {
1104                    return _showHomeIcon;
1105            }
1106    
1107            public boolean isShowLayoutTemplatesIcon() {
1108                    return _showLayoutTemplatesIcon;
1109            }
1110    
1111            /**
1112             * @deprecated As of 6.2.0, replaced by {@link
1113             *             #isShowSiteAdministrationIcon()}
1114             */
1115            @Deprecated
1116            public boolean isShowManageSiteMembershipsIcon() {
1117                    return _showManageSiteMembershipsIcon;
1118            }
1119    
1120            public boolean isShowMyAccountIcon() {
1121                    return _showMyAccountIcon;
1122            }
1123    
1124            public boolean isShowPageCustomizationIcon() {
1125                    return _showPageCustomizationIcon;
1126            }
1127    
1128            public boolean isShowPageSettingsIcon() {
1129                    return _showPageSettingsIcon;
1130            }
1131    
1132            public boolean isShowPortalIcon() {
1133                    return _showPortalIcon;
1134            }
1135    
1136            public boolean isShowSignInIcon() {
1137                    return _showSignInIcon;
1138            }
1139    
1140            public boolean isShowSignOutIcon() {
1141                    return _showSignOutIcon;
1142            }
1143    
1144            public boolean isShowSiteAdministrationIcon() {
1145                    return _showSiteAdministrationIcon;
1146            }
1147    
1148            /**
1149             * @deprecated As of 6.2.0, replaced by {@link
1150             *             #isShowSiteAdministrationIcon()}
1151             */
1152            @Deprecated
1153            public boolean isShowSiteContentIcon() {
1154                    return isShowSiteAdministrationIcon();
1155            }
1156    
1157            /**
1158             * @deprecated As of 6.2.0, replaced by {@link
1159             *             #isShowSiteAdministrationIcon()}
1160             */
1161            @Deprecated
1162            public boolean isShowSiteMapSettingsIcon() {
1163                    return _showSiteMapSettingsIcon;
1164            }
1165    
1166            /**
1167             * @deprecated As of 6.2.0, replaced by {@link
1168             *             #isShowSiteAdministrationIcon()}
1169             */
1170            @Deprecated
1171            public boolean isShowSiteSettingsIcon() {
1172                    return _showSiteSettingsIcon;
1173            }
1174    
1175            public boolean isShowStagingIcon() {
1176                    return _showStagingIcon;
1177            }
1178    
1179            public boolean isSignedIn() {
1180                    return _signedIn;
1181            }
1182    
1183            public boolean isStateExclusive() {
1184                    return _stateExclusive;
1185            }
1186    
1187            public boolean isStateMaximized() {
1188                    return _stateMaximized;
1189            }
1190    
1191            public boolean isStatePopUp() {
1192                    return _statePopUp;
1193            }
1194    
1195            public boolean isThemeCssFastLoad() {
1196                    return _themeCssFastLoad;
1197            }
1198    
1199            public boolean isThemeImagesFastLoad() {
1200                    return _themeImagesFastLoad;
1201            }
1202    
1203            public boolean isThemeJsBarebone() {
1204                    return _themeJsBarebone;
1205            }
1206    
1207            public boolean isThemeJsFastLoad() {
1208                    return _themeJsFastLoad;
1209            }
1210    
1211            public boolean isTilesSelectable() {
1212                    return _tilesSelectable;
1213            }
1214    
1215            public boolean isWapTheme() {
1216                    return _theme.isWapTheme();
1217            }
1218    
1219            public boolean isWidget() {
1220                    return _widget;
1221            }
1222    
1223            @Override
1224            public ThemeDisplay merge(ThemeDisplay themeDisplay) {
1225                    if ((themeDisplay == null) || (themeDisplay == this)) {
1226                            return this;
1227                    }
1228    
1229                    _includePortletCssJs = themeDisplay._includePortletCssJs;
1230    
1231                    return this;
1232            }
1233    
1234            public void setAccount(Account account) {
1235                    _account = account;
1236            }
1237    
1238            public void setAddSessionIdToURL(boolean addSessionIdToURL) {
1239                    _addSessionIdToURL = addSessionIdToURL;
1240            }
1241    
1242            public void setAjax(boolean ajax) {
1243                    _ajax = ajax;
1244            }
1245    
1246            public void setCDNBaseURL(String cdnBase) {
1247                    _cdnBaseURL = cdnBase;
1248            }
1249    
1250            public void setCDNDynamicResourcesHost(String cdnDynamicResourcesHost) {
1251                    _cdnDynamicResourcesHost = cdnDynamicResourcesHost;
1252            }
1253    
1254            public void setCDNHost(String cdnHost) {
1255                    _cdnHost = cdnHost;
1256            }
1257    
1258            public void setCompany(Company company) throws PortalException {
1259                    _company = company;
1260                    _companyGroupId = company.getGroupId();
1261    
1262                    setAccount(company.getAccount());
1263            }
1264    
1265            public void setCompanyLogo(String companyLogo) {
1266                    _companyLogo = companyLogo;
1267            }
1268    
1269            public void setCompanyLogoHeight(int companyLogoHeight) {
1270                    _companyLogoHeight = companyLogoHeight;
1271            }
1272    
1273            public void setCompanyLogoWidth(int companyLogoWidth) {
1274                    _companyLogoWidth = companyLogoWidth;
1275            }
1276    
1277            public void setContact(Contact contact) {
1278                    _contact = contact;
1279            }
1280    
1281            public void setDevice(Device device) {
1282                    _device = device;
1283            }
1284    
1285            public void setDoAsGroupId(long doAsGroupId) {
1286                    _doAsGroupId = doAsGroupId;
1287            }
1288    
1289            public void setDoAsUserId(String doAsUserId) {
1290                    _doAsUserId = doAsUserId;
1291            }
1292    
1293            public void setDoAsUserLanguageId(String doAsUserLanguageId) {
1294                    _doAsUserLanguageId = doAsUserLanguageId;
1295            }
1296    
1297            public void setFacebookCanvasPageURL(String facebookCanvasPageURL) {
1298                    _facebookCanvasPageURL = facebookCanvasPageURL;
1299    
1300                    if (Validator.isNotNull(facebookCanvasPageURL)) {
1301                            _facebook = true;
1302                    }
1303            }
1304    
1305            public void setFreeformLayout(boolean freeformLayout) {
1306                    _freeformLayout = freeformLayout;
1307            }
1308    
1309            public void setI18nLanguageId(String i18nLanguageId) {
1310                    _i18nLanguageId = i18nLanguageId;
1311    
1312                    if (Validator.isNotNull(i18nLanguageId)) {
1313                            _i18n = true;
1314                    }
1315                    else {
1316                            _i18n = false;
1317                    }
1318            }
1319    
1320            public void setI18nPath(String i18nPath) {
1321                    _i18nPath = i18nPath;
1322    
1323                    if (Validator.isNotNull(i18nPath)) {
1324                            _i18n = true;
1325                    }
1326                    else {
1327                            _i18n = false;
1328                    }
1329            }
1330    
1331            public void setIncludePortletCssJs(boolean includePortletCssJs) {
1332                    _includePortletCssJs = includePortletCssJs;
1333            }
1334    
1335            public void setIsolated(boolean isolated) {
1336                    _isolated = isolated;
1337            }
1338    
1339            public void setLanguageId(String languageId) {
1340                    _languageId = languageId;
1341            }
1342    
1343            public void setLayout(Layout layout) {
1344                    _layout = layout;
1345            }
1346    
1347            public void setLayouts(List<Layout> layouts) {
1348                    _layouts = layouts;
1349            }
1350    
1351            public void setLayoutSet(LayoutSet layoutSet) {
1352                    _layoutSet = layoutSet;
1353            }
1354    
1355            public void setLayoutSetLogo(String layoutSetLogo) {
1356                    _layoutSetLogo = layoutSetLogo;
1357            }
1358    
1359            public void setLayoutTypePortlet(LayoutTypePortlet layoutTypePortlet) {
1360                    _layoutTypePortlet = layoutTypePortlet;
1361            }
1362    
1363            public void setLifecycle(String lifecycle) {
1364                    _lifecycle = lifecycle;
1365            }
1366    
1367            public void setLifecycleAction(boolean lifecycleAction) {
1368                    _lifecycleAction = lifecycleAction;
1369            }
1370    
1371            public void setLifecycleEvent(boolean lifecycleEvent) {
1372                    _lifecycleEvent = lifecycleEvent;
1373            }
1374    
1375            public void setLifecycleRender(boolean lifecycleRender) {
1376                    _lifecycleRender = lifecycleRender;
1377            }
1378    
1379            public void setLifecycleResource(boolean lifecycleResource) {
1380                    _lifecycleResource = lifecycleResource;
1381            }
1382    
1383            public void setLocale(Locale locale) {
1384                    _locale = locale;
1385    
1386                    LocaleThreadLocal.setThemeDisplayLocale(locale);
1387            }
1388    
1389            public void setLookAndFeel(Theme theme, ColorScheme colorScheme) {
1390                    _theme = theme;
1391                    _colorScheme = colorScheme;
1392    
1393                    if ((theme == null) || (colorScheme == null)) {
1394                            return;
1395                    }
1396    
1397                    String themeStaticResourcePath = theme.getStaticResourcePath();
1398    
1399                    String cdnBaseURL = getCDNBaseURL();
1400    
1401                    setPathColorSchemeImages(
1402                            cdnBaseURL + themeStaticResourcePath +
1403                                    colorScheme.getColorSchemeImagesPath());
1404    
1405                    String dynamicResourcesHost = getCDNDynamicResourcesHost();
1406    
1407                    if (Validator.isNull(dynamicResourcesHost)) {
1408                            String portalURL = getPortalURL();
1409    
1410                            try {
1411                                    portalURL = PortalUtil.getPortalURL(getLayout(), this);
1412                            }
1413                            catch (Exception e) {
1414                                    _log.error(e, e);
1415                            }
1416    
1417                            dynamicResourcesHost = portalURL;
1418                    }
1419    
1420                    setPathThemeCss(
1421                            dynamicResourcesHost + themeStaticResourcePath +
1422                                    theme.getCssPath());
1423    
1424                    setPathThemeImages(
1425                            cdnBaseURL + themeStaticResourcePath + theme.getImagesPath());
1426                    setPathThemeJavaScript(
1427                            cdnBaseURL + themeStaticResourcePath + theme.getJavaScriptPath());
1428    
1429                    String rootPath = theme.getRootPath();
1430    
1431                    if (rootPath.equals(StringPool.SLASH)) {
1432                            setPathThemeRoot(themeStaticResourcePath);
1433                    }
1434                    else {
1435                            setPathThemeRoot(themeStaticResourcePath + rootPath);
1436                    }
1437    
1438                    setPathThemeTemplates(
1439                            cdnBaseURL + themeStaticResourcePath + theme.getTemplatesPath());
1440            }
1441    
1442            public void setMDRRuleGroupInstance(
1443                    MDRRuleGroupInstance mdrRuleGroupInstance) {
1444    
1445                    _mdrRuleGroupInstance = mdrRuleGroupInstance;
1446            }
1447    
1448            public void setPathApplet(String pathApplet) {
1449                    _pathApplet = pathApplet;
1450            }
1451    
1452            public void setPathCms(String pathCms) {
1453                    _pathCms = pathCms;
1454            }
1455    
1456            public void setPathColorSchemeImages(String pathColorSchemeImages) {
1457                    _pathColorSchemeImages = pathColorSchemeImages;
1458            }
1459    
1460            public void setPathContext(String pathContext) {
1461                    _pathContext = pathContext;
1462            }
1463    
1464            public void setPathFlash(String pathFlash) {
1465                    _pathFlash = pathFlash;
1466            }
1467    
1468            public void setPathFriendlyURLPrivateGroup(
1469                    String pathFriendlyURLPrivateGroup) {
1470    
1471                    _pathFriendlyURLPrivateGroup = pathFriendlyURLPrivateGroup;
1472            }
1473    
1474            public void setPathFriendlyURLPrivateUser(
1475                    String pathFriendlyURLPrivateUser) {
1476    
1477                    _pathFriendlyURLPrivateUser = pathFriendlyURLPrivateUser;
1478            }
1479    
1480            public void setPathFriendlyURLPublic(String pathFriendlyURLPublic) {
1481                    _pathFriendlyURLPublic = pathFriendlyURLPublic;
1482            }
1483    
1484            public void setPathImage(String pathImage) {
1485                    if (isFacebook() && !pathImage.startsWith(Http.HTTP_WITH_SLASH) &&
1486                            !pathImage.startsWith(Http.HTTPS_WITH_SLASH)) {
1487    
1488                            pathImage = getPortalURL() + pathImage;
1489                    }
1490    
1491                    _pathImage = pathImage;
1492            }
1493    
1494            public void setPathJavaScript(String pathJavaScript) {
1495                    _pathJavaScript = pathJavaScript;
1496            }
1497    
1498            public void setPathMain(String pathMain) {
1499                    _pathMain = pathMain;
1500            }
1501    
1502            public void setPathSound(String pathSound) {
1503                    _pathSound = pathSound;
1504            }
1505    
1506            public void setPathThemeCss(String pathThemeCss) {
1507                    _pathThemeCss = pathThemeCss;
1508            }
1509    
1510            public void setPathThemeImages(String pathThemeImages) {
1511                    _pathThemeImages = pathThemeImages;
1512            }
1513    
1514            public void setPathThemeJavaScript(String pathThemeJavaScript) {
1515                    _pathThemeJavaScript = pathThemeJavaScript;
1516            }
1517    
1518            public void setPathThemeRoot(String pathThemeRoot) {
1519                    _pathThemeRoot = pathThemeRoot;
1520            }
1521    
1522            public void setPathThemeTemplates(String pathThemeTemplates) {
1523                    _pathThemeTemplates = pathThemeTemplates;
1524            }
1525    
1526            public void setPermissionChecker(PermissionChecker permissionChecker) {
1527                    _permissionChecker = permissionChecker;
1528            }
1529    
1530            public void setPlid(long plid) {
1531                    _plid = plid;
1532            }
1533    
1534            public void setPortalURL(String portalURL) {
1535                    _portalURL = portalURL;
1536            }
1537    
1538            public void setPpid(String ppid) {
1539                    _ppid = ppid;
1540            }
1541    
1542            public void setRealCompanyLogo(String realCompanyLogo) {
1543                    _realCompanyLogo = realCompanyLogo;
1544            }
1545    
1546            public void setRealCompanyLogoHeight(int realCompanyLogoHeight) {
1547                    _realCompanyLogoHeight = realCompanyLogoHeight;
1548            }
1549    
1550            public void setRealCompanyLogoWidth(int realCompanyLogoWidth) {
1551                    _realCompanyLogoWidth = realCompanyLogoWidth;
1552            }
1553    
1554            public void setRealUser(User realUser) {
1555                    _realUser = realUser;
1556            }
1557    
1558            public void setRefererGroupId(long refererGroupId) {
1559                    _refererGroupId = refererGroupId;
1560    
1561                    if (_refererGroupId > 0) {
1562                            try {
1563                                    _refererGroup = GroupLocalServiceUtil.getGroup(_refererGroupId);
1564                            }
1565                            catch (Exception e) {
1566                                    _log.error(e, e);
1567                            }
1568                    }
1569            }
1570    
1571            public void setRefererPlid(long refererPlid) {
1572                    _refererPlid = refererPlid;
1573            }
1574    
1575            public void setRequest(HttpServletRequest request) {
1576                    _request = request;
1577            }
1578    
1579            public void setResponse(HttpServletResponse response) {
1580                    _response = response;
1581            }
1582    
1583            public void setScopeGroupId(long scopeGroupId) {
1584                    _scopeGroupId = scopeGroupId;
1585    
1586                    if (_scopeGroupId > 0) {
1587                            try {
1588                                    _scopeGroup = GroupLocalServiceUtil.getGroup(_scopeGroupId);
1589                            }
1590                            catch (Exception e) {
1591                                    _log.error(e, e);
1592                            }
1593                    }
1594            }
1595    
1596            public void setSecure(boolean secure) {
1597                    _secure = secure;
1598            }
1599    
1600            public void setServerName(String serverName) {
1601                    _serverName = serverName;
1602            }
1603    
1604            public void setServerPort(int serverPort) {
1605                    _serverPort = serverPort;
1606            }
1607    
1608            public void setSessionId(String sessionId) {
1609                    _sessionId = sessionId;
1610            }
1611    
1612            /**
1613             * @deprecated As of 7.0.0, with no direct replacement
1614             */
1615            @Deprecated
1616            public void setShowAddContentIcon(boolean showAddContentIcon) {
1617            }
1618    
1619            /**
1620             * @deprecated As of 7.0.0, with no direct replacement
1621             */
1622            @Deprecated
1623            public void setShowAddContentIconPermission(
1624                    boolean showAddContentIconPermission) {
1625            }
1626    
1627            public void setShowControlPanelIcon(boolean showControlPanelIcon) {
1628                    _showControlPanelIcon = showControlPanelIcon;
1629            }
1630    
1631            public void setShowHomeIcon(boolean showHomeIcon) {
1632                    _showHomeIcon = showHomeIcon;
1633            }
1634    
1635            public void setShowLayoutTemplatesIcon(boolean showLayoutTemplatesIcon) {
1636                    _showLayoutTemplatesIcon = showLayoutTemplatesIcon;
1637            }
1638    
1639            public void setShowManageSiteMembershipsIcon(
1640                    boolean showManageSiteMembershipsIcon) {
1641    
1642                    _showManageSiteMembershipsIcon = showManageSiteMembershipsIcon;
1643            }
1644    
1645            public void setShowMyAccountIcon(boolean showMyAccountIcon) {
1646                    _showMyAccountIcon = showMyAccountIcon;
1647            }
1648    
1649            public void setShowPageCustomizationIcon(
1650                    boolean showPageCustomizationIcon) {
1651    
1652                    _showPageCustomizationIcon = showPageCustomizationIcon;
1653            }
1654    
1655            public void setShowPageSettingsIcon(boolean showPageSettingsIcon) {
1656                    _showPageSettingsIcon = showPageSettingsIcon;
1657            }
1658    
1659            public void setShowPortalIcon(boolean showPortalIcon) {
1660                    _showPortalIcon = showPortalIcon;
1661            }
1662    
1663            public void setShowSignInIcon(boolean showSignInIcon) {
1664                    _showSignInIcon = showSignInIcon;
1665            }
1666    
1667            public void setShowSignOutIcon(boolean showSignOutIcon) {
1668                    _showSignOutIcon = showSignOutIcon;
1669            }
1670    
1671            public void setShowSiteAdministrationIcon(
1672                    boolean showSiteAdministrationIcon) {
1673    
1674                    _showSiteAdministrationIcon = showSiteAdministrationIcon;
1675            }
1676    
1677            public void setShowSiteMapSettingsIcon(boolean showSiteMapSettingsIcon) {
1678                    _showSiteMapSettingsIcon = showSiteMapSettingsIcon;
1679            }
1680    
1681            public void setShowSiteSettingsIcon(boolean showSiteSettingsIcon) {
1682                    _showSiteSettingsIcon = showSiteSettingsIcon;
1683            }
1684    
1685            public void setShowStagingIcon(boolean showStagingIcon) {
1686                    _showStagingIcon = showStagingIcon;
1687            }
1688    
1689            public void setSignedIn(boolean signedIn) {
1690                    _signedIn = signedIn;
1691            }
1692    
1693            public void setSiteDefaultLocale(Locale siteDefaultLocale) {
1694                    _siteDefaultLocale = siteDefaultLocale;
1695    
1696                    LocaleThreadLocal.setSiteDefaultLocale(siteDefaultLocale);
1697            }
1698    
1699            public void setSiteGroupId(long siteGroupId) {
1700                    _siteGroupId = siteGroupId;
1701    
1702                    if (_siteGroupId > 0) {
1703                            try {
1704                                    _siteGroup = GroupLocalServiceUtil.getGroup(_siteGroupId);
1705                            }
1706                            catch (Exception e) {
1707                                    _log.error(e, e);
1708                            }
1709                    }
1710            }
1711    
1712            public void setStateExclusive(boolean stateExclusive) {
1713                    _stateExclusive = stateExclusive;
1714            }
1715    
1716            public void setStateMaximized(boolean stateMaximized) {
1717                    _stateMaximized = stateMaximized;
1718            }
1719    
1720            public void setStatePopUp(boolean statePopUp) {
1721                    _statePopUp = statePopUp;
1722            }
1723    
1724            public void setThemeCssFastLoad(boolean themeCssFastLoad) {
1725                    _themeCssFastLoad = themeCssFastLoad;
1726            }
1727    
1728            public void setThemeImagesFastLoad(boolean themeImagesFastLoad) {
1729                    _themeImagesFastLoad = themeImagesFastLoad;
1730            }
1731    
1732            public void setThemeJsBarebone(boolean themeJsBarebone) {
1733                    _themeJsBarebone = themeJsBarebone;
1734            }
1735    
1736            public void setThemeJsFastLoad(boolean themeJsFastLoad) {
1737                    _themeJsFastLoad = themeJsFastLoad;
1738            }
1739    
1740            public void setTilesContent(String tilesContent) {
1741                    _tilesContent = tilesContent;
1742            }
1743    
1744            public void setTilesSelectable(boolean tilesSelectable) {
1745                    _tilesSelectable = tilesSelectable;
1746            }
1747    
1748            public void setTilesTitle(String tilesTitle) {
1749                    _tilesTitle = tilesTitle;
1750            }
1751    
1752            public void setTimeZone(TimeZone timeZone) {
1753                    _timeZone = timeZone;
1754    
1755                    TimeZoneThreadLocal.setThemeDisplayTimeZone(timeZone);
1756            }
1757    
1758            public void setUnfilteredLayouts(List<Layout> unfilteredLayouts) {
1759                    _unfilteredLayouts = unfilteredLayouts;
1760            }
1761    
1762            /**
1763             * @deprecated As of 7.0.0, with no direct replacement
1764             */
1765            @Deprecated
1766            public void setURLAddContent(String urlAddContent) {
1767            }
1768    
1769            public void setURLControlPanel(String urlControlPanel) {
1770                    _urlControlPanel = urlControlPanel;
1771            }
1772    
1773            public void setURLCurrent(String urlCurrent) {
1774                    _urlCurrent = urlCurrent;
1775            }
1776    
1777            public void setURLHome(String urlHome) {
1778                    _urlHome = urlHome;
1779            }
1780    
1781            public void setURLLayoutTemplates(String urlLayoutTemplates) {
1782                    _urlLayoutTemplates = urlLayoutTemplates;
1783            }
1784    
1785            /**
1786             * @deprecated As of 7.0.0, with no direct replacement
1787             */
1788            @Deprecated
1789            public void setURLMyAccount(PortletURL urlMyAccount) {
1790                    _urlMyAccount = urlMyAccount;
1791            }
1792    
1793            /**
1794             * @deprecated As of 7.0.0, with no direct replacement
1795             */
1796            @Deprecated
1797            public void setURLPageSettings(PortletURL urlPageSettings) {
1798                    _urlPageSettings = urlPageSettings;
1799            }
1800    
1801            public void setURLPortal(String urlPortal) {
1802                    _urlPortal = urlPortal;
1803            }
1804    
1805            public void setURLPublishToLive(PortletURL urlPublishToLive) {
1806                    _urlPublishToLive = urlPublishToLive;
1807            }
1808    
1809            public void setURLSignIn(String urlSignIn) {
1810                    _urlSignIn = urlSignIn;
1811            }
1812    
1813            public void setURLSignOut(String urlSignOut) {
1814                    _urlSignOut = urlSignOut;
1815            }
1816    
1817            /**
1818             * @deprecated As of 7.0.0, with no direct replacement
1819             */
1820            @Deprecated
1821            public void setURLUpdateManager(PortletURL urlUpdateManager) {
1822                    _urlUpdateManager = urlUpdateManager;
1823            }
1824    
1825            public void setUser(User user) throws PortalException {
1826                    _user = user;
1827    
1828                    setContact(user.getContact());
1829            }
1830    
1831            public void setWidget(boolean widget) {
1832                    _widget = widget;
1833            }
1834    
1835            public String translate(String key) {
1836                    return LanguageUtil.get(getLocale(), key);
1837            }
1838    
1839            public String translate(String pattern, Object... arguments) {
1840                    return LanguageUtil.format(getLocale(), pattern, arguments);
1841            }
1842    
1843            private static final Log _log = LogFactoryUtil.getLog(ThemeDisplay.class);
1844    
1845            private Account _account;
1846            private boolean _addSessionIdToURL;
1847            private boolean _ajax;
1848            private String _cdnBaseURL;
1849            private String _cdnDynamicResourcesHost = StringPool.BLANK;
1850            private String _cdnHost = StringPool.BLANK;
1851            private ColorScheme _colorScheme;
1852            private Company _company;
1853            private long _companyGroupId;
1854            private String _companyLogo = StringPool.BLANK;
1855            private int _companyLogoHeight;
1856            private int _companyLogoWidth;
1857            private Contact _contact;
1858            private User _defaultUser;
1859            private Device _device;
1860            private long _doAsGroupId = 0;
1861            private String _doAsUserId = StringPool.BLANK;
1862            private String _doAsUserLanguageId = StringPool.BLANK;
1863            private boolean _facebook;
1864            private String _facebookCanvasPageURL;
1865            private boolean _freeformLayout;
1866            private boolean _i18n;
1867            private String _i18nLanguageId;
1868            private String _i18nPath;
1869            private boolean _includePortletCssJs;
1870            private boolean _isolated;
1871            private String _languageId;
1872            private Layout _layout;
1873            private List<Layout> _layouts;
1874            private LayoutSet _layoutSet;
1875            private String _layoutSetLogo = StringPool.BLANK;
1876            private LayoutTypePortlet _layoutTypePortlet;
1877            private String _lifecycle;
1878            private boolean _lifecycleAction;
1879            private boolean _lifecycleEvent;
1880            private boolean _lifecycleRender;
1881            private boolean _lifecycleResource;
1882            private Locale _locale;
1883            private MDRRuleGroupInstance _mdrRuleGroupInstance;
1884            private String _pathApplet = StringPool.BLANK;
1885            private String _pathCms = StringPool.BLANK;
1886            private String _pathColorSchemeImages = StringPool.BLANK;
1887            private String _pathContext = StringPool.BLANK;
1888            private String _pathFlash = StringPool.BLANK;
1889            private String _pathFriendlyURLPrivateGroup = StringPool.BLANK;
1890            private String _pathFriendlyURLPrivateUser = StringPool.BLANK;
1891            private String _pathFriendlyURLPublic = StringPool.BLANK;
1892            private String _pathImage = StringPool.BLANK;
1893            private String _pathJavaScript = StringPool.BLANK;
1894            private String _pathMain = StringPool.BLANK;
1895            private String _pathSound = StringPool.BLANK;
1896            private String _pathThemeCss = StringPool.BLANK;
1897            private String _pathThemeImages = StringPool.BLANK;
1898            private String _pathThemeJavaScript = StringPool.BLANK;
1899            private String _pathThemeRoot = StringPool.BLANK;
1900            private String _pathThemeTemplates = StringPool.BLANK;
1901            private transient PermissionChecker _permissionChecker;
1902            private long _plid;
1903            private String _portalURL = StringPool.BLANK;
1904            private PortletDisplay _portletDisplay = new PortletDisplay();
1905            private String _ppid = StringPool.BLANK;
1906            private String _realCompanyLogo = StringPool.BLANK;
1907            private int _realCompanyLogoHeight;
1908            private int _realCompanyLogoWidth;
1909            private User _realUser;
1910            private Group _refererGroup;
1911            private long _refererGroupId;
1912            private long _refererPlid;
1913            private transient HttpServletRequest _request;
1914            private transient HttpServletResponse _response;
1915            private Group _scopeGroup;
1916            private long _scopeGroupId;
1917            private boolean _secure;
1918            private String _serverName;
1919            private int _serverPort;
1920            private String _sessionId = StringPool.BLANK;
1921            private boolean _showControlPanelIcon;
1922            private boolean _showHomeIcon;
1923            private boolean _showLayoutTemplatesIcon;
1924            private boolean _showManageSiteMembershipsIcon;
1925            private boolean _showMyAccountIcon;
1926            private boolean _showPageCustomizationIcon;
1927            private boolean _showPageSettingsIcon;
1928            private boolean _showPortalIcon;
1929            private boolean _showSignInIcon;
1930            private boolean _showSignOutIcon;
1931            private boolean _showSiteAdministrationIcon;
1932            private boolean _showSiteMapSettingsIcon;
1933            private boolean _showSiteSettingsIcon;
1934            private boolean _showStagingIcon;
1935            private boolean _signedIn;
1936            private Locale _siteDefaultLocale;
1937            private Group _siteGroup;
1938            private long _siteGroupId;
1939            private boolean _stateExclusive;
1940            private boolean _stateMaximized;
1941            private boolean _statePopUp;
1942            private Theme _theme;
1943            private boolean _themeCssFastLoad;
1944            private boolean _themeImagesFastLoad;
1945            private boolean _themeJsBarebone;
1946            private boolean _themeJsFastLoad;
1947            private String _tilesContent = StringPool.BLANK;
1948            private boolean _tilesSelectable;
1949            private String _tilesTitle = StringPool.BLANK;
1950            private TimeZone _timeZone;
1951            private List<Layout> _unfilteredLayouts;
1952            private String _urlControlPanel = StringPool.BLANK;
1953            private String _urlCurrent = StringPool.BLANK;
1954            private String _urlHome = StringPool.BLANK;
1955            private String _urlLayoutTemplates = StringPool.BLANK;
1956            private transient PortletURL _urlMyAccount = null;
1957            private transient PortletURL _urlPageSettings = null;
1958            private String _urlPortal = StringPool.BLANK;
1959            private transient PortletURL _urlPublishToLive = null;
1960            private String _urlSignIn = StringPool.BLANK;
1961            private String _urlSignOut = StringPool.BLANK;
1962            private transient PortletURL _urlUpdateManager = null;
1963            private User _user;
1964            private boolean _widget;
1965    
1966    }