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.portlet;
016    
017    import com.liferay.portal.kernel.util.HttpUtil;
018    import com.liferay.portal.theme.PortletDisplay;
019    import com.liferay.portal.theme.ThemeDisplay;
020    
021    import java.util.Locale;
022    import java.util.TimeZone;
023    
024    /**
025     * @author Shuyang Zhou
026     */
027    public class ThemeDisplayModel {
028    
029            public ThemeDisplayModel(ThemeDisplay themeDisplay) {
030                    _cdnHost = themeDisplay.getCDNHost();
031                    _companyId = themeDisplay.getCompanyId();
032                    _doAsUserId = themeDisplay.getDoAsUserId();
033                    _i18nLanguageId = themeDisplay.getI18nLanguageId();
034                    _i18nPath = themeDisplay.getI18nPath();
035                    _languageId = themeDisplay.getLanguageId();
036                    _locale = themeDisplay.getLocale();
037                    _pathContext = themeDisplay.getPathContext();
038                    _pathFriendlyURLPrivateGroup =
039                            themeDisplay.getPathFriendlyURLPrivateGroup();
040                    _pathFriendlyURLPrivateUser =
041                            themeDisplay.getPathFriendlyURLPrivateUser();
042                    _pathFriendlyURLPublic = themeDisplay.getPathFriendlyURLPublic();
043                    _pathImage = themeDisplay.getPathImage();
044                    _pathMain = themeDisplay.getPathMain();
045                    _pathThemeImages = themeDisplay.getPathThemeImages();
046                    _plid = themeDisplay.getPlid();
047                    _portalURL = HttpUtil.removeProtocol(themeDisplay.getPortalURL());
048                    _realUserId = themeDisplay.getRealUserId();
049                    _scopeGroupId = themeDisplay.getScopeGroupId();
050                    _secure = themeDisplay.isSecure();
051                    _serverName = themeDisplay.getServerName();
052                    _serverPort = themeDisplay.getServerPort();
053                    _timeZone = themeDisplay.getTimeZone();
054                    _urlPortal = HttpUtil.removeProtocol(themeDisplay.getURLPortal());
055                    _userId = themeDisplay.getUserId();
056    
057                    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
058    
059                    if (portletDisplay != null) {
060                            _portletDisplayModel = new PortletDisplayModel(portletDisplay);
061                    }
062                    else {
063                            _portletDisplayModel = null;
064                    }
065            }
066    
067            public String getCdnHost() {
068                    return _cdnHost;
069            }
070    
071            public long getCompanyId() {
072                    return _companyId;
073            }
074    
075            public String getDoAsUserId() {
076                    return _doAsUserId;
077            }
078    
079            public String getI18nLanguageId() {
080                    return _i18nLanguageId;
081            }
082    
083            public String getI18nPath() {
084                    return _i18nPath;
085            }
086    
087            public String getLanguageId() {
088                    return _languageId;
089            }
090    
091            public Locale getLocale() {
092                    return _locale;
093            }
094    
095            public String getPathContext() {
096                    return _pathContext;
097            }
098    
099            public String getPathFriendlyURLPrivateGroup() {
100                    return _pathFriendlyURLPrivateGroup;
101            }
102    
103            public String getPathFriendlyURLPrivateUser() {
104                    return _pathFriendlyURLPrivateUser;
105            }
106    
107            public String getPathFriendlyURLPublic() {
108                    return _pathFriendlyURLPublic;
109            }
110    
111            public String getPathImage() {
112                    return _pathImage;
113            }
114    
115            public String getPathMain() {
116                    return _pathMain;
117            }
118    
119            public String getPathThemeImages() {
120                    return _pathThemeImages;
121            }
122    
123            public long getPlid() {
124                    return _plid;
125            }
126    
127            public String getPortalURL() {
128                    return _portalURL;
129            }
130    
131            public PortletDisplayModel getPortletDisplayModel() {
132                    return _portletDisplayModel;
133            }
134    
135            public long getRealUserId() {
136                    return _realUserId;
137            }
138    
139            public long getScopeGroupId() {
140                    return _scopeGroupId;
141            }
142    
143            public String getServerName() {
144                    return _serverName;
145            }
146    
147            public int getServerPort() {
148                    return _serverPort;
149            }
150    
151            public TimeZone getTimeZone() {
152                    return _timeZone;
153            }
154    
155            public String getURLPortal() {
156                    return _urlPortal;
157            }
158    
159            public long getUserId() {
160                    return _userId;
161            }
162    
163            public boolean isSecure() {
164                    return _secure;
165            }
166    
167            private final String _cdnHost;
168            private final long _companyId;
169            private final String _doAsUserId;
170            private final String _i18nLanguageId;
171            private final String _i18nPath;
172            private final String _languageId;
173            private final Locale _locale;
174            private final String _pathContext;
175            private final String _pathFriendlyURLPrivateGroup;
176            private final String _pathFriendlyURLPrivateUser;
177            private final String _pathFriendlyURLPublic;
178            private final String _pathImage;
179            private final String _pathMain;
180            private final String _pathThemeImages;
181            private final long _plid;
182            private final String _portalURL;
183            private final PortletDisplayModel _portletDisplayModel;
184            private final long _realUserId;
185            private final long _scopeGroupId;
186            private final boolean _secure;
187            private final String _serverName;
188            private final int _serverPort;
189            private final TimeZone _timeZone;
190            private final String _urlPortal;
191            private final long _userId;
192    
193    }