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