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