1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.model.impl;
24  
25  import com.liferay.portal.kernel.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  /**
36   * <a href="LayoutSetModelImpl.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be overwritten
40   * the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class is a model that represents the <code>LayoutSet</code> table in the
45   * database.
46   * </p>
47   *
48   * @author Brian Wing Shun Chan
49   *
50   * @see com.liferay.portal.service.model.LayoutSet
51   * @see com.liferay.portal.service.model.LayoutSetModel
52   * @see com.liferay.portal.service.model.impl.LayoutSetImpl
53   *
54   */
55  public class LayoutSetModelImpl extends BaseModelImpl {
56      public static String TABLE_NAME = "LayoutSet";
57      public static Object[][] TABLE_COLUMNS = {
58              { "layoutSetId", new Integer(Types.BIGINT) },
59              { "groupId", new Integer(Types.BIGINT) },
60              { "companyId", new Integer(Types.BIGINT) },
61              { "privateLayout", new Integer(Types.BOOLEAN) },
62              { "logo", new Integer(Types.BOOLEAN) },
63              { "logoId", new Integer(Types.BIGINT) },
64              { "themeId", new Integer(Types.VARCHAR) },
65              { "colorSchemeId", new Integer(Types.VARCHAR) },
66              { "wapThemeId", new Integer(Types.VARCHAR) },
67              { "wapColorSchemeId", new Integer(Types.VARCHAR) },
68              { "css", new Integer(Types.VARCHAR) },
69              { "pageCount", new Integer(Types.INTEGER) },
70              { "virtualHost", new Integer(Types.VARCHAR) }
71          };
72      public static String TABLE_SQL_CREATE = "create table LayoutSet (layoutSetId LONG not null primary key,groupId LONG,companyId LONG,privateLayout BOOLEAN,logo BOOLEAN,logoId LONG,themeId VARCHAR(75) null,colorSchemeId VARCHAR(75) null,wapThemeId VARCHAR(75) null,wapColorSchemeId VARCHAR(75) null,css VARCHAR(75) null,pageCount INTEGER,virtualHost VARCHAR(75) null)";
73      public static String TABLE_SQL_DROP = "drop table LayoutSet";
74      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
75                  "xss.allow.com.liferay.portal.model.LayoutSet"), XSS_ALLOW);
76      public static boolean XSS_ALLOW_THEMEID = GetterUtil.getBoolean(PropsUtil.get(
77                  "xss.allow.com.liferay.portal.model.LayoutSet.themeId"),
78              XSS_ALLOW_BY_MODEL);
79      public static boolean XSS_ALLOW_COLORSCHEMEID = GetterUtil.getBoolean(PropsUtil.get(
80                  "xss.allow.com.liferay.portal.model.LayoutSet.colorSchemeId"),
81              XSS_ALLOW_BY_MODEL);
82      public static boolean XSS_ALLOW_WAPTHEMEID = GetterUtil.getBoolean(PropsUtil.get(
83                  "xss.allow.com.liferay.portal.model.LayoutSet.wapThemeId"),
84              XSS_ALLOW_BY_MODEL);
85      public static boolean XSS_ALLOW_WAPCOLORSCHEMEID = GetterUtil.getBoolean(PropsUtil.get(
86                  "xss.allow.com.liferay.portal.model.LayoutSet.wapColorSchemeId"),
87              XSS_ALLOW_BY_MODEL);
88      public static boolean XSS_ALLOW_CSS = GetterUtil.getBoolean(PropsUtil.get(
89                  "xss.allow.com.liferay.portal.model.LayoutSet.css"),
90              XSS_ALLOW_BY_MODEL);
91      public static boolean XSS_ALLOW_VIRTUALHOST = GetterUtil.getBoolean(PropsUtil.get(
92                  "xss.allow.com.liferay.portal.model.LayoutSet.virtualHost"),
93              XSS_ALLOW_BY_MODEL);
94      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
95                  "lock.expiration.time.com.liferay.portal.model.LayoutSetModel"));
96  
97      public LayoutSetModelImpl() {
98      }
99  
100     public long getPrimaryKey() {
101         return _layoutSetId;
102     }
103 
104     public void setPrimaryKey(long pk) {
105         setLayoutSetId(pk);
106     }
107 
108     public Serializable getPrimaryKeyObj() {
109         return new Long(_layoutSetId);
110     }
111 
112     public long getLayoutSetId() {
113         return _layoutSetId;
114     }
115 
116     public void setLayoutSetId(long layoutSetId) {
117         if (layoutSetId != _layoutSetId) {
118             _layoutSetId = layoutSetId;
119         }
120     }
121 
122     public long getGroupId() {
123         return _groupId;
124     }
125 
126     public void setGroupId(long groupId) {
127         if (groupId != _groupId) {
128             _groupId = groupId;
129         }
130     }
131 
132     public long getCompanyId() {
133         return _companyId;
134     }
135 
136     public void setCompanyId(long companyId) {
137         if (companyId != _companyId) {
138             _companyId = companyId;
139         }
140     }
141 
142     public boolean getPrivateLayout() {
143         return _privateLayout;
144     }
145 
146     public boolean isPrivateLayout() {
147         return _privateLayout;
148     }
149 
150     public void setPrivateLayout(boolean privateLayout) {
151         if (privateLayout != _privateLayout) {
152             _privateLayout = privateLayout;
153         }
154     }
155 
156     public boolean getLogo() {
157         return _logo;
158     }
159 
160     public boolean isLogo() {
161         return _logo;
162     }
163 
164     public void setLogo(boolean logo) {
165         if (logo != _logo) {
166             _logo = logo;
167         }
168     }
169 
170     public long getLogoId() {
171         return _logoId;
172     }
173 
174     public void setLogoId(long logoId) {
175         if (logoId != _logoId) {
176             _logoId = logoId;
177         }
178     }
179 
180     public String getThemeId() {
181         return GetterUtil.getString(_themeId);
182     }
183 
184     public void setThemeId(String themeId) {
185         if (((themeId == null) && (_themeId != null)) ||
186                 ((themeId != null) && (_themeId == null)) ||
187                 ((themeId != null) && (_themeId != null) &&
188                 !themeId.equals(_themeId))) {
189             if (!XSS_ALLOW_THEMEID) {
190                 themeId = XSSUtil.strip(themeId);
191             }
192 
193             _themeId = themeId;
194         }
195     }
196 
197     public String getColorSchemeId() {
198         return GetterUtil.getString(_colorSchemeId);
199     }
200 
201     public void setColorSchemeId(String colorSchemeId) {
202         if (((colorSchemeId == null) && (_colorSchemeId != null)) ||
203                 ((colorSchemeId != null) && (_colorSchemeId == null)) ||
204                 ((colorSchemeId != null) && (_colorSchemeId != null) &&
205                 !colorSchemeId.equals(_colorSchemeId))) {
206             if (!XSS_ALLOW_COLORSCHEMEID) {
207                 colorSchemeId = XSSUtil.strip(colorSchemeId);
208             }
209 
210             _colorSchemeId = colorSchemeId;
211         }
212     }
213 
214     public String getWapThemeId() {
215         return GetterUtil.getString(_wapThemeId);
216     }
217 
218     public void setWapThemeId(String wapThemeId) {
219         if (((wapThemeId == null) && (_wapThemeId != null)) ||
220                 ((wapThemeId != null) && (_wapThemeId == null)) ||
221                 ((wapThemeId != null) && (_wapThemeId != null) &&
222                 !wapThemeId.equals(_wapThemeId))) {
223             if (!XSS_ALLOW_WAPTHEMEID) {
224                 wapThemeId = XSSUtil.strip(wapThemeId);
225             }
226 
227             _wapThemeId = wapThemeId;
228         }
229     }
230 
231     public String getWapColorSchemeId() {
232         return GetterUtil.getString(_wapColorSchemeId);
233     }
234 
235     public void setWapColorSchemeId(String wapColorSchemeId) {
236         if (((wapColorSchemeId == null) && (_wapColorSchemeId != null)) ||
237                 ((wapColorSchemeId != null) && (_wapColorSchemeId == null)) ||
238                 ((wapColorSchemeId != null) && (_wapColorSchemeId != null) &&
239                 !wapColorSchemeId.equals(_wapColorSchemeId))) {
240             if (!XSS_ALLOW_WAPCOLORSCHEMEID) {
241                 wapColorSchemeId = XSSUtil.strip(wapColorSchemeId);
242             }
243 
244             _wapColorSchemeId = wapColorSchemeId;
245         }
246     }
247 
248     public String getCss() {
249         return GetterUtil.getString(_css);
250     }
251 
252     public void setCss(String css) {
253         if (((css == null) && (_css != null)) ||
254                 ((css != null) && (_css == null)) ||
255                 ((css != null) && (_css != null) && !css.equals(_css))) {
256             if (!XSS_ALLOW_CSS) {
257                 css = XSSUtil.strip(css);
258             }
259 
260             _css = css;
261         }
262     }
263 
264     public int getPageCount() {
265         return _pageCount;
266     }
267 
268     public void setPageCount(int pageCount) {
269         if (pageCount != _pageCount) {
270             _pageCount = pageCount;
271         }
272     }
273 
274     public String getVirtualHost() {
275         return GetterUtil.getString(_virtualHost);
276     }
277 
278     public void setVirtualHost(String virtualHost) {
279         if (((virtualHost == null) && (_virtualHost != null)) ||
280                 ((virtualHost != null) && (_virtualHost == null)) ||
281                 ((virtualHost != null) && (_virtualHost != null) &&
282                 !virtualHost.equals(_virtualHost))) {
283             if (!XSS_ALLOW_VIRTUALHOST) {
284                 virtualHost = XSSUtil.strip(virtualHost);
285             }
286 
287             _virtualHost = virtualHost;
288         }
289     }
290 
291     public Object clone() {
292         LayoutSetImpl clone = new LayoutSetImpl();
293         clone.setLayoutSetId(getLayoutSetId());
294         clone.setGroupId(getGroupId());
295         clone.setCompanyId(getCompanyId());
296         clone.setPrivateLayout(getPrivateLayout());
297         clone.setLogo(getLogo());
298         clone.setLogoId(getLogoId());
299         clone.setThemeId(getThemeId());
300         clone.setColorSchemeId(getColorSchemeId());
301         clone.setWapThemeId(getWapThemeId());
302         clone.setWapColorSchemeId(getWapColorSchemeId());
303         clone.setCss(getCss());
304         clone.setPageCount(getPageCount());
305         clone.setVirtualHost(getVirtualHost());
306 
307         return clone;
308     }
309 
310     public int compareTo(Object obj) {
311         if (obj == null) {
312             return -1;
313         }
314 
315         LayoutSetImpl layoutSet = (LayoutSetImpl)obj;
316         long pk = layoutSet.getPrimaryKey();
317 
318         if (getPrimaryKey() < pk) {
319             return -1;
320         }
321         else if (getPrimaryKey() > pk) {
322             return 1;
323         }
324         else {
325             return 0;
326         }
327     }
328 
329     public boolean equals(Object obj) {
330         if (obj == null) {
331             return false;
332         }
333 
334         LayoutSetImpl layoutSet = null;
335 
336         try {
337             layoutSet = (LayoutSetImpl)obj;
338         }
339         catch (ClassCastException cce) {
340             return false;
341         }
342 
343         long pk = layoutSet.getPrimaryKey();
344 
345         if (getPrimaryKey() == pk) {
346             return true;
347         }
348         else {
349             return false;
350         }
351     }
352 
353     public int hashCode() {
354         return (int)getPrimaryKey();
355     }
356 
357     private long _layoutSetId;
358     private long _groupId;
359     private long _companyId;
360     private boolean _privateLayout;
361     private boolean _logo;
362     private long _logoId;
363     private String _themeId;
364     private String _colorSchemeId;
365     private String _wapThemeId;
366     private String _wapColorSchemeId;
367     private String _css;
368     private int _pageCount;
369     private String _virtualHost;
370 }