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