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