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