1
22
23 package com.liferay.portlet.announcements.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.kernel.util.StringPool;
30 import com.liferay.portal.model.impl.BaseModelImpl;
31 import com.liferay.portal.util.PortalUtil;
32
33 import com.liferay.portlet.announcements.model.AnnouncementsEntry;
34 import com.liferay.portlet.announcements.model.AnnouncementsEntrySoap;
35 import com.liferay.portlet.expando.model.ExpandoBridge;
36 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
37
38 import java.io.Serializable;
39
40 import java.lang.reflect.Proxy;
41
42 import java.sql.Types;
43
44 import java.util.ArrayList;
45 import java.util.Date;
46 import java.util.List;
47
48
68 public class AnnouncementsEntryModelImpl extends BaseModelImpl {
69 public static final String TABLE_NAME = "AnnouncementsEntry";
70 public static final Object[][] TABLE_COLUMNS = {
71 { "uuid_", new Integer(Types.VARCHAR) },
72
73
74 { "entryId", new Integer(Types.BIGINT) },
75
76
77 { "companyId", new Integer(Types.BIGINT) },
78
79
80 { "userId", new Integer(Types.BIGINT) },
81
82
83 { "userName", new Integer(Types.VARCHAR) },
84
85
86 { "createDate", new Integer(Types.TIMESTAMP) },
87
88
89 { "modifiedDate", new Integer(Types.TIMESTAMP) },
90
91
92 { "classNameId", new Integer(Types.BIGINT) },
93
94
95 { "classPK", new Integer(Types.BIGINT) },
96
97
98 { "title", new Integer(Types.VARCHAR) },
99
100
101 { "content", new Integer(Types.VARCHAR) },
102
103
104 { "url", new Integer(Types.VARCHAR) },
105
106
107 { "type_", new Integer(Types.VARCHAR) },
108
109
110 { "displayDate", new Integer(Types.TIMESTAMP) },
111
112
113 { "expirationDate", new Integer(Types.TIMESTAMP) },
114
115
116 { "priority", new Integer(Types.INTEGER) },
117
118
119 { "alert", new Integer(Types.BOOLEAN) }
120 };
121 public static final String TABLE_SQL_CREATE = "create table AnnouncementsEntry (uuid_ VARCHAR(75) null,entryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,title VARCHAR(75) null,content STRING null,url STRING null,type_ VARCHAR(75) null,displayDate DATE null,expirationDate DATE null,priority INTEGER,alert BOOLEAN)";
122 public static final String TABLE_SQL_DROP = "drop table AnnouncementsEntry";
123 public static final String DATA_SOURCE = "liferayDataSource";
124 public static final String SESSION_FACTORY = "liferaySessionFactory";
125 public static final String TX_MANAGER = "liferayTransactionManager";
126 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
127 "value.object.finder.cache.enabled.com.liferay.portlet.announcements.model.AnnouncementsEntry"),
128 true);
129
130 public static AnnouncementsEntry toModel(AnnouncementsEntrySoap soapModel) {
131 AnnouncementsEntry model = new AnnouncementsEntryImpl();
132
133 model.setUuid(soapModel.getUuid());
134 model.setEntryId(soapModel.getEntryId());
135 model.setCompanyId(soapModel.getCompanyId());
136 model.setUserId(soapModel.getUserId());
137 model.setUserName(soapModel.getUserName());
138 model.setCreateDate(soapModel.getCreateDate());
139 model.setModifiedDate(soapModel.getModifiedDate());
140 model.setClassNameId(soapModel.getClassNameId());
141 model.setClassPK(soapModel.getClassPK());
142 model.setTitle(soapModel.getTitle());
143 model.setContent(soapModel.getContent());
144 model.setUrl(soapModel.getUrl());
145 model.setType(soapModel.getType());
146 model.setDisplayDate(soapModel.getDisplayDate());
147 model.setExpirationDate(soapModel.getExpirationDate());
148 model.setPriority(soapModel.getPriority());
149 model.setAlert(soapModel.getAlert());
150
151 return model;
152 }
153
154 public static List<AnnouncementsEntry> toModels(
155 AnnouncementsEntrySoap[] soapModels) {
156 List<AnnouncementsEntry> models = new ArrayList<AnnouncementsEntry>(soapModels.length);
157
158 for (AnnouncementsEntrySoap soapModel : soapModels) {
159 models.add(toModel(soapModel));
160 }
161
162 return models;
163 }
164
165 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
166 "lock.expiration.time.com.liferay.portlet.announcements.model.AnnouncementsEntry"));
167
168 public AnnouncementsEntryModelImpl() {
169 }
170
171 public long getPrimaryKey() {
172 return _entryId;
173 }
174
175 public void setPrimaryKey(long pk) {
176 setEntryId(pk);
177 }
178
179 public Serializable getPrimaryKeyObj() {
180 return new Long(_entryId);
181 }
182
183 public String getUuid() {
184 return GetterUtil.getString(_uuid);
185 }
186
187 public void setUuid(String uuid) {
188 if ((uuid != null) && (uuid != _uuid)) {
189 _uuid = uuid;
190 }
191 }
192
193 public long getEntryId() {
194 return _entryId;
195 }
196
197 public void setEntryId(long entryId) {
198 if (entryId != _entryId) {
199 _entryId = entryId;
200 }
201 }
202
203 public long getCompanyId() {
204 return _companyId;
205 }
206
207 public void setCompanyId(long companyId) {
208 if (companyId != _companyId) {
209 _companyId = companyId;
210 }
211 }
212
213 public long getUserId() {
214 return _userId;
215 }
216
217 public void setUserId(long userId) {
218 if (userId != _userId) {
219 _userId = userId;
220 }
221 }
222
223 public String getUserName() {
224 return GetterUtil.getString(_userName);
225 }
226
227 public void setUserName(String userName) {
228 if (((userName == null) && (_userName != null)) ||
229 ((userName != null) && (_userName == null)) ||
230 ((userName != null) && (_userName != null) &&
231 !userName.equals(_userName))) {
232 _userName = userName;
233 }
234 }
235
236 public Date getCreateDate() {
237 return _createDate;
238 }
239
240 public void setCreateDate(Date createDate) {
241 if (((createDate == null) && (_createDate != null)) ||
242 ((createDate != null) && (_createDate == null)) ||
243 ((createDate != null) && (_createDate != null) &&
244 !createDate.equals(_createDate))) {
245 _createDate = createDate;
246 }
247 }
248
249 public Date getModifiedDate() {
250 return _modifiedDate;
251 }
252
253 public void setModifiedDate(Date modifiedDate) {
254 if (((modifiedDate == null) && (_modifiedDate != null)) ||
255 ((modifiedDate != null) && (_modifiedDate == null)) ||
256 ((modifiedDate != null) && (_modifiedDate != null) &&
257 !modifiedDate.equals(_modifiedDate))) {
258 _modifiedDate = modifiedDate;
259 }
260 }
261
262 public String getClassName() {
263 if (getClassNameId() <= 0) {
264 return StringPool.BLANK;
265 }
266
267 return PortalUtil.getClassName(getClassNameId());
268 }
269
270 public long getClassNameId() {
271 return _classNameId;
272 }
273
274 public void setClassNameId(long classNameId) {
275 if (classNameId != _classNameId) {
276 _classNameId = classNameId;
277 }
278 }
279
280 public long getClassPK() {
281 return _classPK;
282 }
283
284 public void setClassPK(long classPK) {
285 if (classPK != _classPK) {
286 _classPK = classPK;
287 }
288 }
289
290 public String getTitle() {
291 return GetterUtil.getString(_title);
292 }
293
294 public void setTitle(String title) {
295 if (((title == null) && (_title != null)) ||
296 ((title != null) && (_title == null)) ||
297 ((title != null) && (_title != null) && !title.equals(_title))) {
298 _title = title;
299 }
300 }
301
302 public String getContent() {
303 return GetterUtil.getString(_content);
304 }
305
306 public void setContent(String content) {
307 if (((content == null) && (_content != null)) ||
308 ((content != null) && (_content == null)) ||
309 ((content != null) && (_content != null) &&
310 !content.equals(_content))) {
311 _content = content;
312 }
313 }
314
315 public String getUrl() {
316 return GetterUtil.getString(_url);
317 }
318
319 public void setUrl(String url) {
320 if (((url == null) && (_url != null)) ||
321 ((url != null) && (_url == null)) ||
322 ((url != null) && (_url != null) && !url.equals(_url))) {
323 _url = url;
324 }
325 }
326
327 public String getType() {
328 return GetterUtil.getString(_type);
329 }
330
331 public void setType(String type) {
332 if (((type == null) && (_type != null)) ||
333 ((type != null) && (_type == null)) ||
334 ((type != null) && (_type != null) && !type.equals(_type))) {
335 _type = type;
336 }
337 }
338
339 public Date getDisplayDate() {
340 return _displayDate;
341 }
342
343 public void setDisplayDate(Date displayDate) {
344 if (((displayDate == null) && (_displayDate != null)) ||
345 ((displayDate != null) && (_displayDate == null)) ||
346 ((displayDate != null) && (_displayDate != null) &&
347 !displayDate.equals(_displayDate))) {
348 _displayDate = displayDate;
349 }
350 }
351
352 public Date getExpirationDate() {
353 return _expirationDate;
354 }
355
356 public void setExpirationDate(Date expirationDate) {
357 if (((expirationDate == null) && (_expirationDate != null)) ||
358 ((expirationDate != null) && (_expirationDate == null)) ||
359 ((expirationDate != null) && (_expirationDate != null) &&
360 !expirationDate.equals(_expirationDate))) {
361 _expirationDate = expirationDate;
362 }
363 }
364
365 public int getPriority() {
366 return _priority;
367 }
368
369 public void setPriority(int priority) {
370 if (priority != _priority) {
371 _priority = priority;
372 }
373 }
374
375 public boolean getAlert() {
376 return _alert;
377 }
378
379 public boolean isAlert() {
380 return _alert;
381 }
382
383 public void setAlert(boolean alert) {
384 if (alert != _alert) {
385 _alert = alert;
386 }
387 }
388
389 public AnnouncementsEntry toEscapedModel() {
390 if (isEscapedModel()) {
391 return (AnnouncementsEntry)this;
392 }
393 else {
394 AnnouncementsEntry model = new AnnouncementsEntryImpl();
395
396 model.setNew(isNew());
397 model.setEscapedModel(true);
398
399 model.setUuid(HtmlUtil.escape(getUuid()));
400 model.setEntryId(getEntryId());
401 model.setCompanyId(getCompanyId());
402 model.setUserId(getUserId());
403 model.setUserName(HtmlUtil.escape(getUserName()));
404 model.setCreateDate(getCreateDate());
405 model.setModifiedDate(getModifiedDate());
406 model.setClassNameId(getClassNameId());
407 model.setClassPK(getClassPK());
408 model.setTitle(HtmlUtil.escape(getTitle()));
409 model.setContent(HtmlUtil.escape(getContent()));
410 model.setUrl(HtmlUtil.escape(getUrl()));
411 model.setType(HtmlUtil.escape(getType()));
412 model.setDisplayDate(getDisplayDate());
413 model.setExpirationDate(getExpirationDate());
414 model.setPriority(getPriority());
415 model.setAlert(getAlert());
416
417 model = (AnnouncementsEntry)Proxy.newProxyInstance(AnnouncementsEntry.class.getClassLoader(),
418 new Class[] { AnnouncementsEntry.class },
419 new ReadOnlyBeanHandler(model));
420
421 return model;
422 }
423 }
424
425 public ExpandoBridge getExpandoBridge() {
426 if (_expandoBridge == null) {
427 _expandoBridge = new ExpandoBridgeImpl(AnnouncementsEntry.class.getName(),
428 getPrimaryKey());
429 }
430
431 return _expandoBridge;
432 }
433
434 public Object clone() {
435 AnnouncementsEntryImpl clone = new AnnouncementsEntryImpl();
436
437 clone.setUuid(getUuid());
438 clone.setEntryId(getEntryId());
439 clone.setCompanyId(getCompanyId());
440 clone.setUserId(getUserId());
441 clone.setUserName(getUserName());
442 clone.setCreateDate(getCreateDate());
443 clone.setModifiedDate(getModifiedDate());
444 clone.setClassNameId(getClassNameId());
445 clone.setClassPK(getClassPK());
446 clone.setTitle(getTitle());
447 clone.setContent(getContent());
448 clone.setUrl(getUrl());
449 clone.setType(getType());
450 clone.setDisplayDate(getDisplayDate());
451 clone.setExpirationDate(getExpirationDate());
452 clone.setPriority(getPriority());
453 clone.setAlert(getAlert());
454
455 return clone;
456 }
457
458 public int compareTo(Object obj) {
459 if (obj == null) {
460 return -1;
461 }
462
463 AnnouncementsEntryImpl announcementsEntry = (AnnouncementsEntryImpl)obj;
464
465 int value = 0;
466
467 if (getPriority() < announcementsEntry.getPriority()) {
468 value = -1;
469 }
470 else if (getPriority() > announcementsEntry.getPriority()) {
471 value = 1;
472 }
473 else {
474 value = 0;
475 }
476
477 if (value != 0) {
478 return value;
479 }
480
481 value = DateUtil.compareTo(getModifiedDate(),
482 announcementsEntry.getModifiedDate());
483
484 if (value != 0) {
485 return value;
486 }
487
488 return 0;
489 }
490
491 public boolean equals(Object obj) {
492 if (obj == null) {
493 return false;
494 }
495
496 AnnouncementsEntryImpl announcementsEntry = null;
497
498 try {
499 announcementsEntry = (AnnouncementsEntryImpl)obj;
500 }
501 catch (ClassCastException cce) {
502 return false;
503 }
504
505 long pk = announcementsEntry.getPrimaryKey();
506
507 if (getPrimaryKey() == pk) {
508 return true;
509 }
510 else {
511 return false;
512 }
513 }
514
515 public int hashCode() {
516 return (int)getPrimaryKey();
517 }
518
519 private String _uuid;
520 private long _entryId;
521 private long _companyId;
522 private long _userId;
523 private String _userName;
524 private Date _createDate;
525 private Date _modifiedDate;
526 private long _classNameId;
527 private long _classPK;
528 private String _title;
529 private String _content;
530 private String _url;
531 private String _type;
532 private Date _displayDate;
533 private Date _expirationDate;
534 private int _priority;
535 private boolean _alert;
536 private transient ExpandoBridge _expandoBridge;
537 }