1
22
23 package com.liferay.portlet.journal.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import com.liferay.util.XSSUtil;
30
31 import java.io.Serializable;
32
33 import java.sql.Types;
34
35 import java.util.Date;
36
37
57 public class JournalArticleModelImpl extends BaseModelImpl {
58 public static String TABLE_NAME = "JournalArticle";
59 public static Object[][] TABLE_COLUMNS = {
60 { "id_", new Integer(Types.BIGINT) },
61 { "resourcePrimKey", new Integer(Types.BIGINT) },
62 { "groupId", new Integer(Types.BIGINT) },
63 { "companyId", new Integer(Types.BIGINT) },
64 { "userId", new Integer(Types.BIGINT) },
65 { "userName", new Integer(Types.VARCHAR) },
66 { "createDate", new Integer(Types.TIMESTAMP) },
67 { "modifiedDate", new Integer(Types.TIMESTAMP) },
68 { "articleId", new Integer(Types.VARCHAR) },
69 { "version", new Integer(Types.DOUBLE) },
70 { "title", new Integer(Types.VARCHAR) },
71 { "description", new Integer(Types.VARCHAR) },
72 { "content", new Integer(Types.CLOB) },
73 { "type_", new Integer(Types.VARCHAR) },
74 { "structureId", new Integer(Types.VARCHAR) },
75 { "templateId", new Integer(Types.VARCHAR) },
76 { "displayDate", new Integer(Types.TIMESTAMP) },
77 { "approved", new Integer(Types.BOOLEAN) },
78 { "approvedByUserId", new Integer(Types.BIGINT) },
79 { "approvedByUserName", new Integer(Types.VARCHAR) },
80 { "approvedDate", new Integer(Types.TIMESTAMP) },
81 { "expired", new Integer(Types.BOOLEAN) },
82 { "expirationDate", new Integer(Types.TIMESTAMP) },
83 { "reviewDate", new Integer(Types.TIMESTAMP) },
84 { "indexable", new Integer(Types.BOOLEAN) }
85 };
86 public static String TABLE_SQL_CREATE = "create table JournalArticle (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)";
87 public static String TABLE_SQL_DROP = "drop table JournalArticle";
88 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
89 "xss.allow.com.liferay.portlet.journal.model.JournalArticle"),
90 XSS_ALLOW);
91 public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
92 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.userName"),
93 XSS_ALLOW_BY_MODEL);
94 public static boolean XSS_ALLOW_ARTICLEID = GetterUtil.getBoolean(PropsUtil.get(
95 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.articleId"),
96 XSS_ALLOW_BY_MODEL);
97 public static boolean XSS_ALLOW_TITLE = GetterUtil.getBoolean(PropsUtil.get(
98 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.title"),
99 XSS_ALLOW_BY_MODEL);
100 public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
101 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.description"),
102 XSS_ALLOW_BY_MODEL);
103 public static boolean XSS_ALLOW_CONTENT = GetterUtil.getBoolean(PropsUtil.get(
104 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.content"),
105 XSS_ALLOW_BY_MODEL);
106 public static boolean XSS_ALLOW_TYPE = GetterUtil.getBoolean(PropsUtil.get(
107 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.type"),
108 XSS_ALLOW_BY_MODEL);
109 public static boolean XSS_ALLOW_STRUCTUREID = GetterUtil.getBoolean(PropsUtil.get(
110 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.structureId"),
111 XSS_ALLOW_BY_MODEL);
112 public static boolean XSS_ALLOW_TEMPLATEID = GetterUtil.getBoolean(PropsUtil.get(
113 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.templateId"),
114 XSS_ALLOW_BY_MODEL);
115 public static boolean XSS_ALLOW_APPROVEDBYUSERNAME = GetterUtil.getBoolean(PropsUtil.get(
116 "xss.allow.com.liferay.portlet.journal.model.JournalArticle.approvedByUserName"),
117 XSS_ALLOW_BY_MODEL);
118 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
119 "lock.expiration.time.com.liferay.portlet.journal.model.JournalArticleModel"));
120
121 public JournalArticleModelImpl() {
122 }
123
124 public long getPrimaryKey() {
125 return _id;
126 }
127
128 public void setPrimaryKey(long pk) {
129 setId(pk);
130 }
131
132 public Serializable getPrimaryKeyObj() {
133 return new Long(_id);
134 }
135
136 public long getId() {
137 return _id;
138 }
139
140 public void setId(long id) {
141 if (id != _id) {
142 _id = id;
143 }
144 }
145
146 public long getResourcePrimKey() {
147 return _resourcePrimKey;
148 }
149
150 public void setResourcePrimKey(long resourcePrimKey) {
151 if (resourcePrimKey != _resourcePrimKey) {
152 _resourcePrimKey = resourcePrimKey;
153 }
154 }
155
156 public long getGroupId() {
157 return _groupId;
158 }
159
160 public void setGroupId(long groupId) {
161 if (groupId != _groupId) {
162 _groupId = groupId;
163 }
164 }
165
166 public long getCompanyId() {
167 return _companyId;
168 }
169
170 public void setCompanyId(long companyId) {
171 if (companyId != _companyId) {
172 _companyId = companyId;
173 }
174 }
175
176 public long getUserId() {
177 return _userId;
178 }
179
180 public void setUserId(long userId) {
181 if (userId != _userId) {
182 _userId = userId;
183 }
184 }
185
186 public String getUserName() {
187 return GetterUtil.getString(_userName);
188 }
189
190 public void setUserName(String userName) {
191 if (((userName == null) && (_userName != null)) ||
192 ((userName != null) && (_userName == null)) ||
193 ((userName != null) && (_userName != null) &&
194 !userName.equals(_userName))) {
195 if (!XSS_ALLOW_USERNAME) {
196 userName = XSSUtil.strip(userName);
197 }
198
199 _userName = userName;
200 }
201 }
202
203 public Date getCreateDate() {
204 return _createDate;
205 }
206
207 public void setCreateDate(Date createDate) {
208 if (((createDate == null) && (_createDate != null)) ||
209 ((createDate != null) && (_createDate == null)) ||
210 ((createDate != null) && (_createDate != null) &&
211 !createDate.equals(_createDate))) {
212 _createDate = createDate;
213 }
214 }
215
216 public Date getModifiedDate() {
217 return _modifiedDate;
218 }
219
220 public void setModifiedDate(Date modifiedDate) {
221 if (((modifiedDate == null) && (_modifiedDate != null)) ||
222 ((modifiedDate != null) && (_modifiedDate == null)) ||
223 ((modifiedDate != null) && (_modifiedDate != null) &&
224 !modifiedDate.equals(_modifiedDate))) {
225 _modifiedDate = modifiedDate;
226 }
227 }
228
229 public String getArticleId() {
230 return GetterUtil.getString(_articleId);
231 }
232
233 public void setArticleId(String articleId) {
234 if (((articleId == null) && (_articleId != null)) ||
235 ((articleId != null) && (_articleId == null)) ||
236 ((articleId != null) && (_articleId != null) &&
237 !articleId.equals(_articleId))) {
238 if (!XSS_ALLOW_ARTICLEID) {
239 articleId = XSSUtil.strip(articleId);
240 }
241
242 _articleId = articleId;
243 }
244 }
245
246 public double getVersion() {
247 return _version;
248 }
249
250 public void setVersion(double version) {
251 if (version != _version) {
252 _version = version;
253 }
254 }
255
256 public String getTitle() {
257 return GetterUtil.getString(_title);
258 }
259
260 public void setTitle(String title) {
261 if (((title == null) && (_title != null)) ||
262 ((title != null) && (_title == null)) ||
263 ((title != null) && (_title != null) && !title.equals(_title))) {
264 if (!XSS_ALLOW_TITLE) {
265 title = XSSUtil.strip(title);
266 }
267
268 _title = title;
269 }
270 }
271
272 public String getDescription() {
273 return GetterUtil.getString(_description);
274 }
275
276 public void setDescription(String description) {
277 if (((description == null) && (_description != null)) ||
278 ((description != null) && (_description == null)) ||
279 ((description != null) && (_description != null) &&
280 !description.equals(_description))) {
281 if (!XSS_ALLOW_DESCRIPTION) {
282 description = XSSUtil.strip(description);
283 }
284
285 _description = description;
286 }
287 }
288
289 public String getContent() {
290 return GetterUtil.getString(_content);
291 }
292
293 public void setContent(String content) {
294 if (((content == null) && (_content != null)) ||
295 ((content != null) && (_content == null)) ||
296 ((content != null) && (_content != null) &&
297 !content.equals(_content))) {
298 if (!XSS_ALLOW_CONTENT) {
299 content = XSSUtil.strip(content);
300 }
301
302 _content = content;
303 }
304 }
305
306 public String getType() {
307 return GetterUtil.getString(_type);
308 }
309
310 public void setType(String type) {
311 if (((type == null) && (_type != null)) ||
312 ((type != null) && (_type == null)) ||
313 ((type != null) && (_type != null) && !type.equals(_type))) {
314 if (!XSS_ALLOW_TYPE) {
315 type = XSSUtil.strip(type);
316 }
317
318 _type = type;
319 }
320 }
321
322 public String getStructureId() {
323 return GetterUtil.getString(_structureId);
324 }
325
326 public void setStructureId(String structureId) {
327 if (((structureId == null) && (_structureId != null)) ||
328 ((structureId != null) && (_structureId == null)) ||
329 ((structureId != null) && (_structureId != null) &&
330 !structureId.equals(_structureId))) {
331 if (!XSS_ALLOW_STRUCTUREID) {
332 structureId = XSSUtil.strip(structureId);
333 }
334
335 _structureId = structureId;
336 }
337 }
338
339 public String getTemplateId() {
340 return GetterUtil.getString(_templateId);
341 }
342
343 public void setTemplateId(String templateId) {
344 if (((templateId == null) && (_templateId != null)) ||
345 ((templateId != null) && (_templateId == null)) ||
346 ((templateId != null) && (_templateId != null) &&
347 !templateId.equals(_templateId))) {
348 if (!XSS_ALLOW_TEMPLATEID) {
349 templateId = XSSUtil.strip(templateId);
350 }
351
352 _templateId = templateId;
353 }
354 }
355
356 public Date getDisplayDate() {
357 return _displayDate;
358 }
359
360 public void setDisplayDate(Date displayDate) {
361 if (((displayDate == null) && (_displayDate != null)) ||
362 ((displayDate != null) && (_displayDate == null)) ||
363 ((displayDate != null) && (_displayDate != null) &&
364 !displayDate.equals(_displayDate))) {
365 _displayDate = displayDate;
366 }
367 }
368
369 public boolean getApproved() {
370 return _approved;
371 }
372
373 public boolean isApproved() {
374 return _approved;
375 }
376
377 public void setApproved(boolean approved) {
378 if (approved != _approved) {
379 _approved = approved;
380 }
381 }
382
383 public long getApprovedByUserId() {
384 return _approvedByUserId;
385 }
386
387 public void setApprovedByUserId(long approvedByUserId) {
388 if (approvedByUserId != _approvedByUserId) {
389 _approvedByUserId = approvedByUserId;
390 }
391 }
392
393 public String getApprovedByUserName() {
394 return GetterUtil.getString(_approvedByUserName);
395 }
396
397 public void setApprovedByUserName(String approvedByUserName) {
398 if (((approvedByUserName == null) && (_approvedByUserName != null)) ||
399 ((approvedByUserName != null) && (_approvedByUserName == null)) ||
400 ((approvedByUserName != null) && (_approvedByUserName != null) &&
401 !approvedByUserName.equals(_approvedByUserName))) {
402 if (!XSS_ALLOW_APPROVEDBYUSERNAME) {
403 approvedByUserName = XSSUtil.strip(approvedByUserName);
404 }
405
406 _approvedByUserName = approvedByUserName;
407 }
408 }
409
410 public Date getApprovedDate() {
411 return _approvedDate;
412 }
413
414 public void setApprovedDate(Date approvedDate) {
415 if (((approvedDate == null) && (_approvedDate != null)) ||
416 ((approvedDate != null) && (_approvedDate == null)) ||
417 ((approvedDate != null) && (_approvedDate != null) &&
418 !approvedDate.equals(_approvedDate))) {
419 _approvedDate = approvedDate;
420 }
421 }
422
423 public boolean getExpired() {
424 return _expired;
425 }
426
427 public boolean isExpired() {
428 return _expired;
429 }
430
431 public void setExpired(boolean expired) {
432 if (expired != _expired) {
433 _expired = expired;
434 }
435 }
436
437 public Date getExpirationDate() {
438 return _expirationDate;
439 }
440
441 public void setExpirationDate(Date expirationDate) {
442 if (((expirationDate == null) && (_expirationDate != null)) ||
443 ((expirationDate != null) && (_expirationDate == null)) ||
444 ((expirationDate != null) && (_expirationDate != null) &&
445 !expirationDate.equals(_expirationDate))) {
446 _expirationDate = expirationDate;
447 }
448 }
449
450 public Date getReviewDate() {
451 return _reviewDate;
452 }
453
454 public void setReviewDate(Date reviewDate) {
455 if (((reviewDate == null) && (_reviewDate != null)) ||
456 ((reviewDate != null) && (_reviewDate == null)) ||
457 ((reviewDate != null) && (_reviewDate != null) &&
458 !reviewDate.equals(_reviewDate))) {
459 _reviewDate = reviewDate;
460 }
461 }
462
463 public boolean getIndexable() {
464 return _indexable;
465 }
466
467 public boolean isIndexable() {
468 return _indexable;
469 }
470
471 public void setIndexable(boolean indexable) {
472 if (indexable != _indexable) {
473 _indexable = indexable;
474 }
475 }
476
477 public Object clone() {
478 JournalArticleImpl clone = new JournalArticleImpl();
479 clone.setId(getId());
480 clone.setResourcePrimKey(getResourcePrimKey());
481 clone.setGroupId(getGroupId());
482 clone.setCompanyId(getCompanyId());
483 clone.setUserId(getUserId());
484 clone.setUserName(getUserName());
485 clone.setCreateDate(getCreateDate());
486 clone.setModifiedDate(getModifiedDate());
487 clone.setArticleId(getArticleId());
488 clone.setVersion(getVersion());
489 clone.setTitle(getTitle());
490 clone.setDescription(getDescription());
491 clone.setContent(getContent());
492 clone.setType(getType());
493 clone.setStructureId(getStructureId());
494 clone.setTemplateId(getTemplateId());
495 clone.setDisplayDate(getDisplayDate());
496 clone.setApproved(getApproved());
497 clone.setApprovedByUserId(getApprovedByUserId());
498 clone.setApprovedByUserName(getApprovedByUserName());
499 clone.setApprovedDate(getApprovedDate());
500 clone.setExpired(getExpired());
501 clone.setExpirationDate(getExpirationDate());
502 clone.setReviewDate(getReviewDate());
503 clone.setIndexable(getIndexable());
504
505 return clone;
506 }
507
508 public int compareTo(Object obj) {
509 if (obj == null) {
510 return -1;
511 }
512
513 JournalArticleImpl journalArticle = (JournalArticleImpl)obj;
514 int value = 0;
515 value = getArticleId().compareTo(journalArticle.getArticleId());
516
517 if (value != 0) {
518 return value;
519 }
520
521 if (getVersion() < journalArticle.getVersion()) {
522 value = -1;
523 }
524 else if (getVersion() > journalArticle.getVersion()) {
525 value = 1;
526 }
527 else {
528 value = 0;
529 }
530
531 value = value * -1;
532
533 if (value != 0) {
534 return value;
535 }
536
537 return 0;
538 }
539
540 public boolean equals(Object obj) {
541 if (obj == null) {
542 return false;
543 }
544
545 JournalArticleImpl journalArticle = null;
546
547 try {
548 journalArticle = (JournalArticleImpl)obj;
549 }
550 catch (ClassCastException cce) {
551 return false;
552 }
553
554 long pk = journalArticle.getPrimaryKey();
555
556 if (getPrimaryKey() == pk) {
557 return true;
558 }
559 else {
560 return false;
561 }
562 }
563
564 public int hashCode() {
565 return (int)getPrimaryKey();
566 }
567
568 private long _id;
569 private long _resourcePrimKey;
570 private long _groupId;
571 private long _companyId;
572 private long _userId;
573 private String _userName;
574 private Date _createDate;
575 private Date _modifiedDate;
576 private String _articleId;
577 private double _version;
578 private String _title;
579 private String _description;
580 private String _content;
581 private String _type;
582 private String _structureId;
583 private String _templateId;
584 private Date _displayDate;
585 private boolean _approved;
586 private long _approvedByUserId;
587 private String _approvedByUserName;
588 private Date _approvedDate;
589 private boolean _expired;
590 private Date _expirationDate;
591 private Date _reviewDate;
592 private boolean _indexable;
593 }