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