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