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