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