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