001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.Layout;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="LayoutModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>Layout</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.Layout
052: * @see com.liferay.portal.service.model.LayoutModel
053: * @see com.liferay.portal.service.model.impl.LayoutImpl
054: *
055: */
056: public class LayoutModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "Layout";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "plid", new Integer(Types.BIGINT) },
060:
061: { "groupId", new Integer(Types.BIGINT) },
062:
063: { "companyId", new Integer(Types.BIGINT) },
064:
065: { "privateLayout", new Integer(Types.BOOLEAN) },
066:
067: { "layoutId", new Integer(Types.BIGINT) },
068:
069: { "parentLayoutId", new Integer(Types.BIGINT) },
070:
071: { "name", new Integer(Types.VARCHAR) },
072:
073: { "title", new Integer(Types.VARCHAR) },
074:
075: { "description", new Integer(Types.VARCHAR) },
076:
077: { "type_", new Integer(Types.VARCHAR) },
078:
079: { "typeSettings", new Integer(Types.CLOB) },
080:
081: { "hidden_", new Integer(Types.BOOLEAN) },
082:
083: { "friendlyURL", new Integer(Types.VARCHAR) },
084:
085: { "iconImage", new Integer(Types.BOOLEAN) },
086:
087: { "iconImageId", new Integer(Types.BIGINT) },
088:
089: { "themeId", new Integer(Types.VARCHAR) },
090:
091: { "colorSchemeId", new Integer(Types.VARCHAR) },
092:
093: { "wapThemeId", new Integer(Types.VARCHAR) },
094:
095: { "wapColorSchemeId", new Integer(Types.VARCHAR) },
096:
097: { "css", new Integer(Types.VARCHAR) },
098:
099: { "priority", new Integer(Types.INTEGER) },
100:
101: { "dlFolderId", new Integer(Types.BIGINT) } };
102: 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)";
103: public static final String TABLE_SQL_DROP = "drop table Layout";
104: public static final boolean CACHE_ENABLED = GetterUtil
105: .getBoolean(
106: PropsUtil
107: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Layout"),
108: true);
109: public static final long LOCK_EXPIRATION_TIME = GetterUtil
110: .getLong(PropsUtil
111: .get("lock.expiration.time.com.liferay.portal.model.Layout"));
112:
113: public LayoutModelImpl() {
114: }
115:
116: public long getPrimaryKey() {
117: return _plid;
118: }
119:
120: public void setPrimaryKey(long pk) {
121: setPlid(pk);
122: }
123:
124: public Serializable getPrimaryKeyObj() {
125: return new Long(_plid);
126: }
127:
128: public long getPlid() {
129: return _plid;
130: }
131:
132: public void setPlid(long plid) {
133: if (plid != _plid) {
134: _plid = plid;
135: }
136: }
137:
138: public long getGroupId() {
139: return _groupId;
140: }
141:
142: public void setGroupId(long groupId) {
143: if (groupId != _groupId) {
144: _groupId = groupId;
145: }
146: }
147:
148: public long getCompanyId() {
149: return _companyId;
150: }
151:
152: public void setCompanyId(long companyId) {
153: if (companyId != _companyId) {
154: _companyId = companyId;
155: }
156: }
157:
158: public boolean getPrivateLayout() {
159: return _privateLayout;
160: }
161:
162: public boolean isPrivateLayout() {
163: return _privateLayout;
164: }
165:
166: public void setPrivateLayout(boolean privateLayout) {
167: if (privateLayout != _privateLayout) {
168: _privateLayout = privateLayout;
169: }
170: }
171:
172: public long getLayoutId() {
173: return _layoutId;
174: }
175:
176: public void setLayoutId(long layoutId) {
177: if (layoutId != _layoutId) {
178: _layoutId = layoutId;
179: }
180: }
181:
182: public long getParentLayoutId() {
183: return _parentLayoutId;
184: }
185:
186: public void setParentLayoutId(long parentLayoutId) {
187: if (parentLayoutId != _parentLayoutId) {
188: _parentLayoutId = parentLayoutId;
189: }
190: }
191:
192: public String getName() {
193: return GetterUtil.getString(_name);
194: }
195:
196: public void setName(String name) {
197: if (((name == null) && (_name != null))
198: || ((name != null) && (_name == null))
199: || ((name != null) && (_name != null) && !name
200: .equals(_name))) {
201: _name = name;
202: }
203: }
204:
205: public String getTitle() {
206: return GetterUtil.getString(_title);
207: }
208:
209: public void setTitle(String title) {
210: if (((title == null) && (_title != null))
211: || ((title != null) && (_title == null))
212: || ((title != null) && (_title != null) && !title
213: .equals(_title))) {
214: _title = title;
215: }
216: }
217:
218: public String getDescription() {
219: return GetterUtil.getString(_description);
220: }
221:
222: public void setDescription(String description) {
223: if (((description == null) && (_description != null))
224: || ((description != null) && (_description == null))
225: || ((description != null) && (_description != null) && !description
226: .equals(_description))) {
227: _description = description;
228: }
229: }
230:
231: public String getType() {
232: return GetterUtil.getString(_type);
233: }
234:
235: public void setType(String type) {
236: if (((type == null) && (_type != null))
237: || ((type != null) && (_type == null))
238: || ((type != null) && (_type != null) && !type
239: .equals(_type))) {
240: _type = type;
241: }
242: }
243:
244: public String getTypeSettings() {
245: return GetterUtil.getString(_typeSettings);
246: }
247:
248: public void setTypeSettings(String typeSettings) {
249: if (((typeSettings == null) && (_typeSettings != null))
250: || ((typeSettings != null) && (_typeSettings == null))
251: || ((typeSettings != null) && (_typeSettings != null) && !typeSettings
252: .equals(_typeSettings))) {
253: _typeSettings = typeSettings;
254: }
255: }
256:
257: public boolean getHidden() {
258: return _hidden;
259: }
260:
261: public boolean isHidden() {
262: return _hidden;
263: }
264:
265: public void setHidden(boolean hidden) {
266: if (hidden != _hidden) {
267: _hidden = hidden;
268: }
269: }
270:
271: public String getFriendlyURL() {
272: return GetterUtil.getString(_friendlyURL);
273: }
274:
275: public void setFriendlyURL(String friendlyURL) {
276: if (((friendlyURL == null) && (_friendlyURL != null))
277: || ((friendlyURL != null) && (_friendlyURL == null))
278: || ((friendlyURL != null) && (_friendlyURL != null) && !friendlyURL
279: .equals(_friendlyURL))) {
280: _friendlyURL = friendlyURL;
281: }
282: }
283:
284: public boolean getIconImage() {
285: return _iconImage;
286: }
287:
288: public boolean isIconImage() {
289: return _iconImage;
290: }
291:
292: public void setIconImage(boolean iconImage) {
293: if (iconImage != _iconImage) {
294: _iconImage = iconImage;
295: }
296: }
297:
298: public long getIconImageId() {
299: return _iconImageId;
300: }
301:
302: public void setIconImageId(long iconImageId) {
303: if (iconImageId != _iconImageId) {
304: _iconImageId = iconImageId;
305: }
306: }
307:
308: public String getThemeId() {
309: return GetterUtil.getString(_themeId);
310: }
311:
312: public void setThemeId(String themeId) {
313: if (((themeId == null) && (_themeId != null))
314: || ((themeId != null) && (_themeId == null))
315: || ((themeId != null) && (_themeId != null) && !themeId
316: .equals(_themeId))) {
317: _themeId = themeId;
318: }
319: }
320:
321: public String getColorSchemeId() {
322: return GetterUtil.getString(_colorSchemeId);
323: }
324:
325: public void setColorSchemeId(String colorSchemeId) {
326: if (((colorSchemeId == null) && (_colorSchemeId != null))
327: || ((colorSchemeId != null) && (_colorSchemeId == null))
328: || ((colorSchemeId != null) && (_colorSchemeId != null) && !colorSchemeId
329: .equals(_colorSchemeId))) {
330: _colorSchemeId = colorSchemeId;
331: }
332: }
333:
334: public String getWapThemeId() {
335: return GetterUtil.getString(_wapThemeId);
336: }
337:
338: public void setWapThemeId(String wapThemeId) {
339: if (((wapThemeId == null) && (_wapThemeId != null))
340: || ((wapThemeId != null) && (_wapThemeId == null))
341: || ((wapThemeId != null) && (_wapThemeId != null) && !wapThemeId
342: .equals(_wapThemeId))) {
343: _wapThemeId = wapThemeId;
344: }
345: }
346:
347: public String getWapColorSchemeId() {
348: return GetterUtil.getString(_wapColorSchemeId);
349: }
350:
351: public void setWapColorSchemeId(String wapColorSchemeId) {
352: if (((wapColorSchemeId == null) && (_wapColorSchemeId != null))
353: || ((wapColorSchemeId != null) && (_wapColorSchemeId == null))
354: || ((wapColorSchemeId != null)
355: && (_wapColorSchemeId != null) && !wapColorSchemeId
356: .equals(_wapColorSchemeId))) {
357: _wapColorSchemeId = wapColorSchemeId;
358: }
359: }
360:
361: public String getCss() {
362: return GetterUtil.getString(_css);
363: }
364:
365: public void setCss(String css) {
366: if (((css == null) && (_css != null))
367: || ((css != null) && (_css == null))
368: || ((css != null) && (_css != null) && !css
369: .equals(_css))) {
370: _css = css;
371: }
372: }
373:
374: public int getPriority() {
375: return _priority;
376: }
377:
378: public void setPriority(int priority) {
379: if (priority != _priority) {
380: _priority = priority;
381: }
382: }
383:
384: public long getDlFolderId() {
385: return _dlFolderId;
386: }
387:
388: public void setDlFolderId(long dlFolderId) {
389: if (dlFolderId != _dlFolderId) {
390: _dlFolderId = dlFolderId;
391: }
392: }
393:
394: public Layout toEscapedModel() {
395: if (isEscapedModel()) {
396: return (Layout) this ;
397: } else {
398: Layout model = new LayoutImpl();
399:
400: model.setEscapedModel(true);
401:
402: model.setPlid(getPlid());
403: model.setGroupId(getGroupId());
404: model.setCompanyId(getCompanyId());
405: model.setPrivateLayout(getPrivateLayout());
406: model.setLayoutId(getLayoutId());
407: model.setParentLayoutId(getParentLayoutId());
408: model.setName(Html.escape(getName()));
409: model.setTitle(Html.escape(getTitle()));
410: model.setDescription(Html.escape(getDescription()));
411: model.setType(Html.escape(getType()));
412: model.setTypeSettings(Html.escape(getTypeSettings()));
413: model.setHidden(getHidden());
414: model.setFriendlyURL(Html.escape(getFriendlyURL()));
415: model.setIconImage(getIconImage());
416: model.setIconImageId(getIconImageId());
417: model.setThemeId(Html.escape(getThemeId()));
418: model.setColorSchemeId(Html.escape(getColorSchemeId()));
419: model.setWapThemeId(Html.escape(getWapThemeId()));
420: model.setWapColorSchemeId(Html
421: .escape(getWapColorSchemeId()));
422: model.setCss(Html.escape(getCss()));
423: model.setPriority(getPriority());
424: model.setDlFolderId(getDlFolderId());
425:
426: model = (Layout) Proxy.newProxyInstance(Layout.class
427: .getClassLoader(), new Class[] { Layout.class },
428: new ReadOnlyBeanHandler(model));
429:
430: return model;
431: }
432: }
433:
434: public Object clone() {
435: LayoutImpl clone = new LayoutImpl();
436:
437: clone.setPlid(getPlid());
438: clone.setGroupId(getGroupId());
439: clone.setCompanyId(getCompanyId());
440: clone.setPrivateLayout(getPrivateLayout());
441: clone.setLayoutId(getLayoutId());
442: clone.setParentLayoutId(getParentLayoutId());
443: clone.setName(getName());
444: clone.setTitle(getTitle());
445: clone.setDescription(getDescription());
446: clone.setType(getType());
447: clone.setTypeSettings(getTypeSettings());
448: clone.setHidden(getHidden());
449: clone.setFriendlyURL(getFriendlyURL());
450: clone.setIconImage(getIconImage());
451: clone.setIconImageId(getIconImageId());
452: clone.setThemeId(getThemeId());
453: clone.setColorSchemeId(getColorSchemeId());
454: clone.setWapThemeId(getWapThemeId());
455: clone.setWapColorSchemeId(getWapColorSchemeId());
456: clone.setCss(getCss());
457: clone.setPriority(getPriority());
458: clone.setDlFolderId(getDlFolderId());
459:
460: return clone;
461: }
462:
463: public int compareTo(Object obj) {
464: if (obj == null) {
465: return -1;
466: }
467:
468: LayoutImpl layout = (LayoutImpl) obj;
469:
470: int value = 0;
471:
472: if (getParentLayoutId() < layout.getParentLayoutId()) {
473: value = -1;
474: } else if (getParentLayoutId() > layout.getParentLayoutId()) {
475: value = 1;
476: } else {
477: value = 0;
478: }
479:
480: if (value != 0) {
481: return value;
482: }
483:
484: if (getPriority() < layout.getPriority()) {
485: value = -1;
486: } else if (getPriority() > layout.getPriority()) {
487: value = 1;
488: } else {
489: value = 0;
490: }
491:
492: if (value != 0) {
493: return value;
494: }
495:
496: return 0;
497: }
498:
499: public boolean equals(Object obj) {
500: if (obj == null) {
501: return false;
502: }
503:
504: LayoutImpl layout = null;
505:
506: try {
507: layout = (LayoutImpl) obj;
508: } catch (ClassCastException cce) {
509: return false;
510: }
511:
512: long pk = layout.getPrimaryKey();
513:
514: if (getPrimaryKey() == pk) {
515: return true;
516: } else {
517: return false;
518: }
519: }
520:
521: public int hashCode() {
522: return (int) getPrimaryKey();
523: }
524:
525: private long _plid;
526: private long _groupId;
527: private long _companyId;
528: private boolean _privateLayout;
529: private long _layoutId;
530: private long _parentLayoutId;
531: private String _name;
532: private String _title;
533: private String _description;
534: private String _type;
535: private String _typeSettings;
536: private boolean _hidden;
537: private String _friendlyURL;
538: private boolean _iconImage;
539: private long _iconImageId;
540: private String _themeId;
541: private String _colorSchemeId;
542: private String _wapThemeId;
543: private String _wapColorSchemeId;
544: private String _css;
545: private int _priority;
546: private long _dlFolderId;
547: }
|