1
22
23 package com.liferay.portlet.calendar.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
31 import com.liferay.portlet.calendar.model.CalEvent;
32 import com.liferay.portlet.calendar.model.CalEventSoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class CalEventModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "CalEvent";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "uuid_", new Integer(Types.VARCHAR) },
68
69
70 { "eventId", new Integer(Types.BIGINT) },
71
72
73 { "groupId", new Integer(Types.BIGINT) },
74
75
76 { "companyId", new Integer(Types.BIGINT) },
77
78
79 { "userId", new Integer(Types.BIGINT) },
80
81
82 { "userName", new Integer(Types.VARCHAR) },
83
84
85 { "createDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "modifiedDate", new Integer(Types.TIMESTAMP) },
89
90
91 { "title", new Integer(Types.VARCHAR) },
92
93
94 { "description", new Integer(Types.VARCHAR) },
95
96
97 { "startDate", new Integer(Types.TIMESTAMP) },
98
99
100 { "endDate", new Integer(Types.TIMESTAMP) },
101
102
103 { "durationHour", new Integer(Types.INTEGER) },
104
105
106 { "durationMinute", new Integer(Types.INTEGER) },
107
108
109 { "allDay", new Integer(Types.BOOLEAN) },
110
111
112 { "timeZoneSensitive", new Integer(Types.BOOLEAN) },
113
114
115 { "type_", new Integer(Types.VARCHAR) },
116
117
118 { "repeating", new Integer(Types.BOOLEAN) },
119
120
121 { "recurrence", new Integer(Types.CLOB) },
122
123
124 { "remindBy", new Integer(Types.VARCHAR) },
125
126
127 { "firstReminder", new Integer(Types.INTEGER) },
128
129
130 { "secondReminder", new Integer(Types.INTEGER) }
131 };
132 public static final String TABLE_SQL_CREATE = "create table CalEvent (uuid_ VARCHAR(75) null,eventId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,title VARCHAR(75) null,description STRING null,startDate DATE null,endDate DATE null,durationHour INTEGER,durationMinute INTEGER,allDay BOOLEAN,timeZoneSensitive BOOLEAN,type_ VARCHAR(75) null,repeating BOOLEAN,recurrence TEXT null,remindBy VARCHAR(75) null,firstReminder INTEGER,secondReminder INTEGER)";
133 public static final String TABLE_SQL_DROP = "drop table CalEvent";
134 public static final String DATA_SOURCE = "liferayDataSource";
135 public static final String SESSION_FACTORY = "liferaySessionFactory";
136 public static final String TX_MANAGER = "liferayTransactionManager";
137 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
138 "value.object.finder.cache.enabled.com.liferay.portlet.calendar.model.CalEvent"),
139 true);
140
141 public static CalEvent toModel(CalEventSoap soapModel) {
142 CalEvent model = new CalEventImpl();
143
144 model.setUuid(soapModel.getUuid());
145 model.setEventId(soapModel.getEventId());
146 model.setGroupId(soapModel.getGroupId());
147 model.setCompanyId(soapModel.getCompanyId());
148 model.setUserId(soapModel.getUserId());
149 model.setUserName(soapModel.getUserName());
150 model.setCreateDate(soapModel.getCreateDate());
151 model.setModifiedDate(soapModel.getModifiedDate());
152 model.setTitle(soapModel.getTitle());
153 model.setDescription(soapModel.getDescription());
154 model.setStartDate(soapModel.getStartDate());
155 model.setEndDate(soapModel.getEndDate());
156 model.setDurationHour(soapModel.getDurationHour());
157 model.setDurationMinute(soapModel.getDurationMinute());
158 model.setAllDay(soapModel.getAllDay());
159 model.setTimeZoneSensitive(soapModel.getTimeZoneSensitive());
160 model.setType(soapModel.getType());
161 model.setRepeating(soapModel.getRepeating());
162 model.setRecurrence(soapModel.getRecurrence());
163 model.setRemindBy(soapModel.getRemindBy());
164 model.setFirstReminder(soapModel.getFirstReminder());
165 model.setSecondReminder(soapModel.getSecondReminder());
166
167 return model;
168 }
169
170 public static List<CalEvent> toModels(CalEventSoap[] soapModels) {
171 List<CalEvent> models = new ArrayList<CalEvent>(soapModels.length);
172
173 for (CalEventSoap soapModel : soapModels) {
174 models.add(toModel(soapModel));
175 }
176
177 return models;
178 }
179
180 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
181 "lock.expiration.time.com.liferay.portlet.calendar.model.CalEvent"));
182
183 public CalEventModelImpl() {
184 }
185
186 public long getPrimaryKey() {
187 return _eventId;
188 }
189
190 public void setPrimaryKey(long pk) {
191 setEventId(pk);
192 }
193
194 public Serializable getPrimaryKeyObj() {
195 return new Long(_eventId);
196 }
197
198 public String getUuid() {
199 return GetterUtil.getString(_uuid);
200 }
201
202 public void setUuid(String uuid) {
203 if ((uuid != null) && (uuid != _uuid)) {
204 _uuid = uuid;
205 }
206 }
207
208 public long getEventId() {
209 return _eventId;
210 }
211
212 public void setEventId(long eventId) {
213 if (eventId != _eventId) {
214 _eventId = eventId;
215 }
216 }
217
218 public long getGroupId() {
219 return _groupId;
220 }
221
222 public void setGroupId(long groupId) {
223 if (groupId != _groupId) {
224 _groupId = groupId;
225 }
226 }
227
228 public long getCompanyId() {
229 return _companyId;
230 }
231
232 public void setCompanyId(long companyId) {
233 if (companyId != _companyId) {
234 _companyId = companyId;
235 }
236 }
237
238 public long getUserId() {
239 return _userId;
240 }
241
242 public void setUserId(long userId) {
243 if (userId != _userId) {
244 _userId = userId;
245 }
246 }
247
248 public String getUserName() {
249 return GetterUtil.getString(_userName);
250 }
251
252 public void setUserName(String userName) {
253 if (((userName == null) && (_userName != null)) ||
254 ((userName != null) && (_userName == null)) ||
255 ((userName != null) && (_userName != null) &&
256 !userName.equals(_userName))) {
257 _userName = userName;
258 }
259 }
260
261 public Date getCreateDate() {
262 return _createDate;
263 }
264
265 public void setCreateDate(Date createDate) {
266 if (((createDate == null) && (_createDate != null)) ||
267 ((createDate != null) && (_createDate == null)) ||
268 ((createDate != null) && (_createDate != null) &&
269 !createDate.equals(_createDate))) {
270 _createDate = createDate;
271 }
272 }
273
274 public Date getModifiedDate() {
275 return _modifiedDate;
276 }
277
278 public void setModifiedDate(Date modifiedDate) {
279 if (((modifiedDate == null) && (_modifiedDate != null)) ||
280 ((modifiedDate != null) && (_modifiedDate == null)) ||
281 ((modifiedDate != null) && (_modifiedDate != null) &&
282 !modifiedDate.equals(_modifiedDate))) {
283 _modifiedDate = modifiedDate;
284 }
285 }
286
287 public String getTitle() {
288 return GetterUtil.getString(_title);
289 }
290
291 public void setTitle(String title) {
292 if (((title == null) && (_title != null)) ||
293 ((title != null) && (_title == null)) ||
294 ((title != null) && (_title != null) && !title.equals(_title))) {
295 _title = title;
296 }
297 }
298
299 public String getDescription() {
300 return GetterUtil.getString(_description);
301 }
302
303 public void setDescription(String description) {
304 if (((description == null) && (_description != null)) ||
305 ((description != null) && (_description == null)) ||
306 ((description != null) && (_description != null) &&
307 !description.equals(_description))) {
308 _description = description;
309 }
310 }
311
312 public Date getStartDate() {
313 return _startDate;
314 }
315
316 public void setStartDate(Date startDate) {
317 if (((startDate == null) && (_startDate != null)) ||
318 ((startDate != null) && (_startDate == null)) ||
319 ((startDate != null) && (_startDate != null) &&
320 !startDate.equals(_startDate))) {
321 _startDate = startDate;
322 }
323 }
324
325 public Date getEndDate() {
326 return _endDate;
327 }
328
329 public void setEndDate(Date endDate) {
330 if (((endDate == null) && (_endDate != null)) ||
331 ((endDate != null) && (_endDate == null)) ||
332 ((endDate != null) && (_endDate != null) &&
333 !endDate.equals(_endDate))) {
334 _endDate = endDate;
335 }
336 }
337
338 public int getDurationHour() {
339 return _durationHour;
340 }
341
342 public void setDurationHour(int durationHour) {
343 if (durationHour != _durationHour) {
344 _durationHour = durationHour;
345 }
346 }
347
348 public int getDurationMinute() {
349 return _durationMinute;
350 }
351
352 public void setDurationMinute(int durationMinute) {
353 if (durationMinute != _durationMinute) {
354 _durationMinute = durationMinute;
355 }
356 }
357
358 public boolean getAllDay() {
359 return _allDay;
360 }
361
362 public boolean isAllDay() {
363 return _allDay;
364 }
365
366 public void setAllDay(boolean allDay) {
367 if (allDay != _allDay) {
368 _allDay = allDay;
369 }
370 }
371
372 public boolean getTimeZoneSensitive() {
373 return _timeZoneSensitive;
374 }
375
376 public boolean isTimeZoneSensitive() {
377 return _timeZoneSensitive;
378 }
379
380 public void setTimeZoneSensitive(boolean timeZoneSensitive) {
381 if (timeZoneSensitive != _timeZoneSensitive) {
382 _timeZoneSensitive = timeZoneSensitive;
383 }
384 }
385
386 public String getType() {
387 return GetterUtil.getString(_type);
388 }
389
390 public void setType(String type) {
391 if (((type == null) && (_type != null)) ||
392 ((type != null) && (_type == null)) ||
393 ((type != null) && (_type != null) && !type.equals(_type))) {
394 _type = type;
395 }
396 }
397
398 public boolean getRepeating() {
399 return _repeating;
400 }
401
402 public boolean isRepeating() {
403 return _repeating;
404 }
405
406 public void setRepeating(boolean repeating) {
407 if (repeating != _repeating) {
408 _repeating = repeating;
409 }
410 }
411
412 public String getRecurrence() {
413 return GetterUtil.getString(_recurrence);
414 }
415
416 public void setRecurrence(String recurrence) {
417 if (((recurrence == null) && (_recurrence != null)) ||
418 ((recurrence != null) && (_recurrence == null)) ||
419 ((recurrence != null) && (_recurrence != null) &&
420 !recurrence.equals(_recurrence))) {
421 _recurrence = recurrence;
422 }
423 }
424
425 public String getRemindBy() {
426 return GetterUtil.getString(_remindBy);
427 }
428
429 public void setRemindBy(String remindBy) {
430 if (((remindBy == null) && (_remindBy != null)) ||
431 ((remindBy != null) && (_remindBy == null)) ||
432 ((remindBy != null) && (_remindBy != null) &&
433 !remindBy.equals(_remindBy))) {
434 _remindBy = remindBy;
435 }
436 }
437
438 public int getFirstReminder() {
439 return _firstReminder;
440 }
441
442 public void setFirstReminder(int firstReminder) {
443 if (firstReminder != _firstReminder) {
444 _firstReminder = firstReminder;
445 }
446 }
447
448 public int getSecondReminder() {
449 return _secondReminder;
450 }
451
452 public void setSecondReminder(int secondReminder) {
453 if (secondReminder != _secondReminder) {
454 _secondReminder = secondReminder;
455 }
456 }
457
458 public CalEvent toEscapedModel() {
459 if (isEscapedModel()) {
460 return (CalEvent)this;
461 }
462 else {
463 CalEvent model = new CalEventImpl();
464
465 model.setNew(isNew());
466 model.setEscapedModel(true);
467
468 model.setUuid(HtmlUtil.escape(getUuid()));
469 model.setEventId(getEventId());
470 model.setGroupId(getGroupId());
471 model.setCompanyId(getCompanyId());
472 model.setUserId(getUserId());
473 model.setUserName(HtmlUtil.escape(getUserName()));
474 model.setCreateDate(getCreateDate());
475 model.setModifiedDate(getModifiedDate());
476 model.setTitle(HtmlUtil.escape(getTitle()));
477 model.setDescription(HtmlUtil.escape(getDescription()));
478 model.setStartDate(getStartDate());
479 model.setEndDate(getEndDate());
480 model.setDurationHour(getDurationHour());
481 model.setDurationMinute(getDurationMinute());
482 model.setAllDay(getAllDay());
483 model.setTimeZoneSensitive(getTimeZoneSensitive());
484 model.setType(HtmlUtil.escape(getType()));
485 model.setRepeating(getRepeating());
486 model.setRecurrence(getRecurrence());
487 model.setRemindBy(HtmlUtil.escape(getRemindBy()));
488 model.setFirstReminder(getFirstReminder());
489 model.setSecondReminder(getSecondReminder());
490
491 model = (CalEvent)Proxy.newProxyInstance(CalEvent.class.getClassLoader(),
492 new Class[] { CalEvent.class },
493 new ReadOnlyBeanHandler(model));
494
495 return model;
496 }
497 }
498
499 public Object clone() {
500 CalEventImpl clone = new CalEventImpl();
501
502 clone.setUuid(getUuid());
503 clone.setEventId(getEventId());
504 clone.setGroupId(getGroupId());
505 clone.setCompanyId(getCompanyId());
506 clone.setUserId(getUserId());
507 clone.setUserName(getUserName());
508 clone.setCreateDate(getCreateDate());
509 clone.setModifiedDate(getModifiedDate());
510 clone.setTitle(getTitle());
511 clone.setDescription(getDescription());
512 clone.setStartDate(getStartDate());
513 clone.setEndDate(getEndDate());
514 clone.setDurationHour(getDurationHour());
515 clone.setDurationMinute(getDurationMinute());
516 clone.setAllDay(getAllDay());
517 clone.setTimeZoneSensitive(getTimeZoneSensitive());
518 clone.setType(getType());
519 clone.setRepeating(getRepeating());
520 clone.setRecurrence(getRecurrence());
521 clone.setRemindBy(getRemindBy());
522 clone.setFirstReminder(getFirstReminder());
523 clone.setSecondReminder(getSecondReminder());
524
525 return clone;
526 }
527
528 public int compareTo(Object obj) {
529 if (obj == null) {
530 return -1;
531 }
532
533 CalEventImpl calEvent = (CalEventImpl)obj;
534
535 int value = 0;
536
537 value = DateUtil.compareTo(getStartDate(), calEvent.getStartDate());
538
539 if (value != 0) {
540 return value;
541 }
542
543 value = getTitle().toLowerCase()
544 .compareTo(calEvent.getTitle().toLowerCase());
545
546 if (value != 0) {
547 return value;
548 }
549
550 return 0;
551 }
552
553 public boolean equals(Object obj) {
554 if (obj == null) {
555 return false;
556 }
557
558 CalEventImpl calEvent = null;
559
560 try {
561 calEvent = (CalEventImpl)obj;
562 }
563 catch (ClassCastException cce) {
564 return false;
565 }
566
567 long pk = calEvent.getPrimaryKey();
568
569 if (getPrimaryKey() == pk) {
570 return true;
571 }
572 else {
573 return false;
574 }
575 }
576
577 public int hashCode() {
578 return (int)getPrimaryKey();
579 }
580
581 private String _uuid;
582 private long _eventId;
583 private long _groupId;
584 private long _companyId;
585 private long _userId;
586 private String _userName;
587 private Date _createDate;
588 private Date _modifiedDate;
589 private String _title;
590 private String _description;
591 private Date _startDate;
592 private Date _endDate;
593 private int _durationHour;
594 private int _durationMinute;
595 private boolean _allDay;
596 private boolean _timeZoneSensitive;
597 private String _type;
598 private boolean _repeating;
599 private String _recurrence;
600 private String _remindBy;
601 private int _firstReminder;
602 private int _secondReminder;
603 }