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.setNew(isNew());
463 model.setEscapedModel(true);
464
465 model.setPlid(getPlid());
466 model.setGroupId(getGroupId());
467 model.setCompanyId(getCompanyId());
468 model.setPrivateLayout(getPrivateLayout());
469 model.setLayoutId(getLayoutId());
470 model.setParentLayoutId(getParentLayoutId());
471 model.setName(HtmlUtil.escape(getName()));
472 model.setTitle(HtmlUtil.escape(getTitle()));
473 model.setDescription(HtmlUtil.escape(getDescription()));
474 model.setType(HtmlUtil.escape(getType()));
475 model.setTypeSettings(HtmlUtil.escape(getTypeSettings()));
476 model.setHidden(getHidden());
477 model.setFriendlyURL(HtmlUtil.escape(getFriendlyURL()));
478 model.setIconImage(getIconImage());
479 model.setIconImageId(getIconImageId());
480 model.setThemeId(HtmlUtil.escape(getThemeId()));
481 model.setColorSchemeId(HtmlUtil.escape(getColorSchemeId()));
482 model.setWapThemeId(HtmlUtil.escape(getWapThemeId()));
483 model.setWapColorSchemeId(HtmlUtil.escape(getWapColorSchemeId()));
484 model.setCss(HtmlUtil.escape(getCss()));
485 model.setPriority(getPriority());
486 model.setDlFolderId(getDlFolderId());
487
488 model = (Layout)Proxy.newProxyInstance(Layout.class.getClassLoader(),
489 new Class[] { Layout.class }, new ReadOnlyBeanHandler(model));
490
491 return model;
492 }
493 }
494
495 public Object clone() {
496 LayoutImpl clone = new LayoutImpl();
497
498 clone.setPlid(getPlid());
499 clone.setGroupId(getGroupId());
500 clone.setCompanyId(getCompanyId());
501 clone.setPrivateLayout(getPrivateLayout());
502 clone.setLayoutId(getLayoutId());
503 clone.setParentLayoutId(getParentLayoutId());
504 clone.setName(getName());
505 clone.setTitle(getTitle());
506 clone.setDescription(getDescription());
507 clone.setType(getType());
508 clone.setTypeSettings(getTypeSettings());
509 clone.setHidden(getHidden());
510 clone.setFriendlyURL(getFriendlyURL());
511 clone.setIconImage(getIconImage());
512 clone.setIconImageId(getIconImageId());
513 clone.setThemeId(getThemeId());
514 clone.setColorSchemeId(getColorSchemeId());
515 clone.setWapThemeId(getWapThemeId());
516 clone.setWapColorSchemeId(getWapColorSchemeId());
517 clone.setCss(getCss());
518 clone.setPriority(getPriority());
519 clone.setDlFolderId(getDlFolderId());
520
521 return clone;
522 }
523
524 public int compareTo(Object obj) {
525 if (obj == null) {
526 return -1;
527 }
528
529 LayoutImpl layout = (LayoutImpl)obj;
530
531 int value = 0;
532
533 if (getParentLayoutId() < layout.getParentLayoutId()) {
534 value = -1;
535 }
536 else if (getParentLayoutId() > layout.getParentLayoutId()) {
537 value = 1;
538 }
539 else {
540 value = 0;
541 }
542
543 if (value != 0) {
544 return value;
545 }
546
547 if (getPriority() < layout.getPriority()) {
548 value = -1;
549 }
550 else if (getPriority() > layout.getPriority()) {
551 value = 1;
552 }
553 else {
554 value = 0;
555 }
556
557 if (value != 0) {
558 return value;
559 }
560
561 return 0;
562 }
563
564 public boolean equals(Object obj) {
565 if (obj == null) {
566 return false;
567 }
568
569 LayoutImpl layout = null;
570
571 try {
572 layout = (LayoutImpl)obj;
573 }
574 catch (ClassCastException cce) {
575 return false;
576 }
577
578 long pk = layout.getPrimaryKey();
579
580 if (getPrimaryKey() == pk) {
581 return true;
582 }
583 else {
584 return false;
585 }
586 }
587
588 public int hashCode() {
589 return (int)getPrimaryKey();
590 }
591
592 private long _plid;
593 private long _groupId;
594 private long _companyId;
595 private boolean _privateLayout;
596 private long _layoutId;
597 private long _parentLayoutId;
598 private String _name;
599 private String _title;
600 private String _description;
601 private String _type;
602 private String _typeSettings;
603 private boolean _hidden;
604 private String _friendlyURL;
605 private boolean _iconImage;
606 private long _iconImageId;
607 private String _themeId;
608 private String _colorSchemeId;
609 private String _wapThemeId;
610 private String _wapColorSchemeId;
611 private String _css;
612 private int _priority;
613 private long _dlFolderId;
614 }