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.portlet.journal.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.impl.BaseModelImpl;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.portlet.journal.model.JournalArticle;
029:
030: import com.liferay.util.Html;
031:
032: import java.io.Serializable;
033:
034: import java.lang.reflect.Proxy;
035:
036: import java.sql.Types;
037:
038: import java.util.Date;
039:
040: /**
041: * <a href="JournalArticleModelImpl.java.html"><b><i>View Source</i></b></a>
042: *
043: * <p>
044: * ServiceBuilder generated this class. Modifications in this class will be
045: * overwritten the next time is generated.
046: * </p>
047: *
048: * <p>
049: * This class is a model that represents the <code>JournalArticle</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.journal.service.model.JournalArticle
056: * @see com.liferay.portlet.journal.service.model.JournalArticleModel
057: * @see com.liferay.portlet.journal.service.model.impl.JournalArticleImpl
058: *
059: */
060: public class JournalArticleModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "JournalArticle";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "uuid_", new Integer(Types.VARCHAR) },
064:
065: { "id_", new Integer(Types.BIGINT) },
066:
067: { "resourcePrimKey", new Integer(Types.BIGINT) },
068:
069: { "groupId", new Integer(Types.BIGINT) },
070:
071: { "companyId", new Integer(Types.BIGINT) },
072:
073: { "userId", new Integer(Types.BIGINT) },
074:
075: { "userName", new Integer(Types.VARCHAR) },
076:
077: { "createDate", new Integer(Types.TIMESTAMP) },
078:
079: { "modifiedDate", new Integer(Types.TIMESTAMP) },
080:
081: { "articleId", new Integer(Types.VARCHAR) },
082:
083: { "version", new Integer(Types.DOUBLE) },
084:
085: { "title", new Integer(Types.VARCHAR) },
086:
087: { "description", new Integer(Types.VARCHAR) },
088:
089: { "content", new Integer(Types.CLOB) },
090:
091: { "type_", new Integer(Types.VARCHAR) },
092:
093: { "structureId", new Integer(Types.VARCHAR) },
094:
095: { "templateId", new Integer(Types.VARCHAR) },
096:
097: { "displayDate", new Integer(Types.TIMESTAMP) },
098:
099: { "approved", new Integer(Types.BOOLEAN) },
100:
101: { "approvedByUserId", new Integer(Types.BIGINT) },
102:
103: { "approvedByUserName", new Integer(Types.VARCHAR) },
104:
105: { "approvedDate", new Integer(Types.TIMESTAMP) },
106:
107: { "expired", new Integer(Types.BOOLEAN) },
108:
109: { "expirationDate", new Integer(Types.TIMESTAMP) },
110:
111: { "reviewDate", new Integer(Types.TIMESTAMP) },
112:
113: { "indexable", new Integer(Types.BOOLEAN) },
114:
115: { "smallImage", new Integer(Types.BOOLEAN) },
116:
117: { "smallImageId", new Integer(Types.BIGINT) },
118:
119: { "smallImageURL", new Integer(Types.VARCHAR) } };
120: public static final String TABLE_SQL_CREATE = "create table JournalArticle (uuid_ VARCHAR(75) null,id_ LONG not null primary key,resourcePrimKey LONG,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,articleId VARCHAR(75) null,version DOUBLE,title VARCHAR(100) null,description STRING null,content TEXT null,type_ VARCHAR(75) null,structureId VARCHAR(75) null,templateId VARCHAR(75) null,displayDate DATE null,approved BOOLEAN,approvedByUserId LONG,approvedByUserName VARCHAR(75) null,approvedDate DATE null,expired BOOLEAN,expirationDate DATE null,reviewDate DATE null,indexable BOOLEAN,smallImage BOOLEAN,smallImageId LONG,smallImageURL VARCHAR(75) null)";
121: public static final String TABLE_SQL_DROP = "drop table JournalArticle";
122: public static final boolean CACHE_ENABLED = GetterUtil
123: .getBoolean(
124: PropsUtil
125: .get("value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalArticle"),
126: true);
127: public static final long LOCK_EXPIRATION_TIME = GetterUtil
128: .getLong(PropsUtil
129: .get("lock.expiration.time.com.liferay.portlet.journal.model.JournalArticle"));
130:
131: public JournalArticleModelImpl() {
132: }
133:
134: public long getPrimaryKey() {
135: return _id;
136: }
137:
138: public void setPrimaryKey(long pk) {
139: setId(pk);
140: }
141:
142: public Serializable getPrimaryKeyObj() {
143: return new Long(_id);
144: }
145:
146: public String getUuid() {
147: return GetterUtil.getString(_uuid);
148: }
149:
150: public void setUuid(String uuid) {
151: if ((uuid != null) && (uuid != _uuid)) {
152: _uuid = uuid;
153: }
154: }
155:
156: public long getId() {
157: return _id;
158: }
159:
160: public void setId(long id) {
161: if (id != _id) {
162: _id = id;
163: }
164: }
165:
166: public long getResourcePrimKey() {
167: return _resourcePrimKey;
168: }
169:
170: public void setResourcePrimKey(long resourcePrimKey) {
171: if (resourcePrimKey != _resourcePrimKey) {
172: _resourcePrimKey = resourcePrimKey;
173: }
174: }
175:
176: public long getGroupId() {
177: return _groupId;
178: }
179:
180: public void setGroupId(long groupId) {
181: if (groupId != _groupId) {
182: _groupId = groupId;
183: }
184: }
185:
186: public long getCompanyId() {
187: return _companyId;
188: }
189:
190: public void setCompanyId(long companyId) {
191: if (companyId != _companyId) {
192: _companyId = companyId;
193: }
194: }
195:
196: public long getUserId() {
197: return _userId;
198: }
199:
200: public void setUserId(long userId) {
201: if (userId != _userId) {
202: _userId = userId;
203: }
204: }
205:
206: public String getUserName() {
207: return GetterUtil.getString(_userName);
208: }
209:
210: public void setUserName(String userName) {
211: if (((userName == null) && (_userName != null))
212: || ((userName != null) && (_userName == null))
213: || ((userName != null) && (_userName != null) && !userName
214: .equals(_userName))) {
215: _userName = userName;
216: }
217: }
218:
219: public Date getCreateDate() {
220: return _createDate;
221: }
222:
223: public void setCreateDate(Date createDate) {
224: if (((createDate == null) && (_createDate != null))
225: || ((createDate != null) && (_createDate == null))
226: || ((createDate != null) && (_createDate != null) && !createDate
227: .equals(_createDate))) {
228: _createDate = createDate;
229: }
230: }
231:
232: public Date getModifiedDate() {
233: return _modifiedDate;
234: }
235:
236: public void setModifiedDate(Date modifiedDate) {
237: if (((modifiedDate == null) && (_modifiedDate != null))
238: || ((modifiedDate != null) && (_modifiedDate == null))
239: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
240: .equals(_modifiedDate))) {
241: _modifiedDate = modifiedDate;
242: }
243: }
244:
245: public String getArticleId() {
246: return GetterUtil.getString(_articleId);
247: }
248:
249: public void setArticleId(String articleId) {
250: if (((articleId == null) && (_articleId != null))
251: || ((articleId != null) && (_articleId == null))
252: || ((articleId != null) && (_articleId != null) && !articleId
253: .equals(_articleId))) {
254: _articleId = articleId;
255: }
256: }
257:
258: public double getVersion() {
259: return _version;
260: }
261:
262: public void setVersion(double version) {
263: if (version != _version) {
264: _version = version;
265: }
266: }
267:
268: public String getTitle() {
269: return GetterUtil.getString(_title);
270: }
271:
272: public void setTitle(String title) {
273: if (((title == null) && (_title != null))
274: || ((title != null) && (_title == null))
275: || ((title != null) && (_title != null) && !title
276: .equals(_title))) {
277: _title = title;
278: }
279: }
280:
281: public String getDescription() {
282: return GetterUtil.getString(_description);
283: }
284:
285: public void setDescription(String description) {
286: if (((description == null) && (_description != null))
287: || ((description != null) && (_description == null))
288: || ((description != null) && (_description != null) && !description
289: .equals(_description))) {
290: _description = description;
291: }
292: }
293:
294: public String getContent() {
295: return GetterUtil.getString(_content);
296: }
297:
298: public void setContent(String content) {
299: if (((content == null) && (_content != null))
300: || ((content != null) && (_content == null))
301: || ((content != null) && (_content != null) && !content
302: .equals(_content))) {
303: _content = content;
304: }
305: }
306:
307: public String getType() {
308: return GetterUtil.getString(_type);
309: }
310:
311: public void setType(String type) {
312: if (((type == null) && (_type != null))
313: || ((type != null) && (_type == null))
314: || ((type != null) && (_type != null) && !type
315: .equals(_type))) {
316: _type = type;
317: }
318: }
319:
320: public String getStructureId() {
321: return GetterUtil.getString(_structureId);
322: }
323:
324: public void setStructureId(String structureId) {
325: if (((structureId == null) && (_structureId != null))
326: || ((structureId != null) && (_structureId == null))
327: || ((structureId != null) && (_structureId != null) && !structureId
328: .equals(_structureId))) {
329: _structureId = structureId;
330: }
331: }
332:
333: public String getTemplateId() {
334: return GetterUtil.getString(_templateId);
335: }
336:
337: public void setTemplateId(String templateId) {
338: if (((templateId == null) && (_templateId != null))
339: || ((templateId != null) && (_templateId == null))
340: || ((templateId != null) && (_templateId != null) && !templateId
341: .equals(_templateId))) {
342: _templateId = templateId;
343: }
344: }
345:
346: public Date getDisplayDate() {
347: return _displayDate;
348: }
349:
350: public void setDisplayDate(Date displayDate) {
351: if (((displayDate == null) && (_displayDate != null))
352: || ((displayDate != null) && (_displayDate == null))
353: || ((displayDate != null) && (_displayDate != null) && !displayDate
354: .equals(_displayDate))) {
355: _displayDate = displayDate;
356: }
357: }
358:
359: public boolean getApproved() {
360: return _approved;
361: }
362:
363: public boolean isApproved() {
364: return _approved;
365: }
366:
367: public void setApproved(boolean approved) {
368: if (approved != _approved) {
369: _approved = approved;
370: }
371: }
372:
373: public long getApprovedByUserId() {
374: return _approvedByUserId;
375: }
376:
377: public void setApprovedByUserId(long approvedByUserId) {
378: if (approvedByUserId != _approvedByUserId) {
379: _approvedByUserId = approvedByUserId;
380: }
381: }
382:
383: public String getApprovedByUserName() {
384: return GetterUtil.getString(_approvedByUserName);
385: }
386:
387: public void setApprovedByUserName(String approvedByUserName) {
388: if (((approvedByUserName == null) && (_approvedByUserName != null))
389: || ((approvedByUserName != null) && (_approvedByUserName == null))
390: || ((approvedByUserName != null)
391: && (_approvedByUserName != null) && !approvedByUserName
392: .equals(_approvedByUserName))) {
393: _approvedByUserName = approvedByUserName;
394: }
395: }
396:
397: public Date getApprovedDate() {
398: return _approvedDate;
399: }
400:
401: public void setApprovedDate(Date approvedDate) {
402: if (((approvedDate == null) && (_approvedDate != null))
403: || ((approvedDate != null) && (_approvedDate == null))
404: || ((approvedDate != null) && (_approvedDate != null) && !approvedDate
405: .equals(_approvedDate))) {
406: _approvedDate = approvedDate;
407: }
408: }
409:
410: public boolean getExpired() {
411: return _expired;
412: }
413:
414: public boolean isExpired() {
415: return _expired;
416: }
417:
418: public void setExpired(boolean expired) {
419: if (expired != _expired) {
420: _expired = expired;
421: }
422: }
423:
424: public Date getExpirationDate() {
425: return _expirationDate;
426: }
427:
428: public void setExpirationDate(Date expirationDate) {
429: if (((expirationDate == null) && (_expirationDate != null))
430: || ((expirationDate != null) && (_expirationDate == null))
431: || ((expirationDate != null)
432: && (_expirationDate != null) && !expirationDate
433: .equals(_expirationDate))) {
434: _expirationDate = expirationDate;
435: }
436: }
437:
438: public Date getReviewDate() {
439: return _reviewDate;
440: }
441:
442: public void setReviewDate(Date reviewDate) {
443: if (((reviewDate == null) && (_reviewDate != null))
444: || ((reviewDate != null) && (_reviewDate == null))
445: || ((reviewDate != null) && (_reviewDate != null) && !reviewDate
446: .equals(_reviewDate))) {
447: _reviewDate = reviewDate;
448: }
449: }
450:
451: public boolean getIndexable() {
452: return _indexable;
453: }
454:
455: public boolean isIndexable() {
456: return _indexable;
457: }
458:
459: public void setIndexable(boolean indexable) {
460: if (indexable != _indexable) {
461: _indexable = indexable;
462: }
463: }
464:
465: public boolean getSmallImage() {
466: return _smallImage;
467: }
468:
469: public boolean isSmallImage() {
470: return _smallImage;
471: }
472:
473: public void setSmallImage(boolean smallImage) {
474: if (smallImage != _smallImage) {
475: _smallImage = smallImage;
476: }
477: }
478:
479: public long getSmallImageId() {
480: return _smallImageId;
481: }
482:
483: public void setSmallImageId(long smallImageId) {
484: if (smallImageId != _smallImageId) {
485: _smallImageId = smallImageId;
486: }
487: }
488:
489: public String getSmallImageURL() {
490: return GetterUtil.getString(_smallImageURL);
491: }
492:
493: public void setSmallImageURL(String smallImageURL) {
494: if (((smallImageURL == null) && (_smallImageURL != null))
495: || ((smallImageURL != null) && (_smallImageURL == null))
496: || ((smallImageURL != null) && (_smallImageURL != null) && !smallImageURL
497: .equals(_smallImageURL))) {
498: _smallImageURL = smallImageURL;
499: }
500: }
501:
502: public JournalArticle toEscapedModel() {
503: if (isEscapedModel()) {
504: return (JournalArticle) this ;
505: } else {
506: JournalArticle model = new JournalArticleImpl();
507:
508: model.setEscapedModel(true);
509:
510: model.setUuid(Html.escape(getUuid()));
511: model.setId(getId());
512: model.setResourcePrimKey(getResourcePrimKey());
513: model.setGroupId(getGroupId());
514: model.setCompanyId(getCompanyId());
515: model.setUserId(getUserId());
516: model.setUserName(Html.escape(getUserName()));
517: model.setCreateDate(getCreateDate());
518: model.setModifiedDate(getModifiedDate());
519: model.setArticleId(getArticleId());
520: model.setVersion(getVersion());
521: model.setTitle(Html.escape(getTitle()));
522: model.setDescription(Html.escape(getDescription()));
523: model.setContent(Html.escape(getContent()));
524: model.setType(Html.escape(getType()));
525: model.setStructureId(getStructureId());
526: model.setTemplateId(getTemplateId());
527: model.setDisplayDate(getDisplayDate());
528: model.setApproved(getApproved());
529: model.setApprovedByUserId(getApprovedByUserId());
530: model.setApprovedByUserName(Html
531: .escape(getApprovedByUserName()));
532: model.setApprovedDate(getApprovedDate());
533: model.setExpired(getExpired());
534: model.setExpirationDate(getExpirationDate());
535: model.setReviewDate(getReviewDate());
536: model.setIndexable(getIndexable());
537: model.setSmallImage(getSmallImage());
538: model.setSmallImageId(getSmallImageId());
539: model.setSmallImageURL(Html.escape(getSmallImageURL()));
540:
541: model = (JournalArticle) Proxy.newProxyInstance(
542: JournalArticle.class.getClassLoader(),
543: new Class[] { JournalArticle.class },
544: new ReadOnlyBeanHandler(model));
545:
546: return model;
547: }
548: }
549:
550: public Object clone() {
551: JournalArticleImpl clone = new JournalArticleImpl();
552:
553: clone.setUuid(getUuid());
554: clone.setId(getId());
555: clone.setResourcePrimKey(getResourcePrimKey());
556: clone.setGroupId(getGroupId());
557: clone.setCompanyId(getCompanyId());
558: clone.setUserId(getUserId());
559: clone.setUserName(getUserName());
560: clone.setCreateDate(getCreateDate());
561: clone.setModifiedDate(getModifiedDate());
562: clone.setArticleId(getArticleId());
563: clone.setVersion(getVersion());
564: clone.setTitle(getTitle());
565: clone.setDescription(getDescription());
566: clone.setContent(getContent());
567: clone.setType(getType());
568: clone.setStructureId(getStructureId());
569: clone.setTemplateId(getTemplateId());
570: clone.setDisplayDate(getDisplayDate());
571: clone.setApproved(getApproved());
572: clone.setApprovedByUserId(getApprovedByUserId());
573: clone.setApprovedByUserName(getApprovedByUserName());
574: clone.setApprovedDate(getApprovedDate());
575: clone.setExpired(getExpired());
576: clone.setExpirationDate(getExpirationDate());
577: clone.setReviewDate(getReviewDate());
578: clone.setIndexable(getIndexable());
579: clone.setSmallImage(getSmallImage());
580: clone.setSmallImageId(getSmallImageId());
581: clone.setSmallImageURL(getSmallImageURL());
582:
583: return clone;
584: }
585:
586: public int compareTo(Object obj) {
587: if (obj == null) {
588: return -1;
589: }
590:
591: JournalArticleImpl journalArticle = (JournalArticleImpl) obj;
592:
593: int value = 0;
594:
595: value = getArticleId().compareTo(journalArticle.getArticleId());
596:
597: if (value != 0) {
598: return value;
599: }
600:
601: if (getVersion() < journalArticle.getVersion()) {
602: value = -1;
603: } else if (getVersion() > journalArticle.getVersion()) {
604: value = 1;
605: } else {
606: value = 0;
607: }
608:
609: value = value * -1;
610:
611: if (value != 0) {
612: return value;
613: }
614:
615: return 0;
616: }
617:
618: public boolean equals(Object obj) {
619: if (obj == null) {
620: return false;
621: }
622:
623: JournalArticleImpl journalArticle = null;
624:
625: try {
626: journalArticle = (JournalArticleImpl) obj;
627: } catch (ClassCastException cce) {
628: return false;
629: }
630:
631: long pk = journalArticle.getPrimaryKey();
632:
633: if (getPrimaryKey() == pk) {
634: return true;
635: } else {
636: return false;
637: }
638: }
639:
640: public int hashCode() {
641: return (int) getPrimaryKey();
642: }
643:
644: private String _uuid;
645: private long _id;
646: private long _resourcePrimKey;
647: private long _groupId;
648: private long _companyId;
649: private long _userId;
650: private String _userName;
651: private Date _createDate;
652: private Date _modifiedDate;
653: private String _articleId;
654: private double _version;
655: private String _title;
656: private String _description;
657: private String _content;
658: private String _type;
659: private String _structureId;
660: private String _templateId;
661: private Date _displayDate;
662: private boolean _approved;
663: private long _approvedByUserId;
664: private String _approvedByUserName;
665: private Date _approvedDate;
666: private boolean _expired;
667: private Date _expirationDate;
668: private Date _reviewDate;
669: private boolean _indexable;
670: private boolean _smallImage;
671: private long _smallImageId;
672: private String _smallImageURL;
673: }
|