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="LayoutModelImpl.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>Layout</code> table in the database.
45   * </p>
46   *
47   * @author Brian Wing Shun Chan
48   *
49   * @see com.liferay.portal.service.model.Layout
50   * @see com.liferay.portal.service.model.LayoutModel
51   * @see com.liferay.portal.service.model.impl.LayoutImpl
52   *
53   */
54  public class LayoutModelImpl extends BaseModelImpl {
55      public static String TABLE_NAME = "Layout";
56      public static Object[][] TABLE_COLUMNS = {
57              { "plid", new Integer(Types.BIGINT) },
58              { "groupId", new Integer(Types.BIGINT) },
59              { "companyId", new Integer(Types.BIGINT) },
60              { "privateLayout", new Integer(Types.BOOLEAN) },
61              { "layoutId", new Integer(Types.BIGINT) },
62              { "parentLayoutId", new Integer(Types.BIGINT) },
63              { "name", new Integer(Types.VARCHAR) },
64              { "title", new Integer(Types.VARCHAR) },
65              { "description", new Integer(Types.VARCHAR) },
66              { "type_", new Integer(Types.VARCHAR) },
67              { "typeSettings", new Integer(Types.CLOB) },
68              { "hidden_", new Integer(Types.BOOLEAN) },
69              { "friendlyURL", new Integer(Types.VARCHAR) },
70              { "iconImage", new Integer(Types.BOOLEAN) },
71              { "iconImageId", new Integer(Types.BIGINT) },
72              { "themeId", new Integer(Types.VARCHAR) },
73              { "colorSchemeId", new Integer(Types.VARCHAR) },
74              { "wapThemeId", new Integer(Types.VARCHAR) },
75              { "wapColorSchemeId", new Integer(Types.VARCHAR) },
76              { "css", new Integer(Types.VARCHAR) },
77              { "priority", new Integer(Types.INTEGER) },
78              { "dlFolderId", new Integer(Types.BIGINT) }
79          };
80      public static String TABLE_SQL_CREATE = "create table Layout (plid LONG not null primary key,groupId LONG,companyId LONG,privateLayout BOOLEAN,layoutId LONG,parentLayoutId LONG,name STRING null,title STRING null,description STRING null,type_ VARCHAR(75) null,typeSettings TEXT null,hidden_ BOOLEAN,friendlyURL VARCHAR(100) null,iconImage BOOLEAN,iconImageId LONG,themeId VARCHAR(75) null,colorSchemeId VARCHAR(75) null,wapThemeId VARCHAR(75) null,wapColorSchemeId VARCHAR(75) null,css STRING null,priority INTEGER,dlFolderId LONG)";
81      public static String TABLE_SQL_DROP = "drop table Layout";
82      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
83                  "xss.allow.com.liferay.portal.model.Layout"), XSS_ALLOW);
84      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
85                  "xss.allow.com.liferay.portal.model.Layout.name"),
86              XSS_ALLOW_BY_MODEL);
87      public static boolean XSS_ALLOW_TITLE = GetterUtil.getBoolean(PropsUtil.get(
88                  "xss.allow.com.liferay.portal.model.Layout.title"),
89              XSS_ALLOW_BY_MODEL);
90      public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
91                  "xss.allow.com.liferay.portal.model.Layout.description"),
92              XSS_ALLOW_BY_MODEL);
93      public static boolean XSS_ALLOW_TYPE = GetterUtil.getBoolean(PropsUtil.get(
94                  "xss.allow.com.liferay.portal.model.Layout.type"),
95              XSS_ALLOW_BY_MODEL);
96      public static boolean XSS_ALLOW_TYPESETTINGS = GetterUtil.getBoolean(PropsUtil.get(
97                  "xss.allow.com.liferay.portal.model.Layout.typeSettings"),
98              XSS_ALLOW_BY_MODEL);
99      public static boolean XSS_ALLOW_FRIENDLYURL = GetterUtil.getBoolean(PropsUtil.get(
100                 "xss.allow.com.liferay.portal.model.Layout.friendlyURL"),
101             XSS_ALLOW_BY_MODEL);
102     public static boolean XSS_ALLOW_THEMEID = GetterUtil.getBoolean(PropsUtil.get(
103                 "xss.allow.com.liferay.portal.model.Layout.themeId"),
104             XSS_ALLOW_BY_MODEL);
105     public static boolean XSS_ALLOW_COLORSCHEMEID = GetterUtil.getBoolean(PropsUtil.get(
106                 "xss.allow.com.liferay.portal.model.Layout.colorSchemeId"),
107             XSS_ALLOW_BY_MODEL);
108     public static boolean XSS_ALLOW_WAPTHEMEID = GetterUtil.getBoolean(PropsUtil.get(
109                 "xss.allow.com.liferay.portal.model.Layout.wapThemeId"),
110             XSS_ALLOW_BY_MODEL);
111     public static boolean XSS_ALLOW_WAPCOLORSCHEMEID = GetterUtil.getBoolean(PropsUtil.get(
112                 "xss.allow.com.liferay.portal.model.Layout.wapColorSchemeId"),
113             XSS_ALLOW_BY_MODEL);
114     public static boolean XSS_ALLOW_CSS = GetterUtil.getBoolean(PropsUtil.get(
115                 "xss.allow.com.liferay.portal.model.Layout.css"),
116             XSS_ALLOW_BY_MODEL);
117     public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
118                 "lock.expiration.time.com.liferay.portal.model.LayoutModel"));
119 
120     public LayoutModelImpl() {
121     }
122 
123     public long getPrimaryKey() {
124         return _plid;
125     }
126 
127     public void setPrimaryKey(long pk) {
128         setPlid(pk);
129     }
130 
131     public Serializable getPrimaryKeyObj() {
132         return new Long(_plid);
133     }
134 
135     public long getPlid() {
136         return _plid;
137     }
138 
139     public void setPlid(long plid) {
140         if (plid != _plid) {
141             _plid = plid;
142         }
143     }
144 
145     public long getGroupId() {
146         return _groupId;
147     }
148 
149     public void setGroupId(long groupId) {
150         if (groupId != _groupId) {
151             _groupId = groupId;
152         }
153     }
154 
155     public long getCompanyId() {
156         return _companyId;
157     }
158 
159     public void setCompanyId(long companyId) {
160         if (companyId != _companyId) {
161             _companyId = companyId;
162         }
163     }
164 
165     public boolean getPrivateLayout() {
166         return _privateLayout;
167     }
168 
169     public boolean isPrivateLayout() {
170         return _privateLayout;
171     }
172 
173     public void setPrivateLayout(boolean privateLayout) {
174         if (privateLayout != _privateLayout) {
175             _privateLayout = privateLayout;
176         }
177     }
178 
179     public long getLayoutId() {
180         return _layoutId;
181     }
182 
183     public void setLayoutId(long layoutId) {
184         if (layoutId != _layoutId) {
185             _layoutId = layoutId;
186         }
187     }
188 
189     public long getParentLayoutId() {
190         return _parentLayoutId;
191     }
192 
193     public void setParentLayoutId(long parentLayoutId) {
194         if (parentLayoutId != _parentLayoutId) {
195             _parentLayoutId = parentLayoutId;
196         }
197     }
198 
199     public String getName() {
200         return GetterUtil.getString(_name);
201     }
202 
203     public void setName(String name) {
204         if (((name == null) && (_name != null)) ||
205                 ((name != null) && (_name == null)) ||
206                 ((name != null) && (_name != null) && !name.equals(_name))) {
207             if (!XSS_ALLOW_NAME) {
208                 name = XSSUtil.strip(name);
209             }
210 
211             _name = name;
212         }
213     }
214 
215     public String getTitle() {
216         return GetterUtil.getString(_title);
217     }
218 
219     public void setTitle(String title) {
220         if (((title == null) && (_title != null)) ||
221                 ((title != null) && (_title == null)) ||
222                 ((title != null) && (_title != null) && !title.equals(_title))) {
223             if (!XSS_ALLOW_TITLE) {
224                 title = XSSUtil.strip(title);
225             }
226 
227             _title = title;
228         }
229     }
230 
231     public String getDescription() {
232         return GetterUtil.getString(_description);
233     }
234 
235     public void setDescription(String description) {
236         if (((description == null) && (_description != null)) ||
237                 ((description != null) && (_description == null)) ||
238                 ((description != null) && (_description != null) &&
239                 !description.equals(_description))) {
240             if (!XSS_ALLOW_DESCRIPTION) {
241                 description = XSSUtil.strip(description);
242             }
243 
244             _description = description;
245         }
246     }
247 
248     public String getType() {
249         return GetterUtil.getString(_type);
250     }
251 
252     public void setType(String type) {
253         if (((type == null) && (_type != null)) ||
254                 ((type != null) && (_type == null)) ||
255                 ((type != null) && (_type != null) && !type.equals(_type))) {
256             if (!XSS_ALLOW_TYPE) {
257                 type = XSSUtil.strip(type);
258             }
259 
260             _type = type;
261         }
262     }
263 
264     public String getTypeSettings() {
265         return GetterUtil.getString(_typeSettings);
266     }
267 
268     public void setTypeSettings(String typeSettings) {
269         if (((typeSettings == null) && (_typeSettings != null)) ||
270                 ((typeSettings != null) && (_typeSettings == null)) ||
271                 ((typeSettings != null) && (_typeSettings != null) &&
272                 !typeSettings.equals(_typeSettings))) {
273             if (!XSS_ALLOW_TYPESETTINGS) {
274                 typeSettings = XSSUtil.strip(typeSettings);
275             }
276 
277             _typeSettings = typeSettings;
278         }
279     }
280 
281     public boolean getHidden() {
282         return _hidden;
283     }
284 
285     public boolean isHidden() {
286         return _hidden;
287     }
288 
289     public void setHidden(boolean hidden) {
290         if (hidden != _hidden) {
291             _hidden = hidden;
292         }
293     }
294 
295     public String getFriendlyURL() {
296         return GetterUtil.getString(_friendlyURL);
297     }
298 
299     public void setFriendlyURL(String friendlyURL) {
300         if (((friendlyURL == null) && (_friendlyURL != null)) ||
301                 ((friendlyURL != null) && (_friendlyURL == null)) ||
302                 ((friendlyURL != null) && (_friendlyURL != null) &&
303                 !friendlyURL.equals(_friendlyURL))) {
304             if (!XSS_ALLOW_FRIENDLYURL) {
305                 friendlyURL = XSSUtil.strip(friendlyURL);
306             }
307 
308             _friendlyURL = friendlyURL;
309         }
310     }
311 
312     public boolean getIconImage() {
313         return _iconImage;
314     }
315 
316     public boolean isIconImage() {
317         return _iconImage;
318     }
319 
320     public void setIconImage(boolean iconImage) {
321         if (iconImage != _iconImage) {
322             _iconImage = iconImage;
323         }
324     }
325 
326     public long getIconImageId() {
327         return _iconImageId;
328     }
329 
330     public void setIconImageId(long iconImageId) {
331         if (iconImageId != _iconImageId) {
332             _iconImageId = iconImageId;
333         }
334     }
335 
336     public String getThemeId() {
337         return GetterUtil.getString(_themeId);
338     }
339 
340     public void setThemeId(String themeId) {
341         if (((themeId == null) && (_themeId != null)) ||
342                 ((themeId != null) && (_themeId == null)) ||
343                 ((themeId != null) && (_themeId != null) &&
344                 !themeId.equals(_themeId))) {
345             if (!XSS_ALLOW_THEMEID) {
346                 themeId = XSSUtil.strip(themeId);
347             }
348 
349             _themeId = themeId;
350         }
351     }
352 
353     public String getColorSchemeId() {
354         return GetterUtil.getString(_colorSchemeId);
355     }
356 
357     public void setColorSchemeId(String colorSchemeId) {
358         if (((colorSchemeId == null) && (_colorSchemeId != null)) ||
359                 ((colorSchemeId != null) && (_colorSchemeId == null)) ||
360                 ((colorSchemeId != null) && (_colorSchemeId != null) &&
361                 !colorSchemeId.equals(_colorSchemeId))) {
362             if (!XSS_ALLOW_COLORSCHEMEID) {
363                 colorSchemeId = XSSUtil.strip(colorSchemeId);
364             }
365 
366             _colorSchemeId = colorSchemeId;
367         }
368     }
369 
370     public String getWapThemeId() {
371         return GetterUtil.getString(_wapThemeId);
372     }
373 
374     public void setWapThemeId(String wapThemeId) {
375         if (((wapThemeId == null) && (_wapThemeId != null)) ||
376                 ((wapThemeId != null) && (_wapThemeId == null)) ||
377                 ((wapThemeId != null) && (_wapThemeId != null) &&
378                 !wapThemeId.equals(_wapThemeId))) {
379             if (!XSS_ALLOW_WAPTHEMEID) {
380                 wapThemeId = XSSUtil.strip(wapThemeId);
381             }
382 
383             _wapThemeId = wapThemeId;
384         }
385     }
386 
387     public String getWapColorSchemeId() {
388         return GetterUtil.getString(_wapColorSchemeId);
389     }
390 
391     public void setWapColorSchemeId(String wapColorSchemeId) {
392         if (((wapColorSchemeId == null) && (_wapColorSchemeId != null)) ||
393                 ((wapColorSchemeId != null) && (_wapColorSchemeId == null)) ||
394                 ((wapColorSchemeId != null) && (_wapColorSchemeId != null) &&
395                 !wapColorSchemeId.equals(_wapColorSchemeId))) {
396             if (!XSS_ALLOW_WAPCOLORSCHEMEID) {
397                 wapColorSchemeId = XSSUtil.strip(wapColorSchemeId);
398             }
399 
400             _wapColorSchemeId = wapColorSchemeId;
401         }
402     }
403 
404     public String getCss() {
405         return GetterUtil.getString(_css);
406     }
407 
408     public void setCss(String css) {
409         if (((css == null) && (_css != null)) ||
410                 ((css != null) && (_css == null)) ||
411                 ((css != null) && (_css != null) && !css.equals(_css))) {
412             if (!XSS_ALLOW_CSS) {
413                 css = XSSUtil.strip(css);
414             }
415 
416             _css = css;
417         }
418     }
419 
420     public int getPriority() {
421         return _priority;
422     }
423 
424     public void setPriority(int priority) {
425         if (priority != _priority) {
426             _priority = priority;
427         }
428     }
429 
430     public long getDlFolderId() {
431         return _dlFolderId;
432     }
433 
434     public void setDlFolderId(long dlFolderId) {
435         if (dlFolderId != _dlFolderId) {
436             _dlFolderId = dlFolderId;
437         }
438     }
439 
440     public Object clone() {
441         LayoutImpl clone = new LayoutImpl();
442         clone.setPlid(getPlid());
443         clone.setGroupId(getGroupId());
444         clone.setCompanyId(getCompanyId());
445         clone.setPrivateLayout(getPrivateLayout());
446         clone.setLayoutId(getLayoutId());
447         clone.setParentLayoutId(getParentLayoutId());
448         clone.setName(getName());
449         clone.setTitle(getTitle());
450         clone.setDescription(getDescription());
451         clone.setType(getType());
452         clone.setTypeSettings(getTypeSettings());
453         clone.setHidden(getHidden());
454         clone.setFriendlyURL(getFriendlyURL());
455         clone.setIconImage(getIconImage());
456         clone.setIconImageId(getIconImageId());
457         clone.setThemeId(getThemeId());
458         clone.setColorSchemeId(getColorSchemeId());
459         clone.setWapThemeId(getWapThemeId());
460         clone.setWapColorSchemeId(getWapColorSchemeId());
461         clone.setCss(getCss());
462         clone.setPriority(getPriority());
463         clone.setDlFolderId(getDlFolderId());
464 
465         return clone;
466     }
467 
468     public int compareTo(Object obj) {
469         if (obj == null) {
470             return -1;
471         }
472 
473         LayoutImpl layout = (LayoutImpl)obj;
474         int value = 0;
475 
476         if (getParentLayoutId() < layout.getParentLayoutId()) {
477             value = -1;
478         }
479         else if (getParentLayoutId() > layout.getParentLayoutId()) {
480             value = 1;
481         }
482         else {
483             value = 0;
484         }
485 
486         if (value != 0) {
487             return value;
488         }
489 
490         if (getPriority() < layout.getPriority()) {
491             value = -1;
492         }
493         else if (getPriority() > layout.getPriority()) {
494             value = 1;
495         }
496         else {
497             value = 0;
498         }
499 
500         if (value != 0) {
501             return value;
502         }
503 
504         return 0;
505     }
506 
507     public boolean equals(Object obj) {
508         if (obj == null) {
509             return false;
510         }
511 
512         LayoutImpl layout = null;
513 
514         try {
515             layout = (LayoutImpl)obj;
516         }
517         catch (ClassCastException cce) {
518             return false;
519         }
520 
521         long pk = layout.getPrimaryKey();
522 
523         if (getPrimaryKey() == pk) {
524             return true;
525         }
526         else {
527             return false;
528         }
529     }
530 
531     public int hashCode() {
532         return (int)getPrimaryKey();
533     }
534 
535     private long _plid;
536     private long _groupId;
537     private long _companyId;
538     private boolean _privateLayout;
539     private long _layoutId;
540     private long _parentLayoutId;
541     private String _name;
542     private String _title;
543     private String _description;
544     private String _type;
545     private String _typeSettings;
546     private boolean _hidden;
547     private String _friendlyURL;
548     private boolean _iconImage;
549     private long _iconImageId;
550     private String _themeId;
551     private String _colorSchemeId;
552     private String _wapThemeId;
553     private String _wapColorSchemeId;
554     private String _css;
555     private int _priority;
556     private long _dlFolderId;
557 }