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