1
22
23 package com.liferay.portlet.calendar.service.persistence;
24
25 import com.liferay.portal.SystemException;
26 import com.liferay.portal.kernel.annotation.BeanReference;
27 import com.liferay.portal.kernel.cache.CacheRegistry;
28 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
29 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
30 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
31 import com.liferay.portal.kernel.dao.orm.FinderPath;
32 import com.liferay.portal.kernel.dao.orm.Query;
33 import com.liferay.portal.kernel.dao.orm.QueryPos;
34 import com.liferay.portal.kernel.dao.orm.QueryUtil;
35 import com.liferay.portal.kernel.dao.orm.Session;
36 import com.liferay.portal.kernel.log.Log;
37 import com.liferay.portal.kernel.log.LogFactoryUtil;
38 import com.liferay.portal.kernel.util.GetterUtil;
39 import com.liferay.portal.kernel.util.OrderByComparator;
40 import com.liferay.portal.kernel.util.StringPool;
41 import com.liferay.portal.kernel.util.StringUtil;
42 import com.liferay.portal.kernel.util.Validator;
43 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
44 import com.liferay.portal.model.ModelListener;
45 import com.liferay.portal.service.persistence.BatchSessionUtil;
46 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
47
48 import com.liferay.portlet.calendar.NoSuchEventException;
49 import com.liferay.portlet.calendar.model.CalEvent;
50 import com.liferay.portlet.calendar.model.impl.CalEventImpl;
51 import com.liferay.portlet.calendar.model.impl.CalEventModelImpl;
52
53 import java.util.ArrayList;
54 import java.util.Collections;
55 import java.util.List;
56
57
70 public class CalEventPersistenceImpl extends BasePersistenceImpl
71 implements CalEventPersistence {
72 public static final String FINDER_CLASS_NAME_ENTITY = CalEventImpl.class.getName();
73 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
74 ".List";
75 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
76 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
77 "findByUuid", new String[] { String.class.getName() });
78 public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
79 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
80 "findByUuid",
81 new String[] {
82 String.class.getName(),
83
84 "java.lang.Integer", "java.lang.Integer",
85 "com.liferay.portal.kernel.util.OrderByComparator"
86 });
87 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
88 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
89 "countByUuid", new String[] { String.class.getName() });
90 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
91 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
92 "fetchByUUID_G",
93 new String[] { String.class.getName(), Long.class.getName() });
94 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
95 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96 "countByUUID_G",
97 new String[] { String.class.getName(), Long.class.getName() });
98 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
99 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
100 "findByGroupId", new String[] { Long.class.getName() });
101 public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
102 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
103 "findByGroupId",
104 new String[] {
105 Long.class.getName(),
106
107 "java.lang.Integer", "java.lang.Integer",
108 "com.liferay.portal.kernel.util.OrderByComparator"
109 });
110 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
111 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
112 "countByGroupId", new String[] { Long.class.getName() });
113 public static final FinderPath FINDER_PATH_FIND_BY_REMINDBY = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
114 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
115 "findByRemindBy", new String[] { Integer.class.getName() });
116 public static final FinderPath FINDER_PATH_FIND_BY_OBC_REMINDBY = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
117 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
118 "findByRemindBy",
119 new String[] {
120 Integer.class.getName(),
121
122 "java.lang.Integer", "java.lang.Integer",
123 "com.liferay.portal.kernel.util.OrderByComparator"
124 });
125 public static final FinderPath FINDER_PATH_COUNT_BY_REMINDBY = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
126 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
127 "countByRemindBy", new String[] { Integer.class.getName() });
128 public static final FinderPath FINDER_PATH_FIND_BY_G_T = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
129 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
130 "findByG_T",
131 new String[] { Long.class.getName(), String.class.getName() });
132 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_T = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
133 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
134 "findByG_T",
135 new String[] {
136 Long.class.getName(), String.class.getName(),
137
138 "java.lang.Integer", "java.lang.Integer",
139 "com.liferay.portal.kernel.util.OrderByComparator"
140 });
141 public static final FinderPath FINDER_PATH_COUNT_BY_G_T = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
142 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
143 "countByG_T",
144 new String[] { Long.class.getName(), String.class.getName() });
145 public static final FinderPath FINDER_PATH_FIND_BY_G_R = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
146 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
147 "findByG_R",
148 new String[] { Long.class.getName(), Boolean.class.getName() });
149 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_R = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
150 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
151 "findByG_R",
152 new String[] {
153 Long.class.getName(), Boolean.class.getName(),
154
155 "java.lang.Integer", "java.lang.Integer",
156 "com.liferay.portal.kernel.util.OrderByComparator"
157 });
158 public static final FinderPath FINDER_PATH_COUNT_BY_G_R = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
159 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
160 "countByG_R",
161 new String[] { Long.class.getName(), Boolean.class.getName() });
162 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
163 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
164 "findAll", new String[0]);
165 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(CalEventModelImpl.ENTITY_CACHE_ENABLED,
166 CalEventModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
167 "countAll", new String[0]);
168
169 public void cacheResult(CalEvent calEvent) {
170 EntityCacheUtil.putResult(CalEventModelImpl.ENTITY_CACHE_ENABLED,
171 CalEventImpl.class, calEvent.getPrimaryKey(), calEvent);
172
173 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
174 new Object[] { calEvent.getUuid(), new Long(calEvent.getGroupId()) },
175 calEvent);
176 }
177
178 public void cacheResult(List<CalEvent> calEvents) {
179 for (CalEvent calEvent : calEvents) {
180 if (EntityCacheUtil.getResult(
181 CalEventModelImpl.ENTITY_CACHE_ENABLED,
182 CalEventImpl.class, calEvent.getPrimaryKey(), this) == null) {
183 cacheResult(calEvent);
184 }
185 }
186 }
187
188 public void clearCache() {
189 CacheRegistry.clear(CalEventImpl.class.getName());
190 EntityCacheUtil.clearCache(CalEventImpl.class.getName());
191 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
192 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
193 }
194
195 public CalEvent create(long eventId) {
196 CalEvent calEvent = new CalEventImpl();
197
198 calEvent.setNew(true);
199 calEvent.setPrimaryKey(eventId);
200
201 String uuid = PortalUUIDUtil.generate();
202
203 calEvent.setUuid(uuid);
204
205 return calEvent;
206 }
207
208 public CalEvent remove(long eventId)
209 throws NoSuchEventException, SystemException {
210 Session session = null;
211
212 try {
213 session = openSession();
214
215 CalEvent calEvent = (CalEvent)session.get(CalEventImpl.class,
216 new Long(eventId));
217
218 if (calEvent == null) {
219 if (_log.isWarnEnabled()) {
220 _log.warn("No CalEvent exists with the primary key " +
221 eventId);
222 }
223
224 throw new NoSuchEventException(
225 "No CalEvent exists with the primary key " + eventId);
226 }
227
228 return remove(calEvent);
229 }
230 catch (NoSuchEventException nsee) {
231 throw nsee;
232 }
233 catch (Exception e) {
234 throw processException(e);
235 }
236 finally {
237 closeSession(session);
238 }
239 }
240
241 public CalEvent remove(CalEvent calEvent) throws SystemException {
242 for (ModelListener<CalEvent> listener : listeners) {
243 listener.onBeforeRemove(calEvent);
244 }
245
246 calEvent = removeImpl(calEvent);
247
248 for (ModelListener<CalEvent> listener : listeners) {
249 listener.onAfterRemove(calEvent);
250 }
251
252 return calEvent;
253 }
254
255 protected CalEvent removeImpl(CalEvent calEvent) throws SystemException {
256 Session session = null;
257
258 try {
259 session = openSession();
260
261 if (calEvent.isCachedModel() || BatchSessionUtil.isEnabled()) {
262 Object staleObject = session.get(CalEventImpl.class,
263 calEvent.getPrimaryKeyObj());
264
265 if (staleObject != null) {
266 session.evict(staleObject);
267 }
268 }
269
270 session.delete(calEvent);
271
272 session.flush();
273 }
274 catch (Exception e) {
275 throw processException(e);
276 }
277 finally {
278 closeSession(session);
279 }
280
281 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
282
283 CalEventModelImpl calEventModelImpl = (CalEventModelImpl)calEvent;
284
285 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
286 new Object[] {
287 calEventModelImpl.getOriginalUuid(),
288 new Long(calEventModelImpl.getOriginalGroupId())
289 });
290
291 EntityCacheUtil.removeResult(CalEventModelImpl.ENTITY_CACHE_ENABLED,
292 CalEventImpl.class, calEvent.getPrimaryKey());
293
294 return calEvent;
295 }
296
297
300 public CalEvent update(CalEvent calEvent) throws SystemException {
301 if (_log.isWarnEnabled()) {
302 _log.warn(
303 "Using the deprecated update(CalEvent calEvent) method. Use update(CalEvent calEvent, boolean merge) instead.");
304 }
305
306 return update(calEvent, false);
307 }
308
309
321 public CalEvent update(CalEvent calEvent, boolean merge)
322 throws SystemException {
323 boolean isNew = calEvent.isNew();
324
325 for (ModelListener<CalEvent> listener : listeners) {
326 if (isNew) {
327 listener.onBeforeCreate(calEvent);
328 }
329 else {
330 listener.onBeforeUpdate(calEvent);
331 }
332 }
333
334 calEvent = updateImpl(calEvent, merge);
335
336 for (ModelListener<CalEvent> listener : listeners) {
337 if (isNew) {
338 listener.onAfterCreate(calEvent);
339 }
340 else {
341 listener.onAfterUpdate(calEvent);
342 }
343 }
344
345 return calEvent;
346 }
347
348 public CalEvent updateImpl(
349 com.liferay.portlet.calendar.model.CalEvent calEvent, boolean merge)
350 throws SystemException {
351 boolean isNew = calEvent.isNew();
352
353 CalEventModelImpl calEventModelImpl = (CalEventModelImpl)calEvent;
354
355 if (Validator.isNull(calEvent.getUuid())) {
356 String uuid = PortalUUIDUtil.generate();
357
358 calEvent.setUuid(uuid);
359 }
360
361 Session session = null;
362
363 try {
364 session = openSession();
365
366 BatchSessionUtil.update(session, calEvent, merge);
367
368 calEvent.setNew(false);
369 }
370 catch (Exception e) {
371 throw processException(e);
372 }
373 finally {
374 closeSession(session);
375 }
376
377 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
378
379 EntityCacheUtil.putResult(CalEventModelImpl.ENTITY_CACHE_ENABLED,
380 CalEventImpl.class, calEvent.getPrimaryKey(), calEvent);
381
382 if (!isNew &&
383 (!Validator.equals(calEvent.getUuid(),
384 calEventModelImpl.getOriginalUuid()) ||
385 (calEvent.getGroupId() != calEventModelImpl.getOriginalGroupId()))) {
386 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
387 new Object[] {
388 calEventModelImpl.getOriginalUuid(),
389 new Long(calEventModelImpl.getOriginalGroupId())
390 });
391 }
392
393 if (isNew ||
394 (!Validator.equals(calEvent.getUuid(),
395 calEventModelImpl.getOriginalUuid()) ||
396 (calEvent.getGroupId() != calEventModelImpl.getOriginalGroupId()))) {
397 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
398 new Object[] { calEvent.getUuid(), new Long(
399 calEvent.getGroupId()) }, calEvent);
400 }
401
402 return calEvent;
403 }
404
405 public CalEvent findByPrimaryKey(long eventId)
406 throws NoSuchEventException, SystemException {
407 CalEvent calEvent = fetchByPrimaryKey(eventId);
408
409 if (calEvent == null) {
410 if (_log.isWarnEnabled()) {
411 _log.warn("No CalEvent exists with the primary key " + eventId);
412 }
413
414 throw new NoSuchEventException(
415 "No CalEvent exists with the primary key " + eventId);
416 }
417
418 return calEvent;
419 }
420
421 public CalEvent fetchByPrimaryKey(long eventId) throws SystemException {
422 CalEvent calEvent = (CalEvent)EntityCacheUtil.getResult(CalEventModelImpl.ENTITY_CACHE_ENABLED,
423 CalEventImpl.class, eventId, this);
424
425 if (calEvent == null) {
426 Session session = null;
427
428 try {
429 session = openSession();
430
431 calEvent = (CalEvent)session.get(CalEventImpl.class,
432 new Long(eventId));
433 }
434 catch (Exception e) {
435 throw processException(e);
436 }
437 finally {
438 if (calEvent != null) {
439 cacheResult(calEvent);
440 }
441
442 closeSession(session);
443 }
444 }
445
446 return calEvent;
447 }
448
449 public List<CalEvent> findByUuid(String uuid) throws SystemException {
450 Object[] finderArgs = new Object[] { uuid };
451
452 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
453 finderArgs, this);
454
455 if (list == null) {
456 Session session = null;
457
458 try {
459 session = openSession();
460
461 StringBuilder query = new StringBuilder();
462
463 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
464
465 if (uuid == null) {
466 query.append("calEvent.uuid IS NULL");
467 }
468 else {
469 query.append("calEvent.uuid = ?");
470 }
471
472 query.append(" ");
473
474 query.append("ORDER BY ");
475
476 query.append("calEvent.startDate ASC, ");
477 query.append("calEvent.title ASC");
478
479 Query q = session.createQuery(query.toString());
480
481 QueryPos qPos = QueryPos.getInstance(q);
482
483 if (uuid != null) {
484 qPos.add(uuid);
485 }
486
487 list = q.list();
488 }
489 catch (Exception e) {
490 throw processException(e);
491 }
492 finally {
493 if (list == null) {
494 list = new ArrayList<CalEvent>();
495 }
496
497 cacheResult(list);
498
499 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
500 list);
501
502 closeSession(session);
503 }
504 }
505
506 return list;
507 }
508
509 public List<CalEvent> findByUuid(String uuid, int start, int end)
510 throws SystemException {
511 return findByUuid(uuid, start, end, null);
512 }
513
514 public List<CalEvent> findByUuid(String uuid, int start, int end,
515 OrderByComparator obc) throws SystemException {
516 Object[] finderArgs = new Object[] {
517 uuid,
518
519 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
520 };
521
522 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
523 finderArgs, this);
524
525 if (list == null) {
526 Session session = null;
527
528 try {
529 session = openSession();
530
531 StringBuilder query = new StringBuilder();
532
533 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
534
535 if (uuid == null) {
536 query.append("calEvent.uuid IS NULL");
537 }
538 else {
539 query.append("calEvent.uuid = ?");
540 }
541
542 query.append(" ");
543
544 if (obc != null) {
545 query.append("ORDER BY ");
546
547 String[] orderByFields = obc.getOrderByFields();
548
549 for (int i = 0; i < orderByFields.length; i++) {
550 query.append("calEvent.");
551 query.append(orderByFields[i]);
552
553 if (obc.isAscending()) {
554 query.append(" ASC");
555 }
556 else {
557 query.append(" DESC");
558 }
559
560 if ((i + 1) < orderByFields.length) {
561 query.append(", ");
562 }
563 }
564 }
565
566 else {
567 query.append("ORDER BY ");
568
569 query.append("calEvent.startDate ASC, ");
570 query.append("calEvent.title ASC");
571 }
572
573 Query q = session.createQuery(query.toString());
574
575 QueryPos qPos = QueryPos.getInstance(q);
576
577 if (uuid != null) {
578 qPos.add(uuid);
579 }
580
581 list = (List<CalEvent>)QueryUtil.list(q, getDialect(), start,
582 end);
583 }
584 catch (Exception e) {
585 throw processException(e);
586 }
587 finally {
588 if (list == null) {
589 list = new ArrayList<CalEvent>();
590 }
591
592 cacheResult(list);
593
594 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
595 finderArgs, list);
596
597 closeSession(session);
598 }
599 }
600
601 return list;
602 }
603
604 public CalEvent findByUuid_First(String uuid, OrderByComparator obc)
605 throws NoSuchEventException, SystemException {
606 List<CalEvent> list = findByUuid(uuid, 0, 1, obc);
607
608 if (list.isEmpty()) {
609 StringBuilder msg = new StringBuilder();
610
611 msg.append("No CalEvent exists with the key {");
612
613 msg.append("uuid=" + uuid);
614
615 msg.append(StringPool.CLOSE_CURLY_BRACE);
616
617 throw new NoSuchEventException(msg.toString());
618 }
619 else {
620 return list.get(0);
621 }
622 }
623
624 public CalEvent findByUuid_Last(String uuid, OrderByComparator obc)
625 throws NoSuchEventException, SystemException {
626 int count = countByUuid(uuid);
627
628 List<CalEvent> list = findByUuid(uuid, count - 1, count, obc);
629
630 if (list.isEmpty()) {
631 StringBuilder msg = new StringBuilder();
632
633 msg.append("No CalEvent exists with the key {");
634
635 msg.append("uuid=" + uuid);
636
637 msg.append(StringPool.CLOSE_CURLY_BRACE);
638
639 throw new NoSuchEventException(msg.toString());
640 }
641 else {
642 return list.get(0);
643 }
644 }
645
646 public CalEvent[] findByUuid_PrevAndNext(long eventId, String uuid,
647 OrderByComparator obc) throws NoSuchEventException, SystemException {
648 CalEvent calEvent = findByPrimaryKey(eventId);
649
650 int count = countByUuid(uuid);
651
652 Session session = null;
653
654 try {
655 session = openSession();
656
657 StringBuilder query = new StringBuilder();
658
659 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
660
661 if (uuid == null) {
662 query.append("calEvent.uuid IS NULL");
663 }
664 else {
665 query.append("calEvent.uuid = ?");
666 }
667
668 query.append(" ");
669
670 if (obc != null) {
671 query.append("ORDER BY ");
672
673 String[] orderByFields = obc.getOrderByFields();
674
675 for (int i = 0; i < orderByFields.length; i++) {
676 query.append("calEvent.");
677 query.append(orderByFields[i]);
678
679 if (obc.isAscending()) {
680 query.append(" ASC");
681 }
682 else {
683 query.append(" DESC");
684 }
685
686 if ((i + 1) < orderByFields.length) {
687 query.append(", ");
688 }
689 }
690 }
691
692 else {
693 query.append("ORDER BY ");
694
695 query.append("calEvent.startDate ASC, ");
696 query.append("calEvent.title ASC");
697 }
698
699 Query q = session.createQuery(query.toString());
700
701 QueryPos qPos = QueryPos.getInstance(q);
702
703 if (uuid != null) {
704 qPos.add(uuid);
705 }
706
707 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, calEvent);
708
709 CalEvent[] array = new CalEventImpl[3];
710
711 array[0] = (CalEvent)objArray[0];
712 array[1] = (CalEvent)objArray[1];
713 array[2] = (CalEvent)objArray[2];
714
715 return array;
716 }
717 catch (Exception e) {
718 throw processException(e);
719 }
720 finally {
721 closeSession(session);
722 }
723 }
724
725 public CalEvent findByUUID_G(String uuid, long groupId)
726 throws NoSuchEventException, SystemException {
727 CalEvent calEvent = fetchByUUID_G(uuid, groupId);
728
729 if (calEvent == null) {
730 StringBuilder msg = new StringBuilder();
731
732 msg.append("No CalEvent exists with the key {");
733
734 msg.append("uuid=" + uuid);
735
736 msg.append(", ");
737 msg.append("groupId=" + groupId);
738
739 msg.append(StringPool.CLOSE_CURLY_BRACE);
740
741 if (_log.isWarnEnabled()) {
742 _log.warn(msg.toString());
743 }
744
745 throw new NoSuchEventException(msg.toString());
746 }
747
748 return calEvent;
749 }
750
751 public CalEvent fetchByUUID_G(String uuid, long groupId)
752 throws SystemException {
753 return fetchByUUID_G(uuid, groupId, true);
754 }
755
756 public CalEvent fetchByUUID_G(String uuid, long groupId,
757 boolean retrieveFromCache) throws SystemException {
758 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
759
760 Object result = null;
761
762 if (retrieveFromCache) {
763 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
764 finderArgs, this);
765 }
766
767 if (result == null) {
768 Session session = null;
769
770 try {
771 session = openSession();
772
773 StringBuilder query = new StringBuilder();
774
775 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
776
777 if (uuid == null) {
778 query.append("calEvent.uuid IS NULL");
779 }
780 else {
781 query.append("calEvent.uuid = ?");
782 }
783
784 query.append(" AND ");
785
786 query.append("calEvent.groupId = ?");
787
788 query.append(" ");
789
790 query.append("ORDER BY ");
791
792 query.append("calEvent.startDate ASC, ");
793 query.append("calEvent.title ASC");
794
795 Query q = session.createQuery(query.toString());
796
797 QueryPos qPos = QueryPos.getInstance(q);
798
799 if (uuid != null) {
800 qPos.add(uuid);
801 }
802
803 qPos.add(groupId);
804
805 List<CalEvent> list = q.list();
806
807 result = list;
808
809 CalEvent calEvent = null;
810
811 if (list.isEmpty()) {
812 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
813 finderArgs, list);
814 }
815 else {
816 calEvent = list.get(0);
817
818 cacheResult(calEvent);
819
820 if ((calEvent.getUuid() == null) ||
821 !calEvent.getUuid().equals(uuid) ||
822 (calEvent.getGroupId() != groupId)) {
823 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
824 finderArgs, calEvent);
825 }
826 }
827
828 return calEvent;
829 }
830 catch (Exception e) {
831 throw processException(e);
832 }
833 finally {
834 if (result == null) {
835 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
836 finderArgs, new ArrayList<CalEvent>());
837 }
838
839 closeSession(session);
840 }
841 }
842 else {
843 if (result instanceof List<?>) {
844 return null;
845 }
846 else {
847 return (CalEvent)result;
848 }
849 }
850 }
851
852 public List<CalEvent> findByGroupId(long groupId) throws SystemException {
853 Object[] finderArgs = new Object[] { new Long(groupId) };
854
855 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
856 finderArgs, this);
857
858 if (list == null) {
859 Session session = null;
860
861 try {
862 session = openSession();
863
864 StringBuilder query = new StringBuilder();
865
866 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
867
868 query.append("calEvent.groupId = ?");
869
870 query.append(" ");
871
872 query.append("ORDER BY ");
873
874 query.append("calEvent.startDate ASC, ");
875 query.append("calEvent.title ASC");
876
877 Query q = session.createQuery(query.toString());
878
879 QueryPos qPos = QueryPos.getInstance(q);
880
881 qPos.add(groupId);
882
883 list = q.list();
884 }
885 catch (Exception e) {
886 throw processException(e);
887 }
888 finally {
889 if (list == null) {
890 list = new ArrayList<CalEvent>();
891 }
892
893 cacheResult(list);
894
895 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
896 finderArgs, list);
897
898 closeSession(session);
899 }
900 }
901
902 return list;
903 }
904
905 public List<CalEvent> findByGroupId(long groupId, int start, int end)
906 throws SystemException {
907 return findByGroupId(groupId, start, end, null);
908 }
909
910 public List<CalEvent> findByGroupId(long groupId, int start, int end,
911 OrderByComparator obc) throws SystemException {
912 Object[] finderArgs = new Object[] {
913 new Long(groupId),
914
915 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
916 };
917
918 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
919 finderArgs, this);
920
921 if (list == null) {
922 Session session = null;
923
924 try {
925 session = openSession();
926
927 StringBuilder query = new StringBuilder();
928
929 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
930
931 query.append("calEvent.groupId = ?");
932
933 query.append(" ");
934
935 if (obc != null) {
936 query.append("ORDER BY ");
937
938 String[] orderByFields = obc.getOrderByFields();
939
940 for (int i = 0; i < orderByFields.length; i++) {
941 query.append("calEvent.");
942 query.append(orderByFields[i]);
943
944 if (obc.isAscending()) {
945 query.append(" ASC");
946 }
947 else {
948 query.append(" DESC");
949 }
950
951 if ((i + 1) < orderByFields.length) {
952 query.append(", ");
953 }
954 }
955 }
956
957 else {
958 query.append("ORDER BY ");
959
960 query.append("calEvent.startDate ASC, ");
961 query.append("calEvent.title ASC");
962 }
963
964 Query q = session.createQuery(query.toString());
965
966 QueryPos qPos = QueryPos.getInstance(q);
967
968 qPos.add(groupId);
969
970 list = (List<CalEvent>)QueryUtil.list(q, getDialect(), start,
971 end);
972 }
973 catch (Exception e) {
974 throw processException(e);
975 }
976 finally {
977 if (list == null) {
978 list = new ArrayList<CalEvent>();
979 }
980
981 cacheResult(list);
982
983 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
984 finderArgs, list);
985
986 closeSession(session);
987 }
988 }
989
990 return list;
991 }
992
993 public CalEvent findByGroupId_First(long groupId, OrderByComparator obc)
994 throws NoSuchEventException, SystemException {
995 List<CalEvent> list = findByGroupId(groupId, 0, 1, obc);
996
997 if (list.isEmpty()) {
998 StringBuilder msg = new StringBuilder();
999
1000 msg.append("No CalEvent exists with the key {");
1001
1002 msg.append("groupId=" + groupId);
1003
1004 msg.append(StringPool.CLOSE_CURLY_BRACE);
1005
1006 throw new NoSuchEventException(msg.toString());
1007 }
1008 else {
1009 return list.get(0);
1010 }
1011 }
1012
1013 public CalEvent findByGroupId_Last(long groupId, OrderByComparator obc)
1014 throws NoSuchEventException, SystemException {
1015 int count = countByGroupId(groupId);
1016
1017 List<CalEvent> list = findByGroupId(groupId, count - 1, count, obc);
1018
1019 if (list.isEmpty()) {
1020 StringBuilder msg = new StringBuilder();
1021
1022 msg.append("No CalEvent exists with the key {");
1023
1024 msg.append("groupId=" + groupId);
1025
1026 msg.append(StringPool.CLOSE_CURLY_BRACE);
1027
1028 throw new NoSuchEventException(msg.toString());
1029 }
1030 else {
1031 return list.get(0);
1032 }
1033 }
1034
1035 public CalEvent[] findByGroupId_PrevAndNext(long eventId, long groupId,
1036 OrderByComparator obc) throws NoSuchEventException, SystemException {
1037 CalEvent calEvent = findByPrimaryKey(eventId);
1038
1039 int count = countByGroupId(groupId);
1040
1041 Session session = null;
1042
1043 try {
1044 session = openSession();
1045
1046 StringBuilder query = new StringBuilder();
1047
1048 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1049
1050 query.append("calEvent.groupId = ?");
1051
1052 query.append(" ");
1053
1054 if (obc != null) {
1055 query.append("ORDER BY ");
1056
1057 String[] orderByFields = obc.getOrderByFields();
1058
1059 for (int i = 0; i < orderByFields.length; i++) {
1060 query.append("calEvent.");
1061 query.append(orderByFields[i]);
1062
1063 if (obc.isAscending()) {
1064 query.append(" ASC");
1065 }
1066 else {
1067 query.append(" DESC");
1068 }
1069
1070 if ((i + 1) < orderByFields.length) {
1071 query.append(", ");
1072 }
1073 }
1074 }
1075
1076 else {
1077 query.append("ORDER BY ");
1078
1079 query.append("calEvent.startDate ASC, ");
1080 query.append("calEvent.title ASC");
1081 }
1082
1083 Query q = session.createQuery(query.toString());
1084
1085 QueryPos qPos = QueryPos.getInstance(q);
1086
1087 qPos.add(groupId);
1088
1089 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, calEvent);
1090
1091 CalEvent[] array = new CalEventImpl[3];
1092
1093 array[0] = (CalEvent)objArray[0];
1094 array[1] = (CalEvent)objArray[1];
1095 array[2] = (CalEvent)objArray[2];
1096
1097 return array;
1098 }
1099 catch (Exception e) {
1100 throw processException(e);
1101 }
1102 finally {
1103 closeSession(session);
1104 }
1105 }
1106
1107 public List<CalEvent> findByRemindBy(int remindBy)
1108 throws SystemException {
1109 Object[] finderArgs = new Object[] { new Integer(remindBy) };
1110
1111 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_REMINDBY,
1112 finderArgs, this);
1113
1114 if (list == null) {
1115 Session session = null;
1116
1117 try {
1118 session = openSession();
1119
1120 StringBuilder query = new StringBuilder();
1121
1122 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1123
1124 query.append("calEvent.remindBy != ?");
1125
1126 query.append(" ");
1127
1128 query.append("ORDER BY ");
1129
1130 query.append("calEvent.startDate ASC, ");
1131 query.append("calEvent.title ASC");
1132
1133 Query q = session.createQuery(query.toString());
1134
1135 QueryPos qPos = QueryPos.getInstance(q);
1136
1137 qPos.add(remindBy);
1138
1139 list = q.list();
1140 }
1141 catch (Exception e) {
1142 throw processException(e);
1143 }
1144 finally {
1145 if (list == null) {
1146 list = new ArrayList<CalEvent>();
1147 }
1148
1149 cacheResult(list);
1150
1151 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_REMINDBY,
1152 finderArgs, list);
1153
1154 closeSession(session);
1155 }
1156 }
1157
1158 return list;
1159 }
1160
1161 public List<CalEvent> findByRemindBy(int remindBy, int start, int end)
1162 throws SystemException {
1163 return findByRemindBy(remindBy, start, end, null);
1164 }
1165
1166 public List<CalEvent> findByRemindBy(int remindBy, int start, int end,
1167 OrderByComparator obc) throws SystemException {
1168 Object[] finderArgs = new Object[] {
1169 new Integer(remindBy),
1170
1171 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1172 };
1173
1174 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_REMINDBY,
1175 finderArgs, this);
1176
1177 if (list == null) {
1178 Session session = null;
1179
1180 try {
1181 session = openSession();
1182
1183 StringBuilder query = new StringBuilder();
1184
1185 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1186
1187 query.append("calEvent.remindBy != ?");
1188
1189 query.append(" ");
1190
1191 if (obc != null) {
1192 query.append("ORDER BY ");
1193
1194 String[] orderByFields = obc.getOrderByFields();
1195
1196 for (int i = 0; i < orderByFields.length; i++) {
1197 query.append("calEvent.");
1198 query.append(orderByFields[i]);
1199
1200 if (obc.isAscending()) {
1201 query.append(" ASC");
1202 }
1203 else {
1204 query.append(" DESC");
1205 }
1206
1207 if ((i + 1) < orderByFields.length) {
1208 query.append(", ");
1209 }
1210 }
1211 }
1212
1213 else {
1214 query.append("ORDER BY ");
1215
1216 query.append("calEvent.startDate ASC, ");
1217 query.append("calEvent.title ASC");
1218 }
1219
1220 Query q = session.createQuery(query.toString());
1221
1222 QueryPos qPos = QueryPos.getInstance(q);
1223
1224 qPos.add(remindBy);
1225
1226 list = (List<CalEvent>)QueryUtil.list(q, getDialect(), start,
1227 end);
1228 }
1229 catch (Exception e) {
1230 throw processException(e);
1231 }
1232 finally {
1233 if (list == null) {
1234 list = new ArrayList<CalEvent>();
1235 }
1236
1237 cacheResult(list);
1238
1239 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_REMINDBY,
1240 finderArgs, list);
1241
1242 closeSession(session);
1243 }
1244 }
1245
1246 return list;
1247 }
1248
1249 public CalEvent findByRemindBy_First(int remindBy, OrderByComparator obc)
1250 throws NoSuchEventException, SystemException {
1251 List<CalEvent> list = findByRemindBy(remindBy, 0, 1, obc);
1252
1253 if (list.isEmpty()) {
1254 StringBuilder msg = new StringBuilder();
1255
1256 msg.append("No CalEvent exists with the key {");
1257
1258 msg.append("remindBy=" + remindBy);
1259
1260 msg.append(StringPool.CLOSE_CURLY_BRACE);
1261
1262 throw new NoSuchEventException(msg.toString());
1263 }
1264 else {
1265 return list.get(0);
1266 }
1267 }
1268
1269 public CalEvent findByRemindBy_Last(int remindBy, OrderByComparator obc)
1270 throws NoSuchEventException, SystemException {
1271 int count = countByRemindBy(remindBy);
1272
1273 List<CalEvent> list = findByRemindBy(remindBy, count - 1, count, obc);
1274
1275 if (list.isEmpty()) {
1276 StringBuilder msg = new StringBuilder();
1277
1278 msg.append("No CalEvent exists with the key {");
1279
1280 msg.append("remindBy=" + remindBy);
1281
1282 msg.append(StringPool.CLOSE_CURLY_BRACE);
1283
1284 throw new NoSuchEventException(msg.toString());
1285 }
1286 else {
1287 return list.get(0);
1288 }
1289 }
1290
1291 public CalEvent[] findByRemindBy_PrevAndNext(long eventId, int remindBy,
1292 OrderByComparator obc) throws NoSuchEventException, SystemException {
1293 CalEvent calEvent = findByPrimaryKey(eventId);
1294
1295 int count = countByRemindBy(remindBy);
1296
1297 Session session = null;
1298
1299 try {
1300 session = openSession();
1301
1302 StringBuilder query = new StringBuilder();
1303
1304 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1305
1306 query.append("calEvent.remindBy != ?");
1307
1308 query.append(" ");
1309
1310 if (obc != null) {
1311 query.append("ORDER BY ");
1312
1313 String[] orderByFields = obc.getOrderByFields();
1314
1315 for (int i = 0; i < orderByFields.length; i++) {
1316 query.append("calEvent.");
1317 query.append(orderByFields[i]);
1318
1319 if (obc.isAscending()) {
1320 query.append(" ASC");
1321 }
1322 else {
1323 query.append(" DESC");
1324 }
1325
1326 if ((i + 1) < orderByFields.length) {
1327 query.append(", ");
1328 }
1329 }
1330 }
1331
1332 else {
1333 query.append("ORDER BY ");
1334
1335 query.append("calEvent.startDate ASC, ");
1336 query.append("calEvent.title ASC");
1337 }
1338
1339 Query q = session.createQuery(query.toString());
1340
1341 QueryPos qPos = QueryPos.getInstance(q);
1342
1343 qPos.add(remindBy);
1344
1345 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, calEvent);
1346
1347 CalEvent[] array = new CalEventImpl[3];
1348
1349 array[0] = (CalEvent)objArray[0];
1350 array[1] = (CalEvent)objArray[1];
1351 array[2] = (CalEvent)objArray[2];
1352
1353 return array;
1354 }
1355 catch (Exception e) {
1356 throw processException(e);
1357 }
1358 finally {
1359 closeSession(session);
1360 }
1361 }
1362
1363 public List<CalEvent> findByG_T(long groupId, String type)
1364 throws SystemException {
1365 Object[] finderArgs = new Object[] { new Long(groupId), type };
1366
1367 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_T,
1368 finderArgs, this);
1369
1370 if (list == null) {
1371 Session session = null;
1372
1373 try {
1374 session = openSession();
1375
1376 StringBuilder query = new StringBuilder();
1377
1378 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1379
1380 query.append("calEvent.groupId = ?");
1381
1382 query.append(" AND ");
1383
1384 if (type == null) {
1385 query.append("calEvent.type IS NULL");
1386 }
1387 else {
1388 query.append("calEvent.type = ?");
1389 }
1390
1391 query.append(" ");
1392
1393 query.append("ORDER BY ");
1394
1395 query.append("calEvent.startDate ASC, ");
1396 query.append("calEvent.title ASC");
1397
1398 Query q = session.createQuery(query.toString());
1399
1400 QueryPos qPos = QueryPos.getInstance(q);
1401
1402 qPos.add(groupId);
1403
1404 if (type != null) {
1405 qPos.add(type);
1406 }
1407
1408 list = q.list();
1409 }
1410 catch (Exception e) {
1411 throw processException(e);
1412 }
1413 finally {
1414 if (list == null) {
1415 list = new ArrayList<CalEvent>();
1416 }
1417
1418 cacheResult(list);
1419
1420 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_T, finderArgs,
1421 list);
1422
1423 closeSession(session);
1424 }
1425 }
1426
1427 return list;
1428 }
1429
1430 public List<CalEvent> findByG_T(long groupId, String type, int start,
1431 int end) throws SystemException {
1432 return findByG_T(groupId, type, start, end, null);
1433 }
1434
1435 public List<CalEvent> findByG_T(long groupId, String type, int start,
1436 int end, OrderByComparator obc) throws SystemException {
1437 Object[] finderArgs = new Object[] {
1438 new Long(groupId),
1439
1440 type,
1441
1442 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1443 };
1444
1445 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_T,
1446 finderArgs, this);
1447
1448 if (list == null) {
1449 Session session = null;
1450
1451 try {
1452 session = openSession();
1453
1454 StringBuilder query = new StringBuilder();
1455
1456 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1457
1458 query.append("calEvent.groupId = ?");
1459
1460 query.append(" AND ");
1461
1462 if (type == null) {
1463 query.append("calEvent.type IS NULL");
1464 }
1465 else {
1466 query.append("calEvent.type = ?");
1467 }
1468
1469 query.append(" ");
1470
1471 if (obc != null) {
1472 query.append("ORDER BY ");
1473
1474 String[] orderByFields = obc.getOrderByFields();
1475
1476 for (int i = 0; i < orderByFields.length; i++) {
1477 query.append("calEvent.");
1478 query.append(orderByFields[i]);
1479
1480 if (obc.isAscending()) {
1481 query.append(" ASC");
1482 }
1483 else {
1484 query.append(" DESC");
1485 }
1486
1487 if ((i + 1) < orderByFields.length) {
1488 query.append(", ");
1489 }
1490 }
1491 }
1492
1493 else {
1494 query.append("ORDER BY ");
1495
1496 query.append("calEvent.startDate ASC, ");
1497 query.append("calEvent.title ASC");
1498 }
1499
1500 Query q = session.createQuery(query.toString());
1501
1502 QueryPos qPos = QueryPos.getInstance(q);
1503
1504 qPos.add(groupId);
1505
1506 if (type != null) {
1507 qPos.add(type);
1508 }
1509
1510 list = (List<CalEvent>)QueryUtil.list(q, getDialect(), start,
1511 end);
1512 }
1513 catch (Exception e) {
1514 throw processException(e);
1515 }
1516 finally {
1517 if (list == null) {
1518 list = new ArrayList<CalEvent>();
1519 }
1520
1521 cacheResult(list);
1522
1523 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_T,
1524 finderArgs, list);
1525
1526 closeSession(session);
1527 }
1528 }
1529
1530 return list;
1531 }
1532
1533 public CalEvent findByG_T_First(long groupId, String type,
1534 OrderByComparator obc) throws NoSuchEventException, SystemException {
1535 List<CalEvent> list = findByG_T(groupId, type, 0, 1, obc);
1536
1537 if (list.isEmpty()) {
1538 StringBuilder msg = new StringBuilder();
1539
1540 msg.append("No CalEvent exists with the key {");
1541
1542 msg.append("groupId=" + groupId);
1543
1544 msg.append(", ");
1545 msg.append("type=" + type);
1546
1547 msg.append(StringPool.CLOSE_CURLY_BRACE);
1548
1549 throw new NoSuchEventException(msg.toString());
1550 }
1551 else {
1552 return list.get(0);
1553 }
1554 }
1555
1556 public CalEvent findByG_T_Last(long groupId, String type,
1557 OrderByComparator obc) throws NoSuchEventException, SystemException {
1558 int count = countByG_T(groupId, type);
1559
1560 List<CalEvent> list = findByG_T(groupId, type, count - 1, count, obc);
1561
1562 if (list.isEmpty()) {
1563 StringBuilder msg = new StringBuilder();
1564
1565 msg.append("No CalEvent exists with the key {");
1566
1567 msg.append("groupId=" + groupId);
1568
1569 msg.append(", ");
1570 msg.append("type=" + type);
1571
1572 msg.append(StringPool.CLOSE_CURLY_BRACE);
1573
1574 throw new NoSuchEventException(msg.toString());
1575 }
1576 else {
1577 return list.get(0);
1578 }
1579 }
1580
1581 public CalEvent[] findByG_T_PrevAndNext(long eventId, long groupId,
1582 String type, OrderByComparator obc)
1583 throws NoSuchEventException, SystemException {
1584 CalEvent calEvent = findByPrimaryKey(eventId);
1585
1586 int count = countByG_T(groupId, type);
1587
1588 Session session = null;
1589
1590 try {
1591 session = openSession();
1592
1593 StringBuilder query = new StringBuilder();
1594
1595 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1596
1597 query.append("calEvent.groupId = ?");
1598
1599 query.append(" AND ");
1600
1601 if (type == null) {
1602 query.append("calEvent.type IS NULL");
1603 }
1604 else {
1605 query.append("calEvent.type = ?");
1606 }
1607
1608 query.append(" ");
1609
1610 if (obc != null) {
1611 query.append("ORDER BY ");
1612
1613 String[] orderByFields = obc.getOrderByFields();
1614
1615 for (int i = 0; i < orderByFields.length; i++) {
1616 query.append("calEvent.");
1617 query.append(orderByFields[i]);
1618
1619 if (obc.isAscending()) {
1620 query.append(" ASC");
1621 }
1622 else {
1623 query.append(" DESC");
1624 }
1625
1626 if ((i + 1) < orderByFields.length) {
1627 query.append(", ");
1628 }
1629 }
1630 }
1631
1632 else {
1633 query.append("ORDER BY ");
1634
1635 query.append("calEvent.startDate ASC, ");
1636 query.append("calEvent.title ASC");
1637 }
1638
1639 Query q = session.createQuery(query.toString());
1640
1641 QueryPos qPos = QueryPos.getInstance(q);
1642
1643 qPos.add(groupId);
1644
1645 if (type != null) {
1646 qPos.add(type);
1647 }
1648
1649 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, calEvent);
1650
1651 CalEvent[] array = new CalEventImpl[3];
1652
1653 array[0] = (CalEvent)objArray[0];
1654 array[1] = (CalEvent)objArray[1];
1655 array[2] = (CalEvent)objArray[2];
1656
1657 return array;
1658 }
1659 catch (Exception e) {
1660 throw processException(e);
1661 }
1662 finally {
1663 closeSession(session);
1664 }
1665 }
1666
1667 public List<CalEvent> findByG_R(long groupId, boolean repeating)
1668 throws SystemException {
1669 Object[] finderArgs = new Object[] {
1670 new Long(groupId), Boolean.valueOf(repeating)
1671 };
1672
1673 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_R,
1674 finderArgs, this);
1675
1676 if (list == null) {
1677 Session session = null;
1678
1679 try {
1680 session = openSession();
1681
1682 StringBuilder query = new StringBuilder();
1683
1684 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1685
1686 query.append("calEvent.groupId = ?");
1687
1688 query.append(" AND ");
1689
1690 query.append("calEvent.repeating = ?");
1691
1692 query.append(" ");
1693
1694 query.append("ORDER BY ");
1695
1696 query.append("calEvent.startDate ASC, ");
1697 query.append("calEvent.title ASC");
1698
1699 Query q = session.createQuery(query.toString());
1700
1701 QueryPos qPos = QueryPos.getInstance(q);
1702
1703 qPos.add(groupId);
1704
1705 qPos.add(repeating);
1706
1707 list = q.list();
1708 }
1709 catch (Exception e) {
1710 throw processException(e);
1711 }
1712 finally {
1713 if (list == null) {
1714 list = new ArrayList<CalEvent>();
1715 }
1716
1717 cacheResult(list);
1718
1719 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_R, finderArgs,
1720 list);
1721
1722 closeSession(session);
1723 }
1724 }
1725
1726 return list;
1727 }
1728
1729 public List<CalEvent> findByG_R(long groupId, boolean repeating, int start,
1730 int end) throws SystemException {
1731 return findByG_R(groupId, repeating, start, end, null);
1732 }
1733
1734 public List<CalEvent> findByG_R(long groupId, boolean repeating, int start,
1735 int end, OrderByComparator obc) throws SystemException {
1736 Object[] finderArgs = new Object[] {
1737 new Long(groupId), Boolean.valueOf(repeating),
1738
1739 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1740 };
1741
1742 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_R,
1743 finderArgs, this);
1744
1745 if (list == null) {
1746 Session session = null;
1747
1748 try {
1749 session = openSession();
1750
1751 StringBuilder query = new StringBuilder();
1752
1753 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1754
1755 query.append("calEvent.groupId = ?");
1756
1757 query.append(" AND ");
1758
1759 query.append("calEvent.repeating = ?");
1760
1761 query.append(" ");
1762
1763 if (obc != null) {
1764 query.append("ORDER BY ");
1765
1766 String[] orderByFields = obc.getOrderByFields();
1767
1768 for (int i = 0; i < orderByFields.length; i++) {
1769 query.append("calEvent.");
1770 query.append(orderByFields[i]);
1771
1772 if (obc.isAscending()) {
1773 query.append(" ASC");
1774 }
1775 else {
1776 query.append(" DESC");
1777 }
1778
1779 if ((i + 1) < orderByFields.length) {
1780 query.append(", ");
1781 }
1782 }
1783 }
1784
1785 else {
1786 query.append("ORDER BY ");
1787
1788 query.append("calEvent.startDate ASC, ");
1789 query.append("calEvent.title ASC");
1790 }
1791
1792 Query q = session.createQuery(query.toString());
1793
1794 QueryPos qPos = QueryPos.getInstance(q);
1795
1796 qPos.add(groupId);
1797
1798 qPos.add(repeating);
1799
1800 list = (List<CalEvent>)QueryUtil.list(q, getDialect(), start,
1801 end);
1802 }
1803 catch (Exception e) {
1804 throw processException(e);
1805 }
1806 finally {
1807 if (list == null) {
1808 list = new ArrayList<CalEvent>();
1809 }
1810
1811 cacheResult(list);
1812
1813 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_R,
1814 finderArgs, list);
1815
1816 closeSession(session);
1817 }
1818 }
1819
1820 return list;
1821 }
1822
1823 public CalEvent findByG_R_First(long groupId, boolean repeating,
1824 OrderByComparator obc) throws NoSuchEventException, SystemException {
1825 List<CalEvent> list = findByG_R(groupId, repeating, 0, 1, obc);
1826
1827 if (list.isEmpty()) {
1828 StringBuilder msg = new StringBuilder();
1829
1830 msg.append("No CalEvent exists with the key {");
1831
1832 msg.append("groupId=" + groupId);
1833
1834 msg.append(", ");
1835 msg.append("repeating=" + repeating);
1836
1837 msg.append(StringPool.CLOSE_CURLY_BRACE);
1838
1839 throw new NoSuchEventException(msg.toString());
1840 }
1841 else {
1842 return list.get(0);
1843 }
1844 }
1845
1846 public CalEvent findByG_R_Last(long groupId, boolean repeating,
1847 OrderByComparator obc) throws NoSuchEventException, SystemException {
1848 int count = countByG_R(groupId, repeating);
1849
1850 List<CalEvent> list = findByG_R(groupId, repeating, count - 1, count,
1851 obc);
1852
1853 if (list.isEmpty()) {
1854 StringBuilder msg = new StringBuilder();
1855
1856 msg.append("No CalEvent exists with the key {");
1857
1858 msg.append("groupId=" + groupId);
1859
1860 msg.append(", ");
1861 msg.append("repeating=" + repeating);
1862
1863 msg.append(StringPool.CLOSE_CURLY_BRACE);
1864
1865 throw new NoSuchEventException(msg.toString());
1866 }
1867 else {
1868 return list.get(0);
1869 }
1870 }
1871
1872 public CalEvent[] findByG_R_PrevAndNext(long eventId, long groupId,
1873 boolean repeating, OrderByComparator obc)
1874 throws NoSuchEventException, SystemException {
1875 CalEvent calEvent = findByPrimaryKey(eventId);
1876
1877 int count = countByG_R(groupId, repeating);
1878
1879 Session session = null;
1880
1881 try {
1882 session = openSession();
1883
1884 StringBuilder query = new StringBuilder();
1885
1886 query.append("SELECT calEvent FROM CalEvent calEvent WHERE ");
1887
1888 query.append("calEvent.groupId = ?");
1889
1890 query.append(" AND ");
1891
1892 query.append("calEvent.repeating = ?");
1893
1894 query.append(" ");
1895
1896 if (obc != null) {
1897 query.append("ORDER BY ");
1898
1899 String[] orderByFields = obc.getOrderByFields();
1900
1901 for (int i = 0; i < orderByFields.length; i++) {
1902 query.append("calEvent.");
1903 query.append(orderByFields[i]);
1904
1905 if (obc.isAscending()) {
1906 query.append(" ASC");
1907 }
1908 else {
1909 query.append(" DESC");
1910 }
1911
1912 if ((i + 1) < orderByFields.length) {
1913 query.append(", ");
1914 }
1915 }
1916 }
1917
1918 else {
1919 query.append("ORDER BY ");
1920
1921 query.append("calEvent.startDate ASC, ");
1922 query.append("calEvent.title ASC");
1923 }
1924
1925 Query q = session.createQuery(query.toString());
1926
1927 QueryPos qPos = QueryPos.getInstance(q);
1928
1929 qPos.add(groupId);
1930
1931 qPos.add(repeating);
1932
1933 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, calEvent);
1934
1935 CalEvent[] array = new CalEventImpl[3];
1936
1937 array[0] = (CalEvent)objArray[0];
1938 array[1] = (CalEvent)objArray[1];
1939 array[2] = (CalEvent)objArray[2];
1940
1941 return array;
1942 }
1943 catch (Exception e) {
1944 throw processException(e);
1945 }
1946 finally {
1947 closeSession(session);
1948 }
1949 }
1950
1951 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1952 throws SystemException {
1953 Session session = null;
1954
1955 try {
1956 session = openSession();
1957
1958 dynamicQuery.compile(session);
1959
1960 return dynamicQuery.list();
1961 }
1962 catch (Exception e) {
1963 throw processException(e);
1964 }
1965 finally {
1966 closeSession(session);
1967 }
1968 }
1969
1970 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1971 int start, int end) throws SystemException {
1972 Session session = null;
1973
1974 try {
1975 session = openSession();
1976
1977 dynamicQuery.setLimit(start, end);
1978
1979 dynamicQuery.compile(session);
1980
1981 return dynamicQuery.list();
1982 }
1983 catch (Exception e) {
1984 throw processException(e);
1985 }
1986 finally {
1987 closeSession(session);
1988 }
1989 }
1990
1991 public List<CalEvent> findAll() throws SystemException {
1992 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1993 }
1994
1995 public List<CalEvent> findAll(int start, int end) throws SystemException {
1996 return findAll(start, end, null);
1997 }
1998
1999 public List<CalEvent> findAll(int start, int end, OrderByComparator obc)
2000 throws SystemException {
2001 Object[] finderArgs = new Object[] {
2002 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2003 };
2004
2005 List<CalEvent> list = (List<CalEvent>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2006 finderArgs, this);
2007
2008 if (list == null) {
2009 Session session = null;
2010
2011 try {
2012 session = openSession();
2013
2014 StringBuilder query = new StringBuilder();
2015
2016 query.append("SELECT calEvent FROM CalEvent calEvent ");
2017
2018 if (obc != null) {
2019 query.append("ORDER BY ");
2020
2021 String[] orderByFields = obc.getOrderByFields();
2022
2023 for (int i = 0; i < orderByFields.length; i++) {
2024 query.append("calEvent.");
2025 query.append(orderByFields[i]);
2026
2027 if (obc.isAscending()) {
2028 query.append(" ASC");
2029 }
2030 else {
2031 query.append(" DESC");
2032 }
2033
2034 if ((i + 1) < orderByFields.length) {
2035 query.append(", ");
2036 }
2037 }
2038 }
2039
2040 else {
2041 query.append("ORDER BY ");
2042
2043 query.append("calEvent.startDate ASC, ");
2044 query.append("calEvent.title ASC");
2045 }
2046
2047 Query q = session.createQuery(query.toString());
2048
2049 if (obc == null) {
2050 list = (List<CalEvent>)QueryUtil.list(q, getDialect(),
2051 start, end, false);
2052
2053 Collections.sort(list);
2054 }
2055 else {
2056 list = (List<CalEvent>)QueryUtil.list(q, getDialect(),
2057 start, end);
2058 }
2059 }
2060 catch (Exception e) {
2061 throw processException(e);
2062 }
2063 finally {
2064 if (list == null) {
2065 list = new ArrayList<CalEvent>();
2066 }
2067
2068 cacheResult(list);
2069
2070 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2071
2072 closeSession(session);
2073 }
2074 }
2075
2076 return list;
2077 }
2078
2079 public void removeByUuid(String uuid) throws SystemException {
2080 for (CalEvent calEvent : findByUuid(uuid)) {
2081 remove(calEvent);
2082 }
2083 }
2084
2085 public void removeByUUID_G(String uuid, long groupId)
2086 throws NoSuchEventException, SystemException {
2087 CalEvent calEvent = findByUUID_G(uuid, groupId);
2088
2089 remove(calEvent);
2090 }
2091
2092 public void removeByGroupId(long groupId) throws SystemException {
2093 for (CalEvent calEvent : findByGroupId(groupId)) {
2094 remove(calEvent);
2095 }
2096 }
2097
2098 public void removeByRemindBy(int remindBy) throws SystemException {
2099 for (CalEvent calEvent : findByRemindBy(remindBy)) {
2100 remove(calEvent);
2101 }
2102 }
2103
2104 public void removeByG_T(long groupId, String type)
2105 throws SystemException {
2106 for (CalEvent calEvent : findByG_T(groupId, type)) {
2107 remove(calEvent);
2108 }
2109 }
2110
2111 public void removeByG_R(long groupId, boolean repeating)
2112 throws SystemException {
2113 for (CalEvent calEvent : findByG_R(groupId, repeating)) {
2114 remove(calEvent);
2115 }
2116 }
2117
2118 public void removeAll() throws SystemException {
2119 for (CalEvent calEvent : findAll()) {
2120 remove(calEvent);
2121 }
2122 }
2123
2124 public int countByUuid(String uuid) throws SystemException {
2125 Object[] finderArgs = new Object[] { uuid };
2126
2127 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2128 finderArgs, this);
2129
2130 if (count == null) {
2131 Session session = null;
2132
2133 try {
2134 session = openSession();
2135
2136 StringBuilder query = new StringBuilder();
2137
2138 query.append("SELECT COUNT(calEvent) ");
2139 query.append("FROM CalEvent calEvent WHERE ");
2140
2141 if (uuid == null) {
2142 query.append("calEvent.uuid IS NULL");
2143 }
2144 else {
2145 query.append("calEvent.uuid = ?");
2146 }
2147
2148 query.append(" ");
2149
2150 Query q = session.createQuery(query.toString());
2151
2152 QueryPos qPos = QueryPos.getInstance(q);
2153
2154 if (uuid != null) {
2155 qPos.add(uuid);
2156 }
2157
2158 count = (Long)q.uniqueResult();
2159 }
2160 catch (Exception e) {
2161 throw processException(e);
2162 }
2163 finally {
2164 if (count == null) {
2165 count = Long.valueOf(0);
2166 }
2167
2168 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2169 finderArgs, count);
2170
2171 closeSession(session);
2172 }
2173 }
2174
2175 return count.intValue();
2176 }
2177
2178 public int countByUUID_G(String uuid, long groupId)
2179 throws SystemException {
2180 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
2181
2182 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2183 finderArgs, this);
2184
2185 if (count == null) {
2186 Session session = null;
2187
2188 try {
2189 session = openSession();
2190
2191 StringBuilder query = new StringBuilder();
2192
2193 query.append("SELECT COUNT(calEvent) ");
2194 query.append("FROM CalEvent calEvent WHERE ");
2195
2196 if (uuid == null) {
2197 query.append("calEvent.uuid IS NULL");
2198 }
2199 else {
2200 query.append("calEvent.uuid = ?");
2201 }
2202
2203 query.append(" AND ");
2204
2205 query.append("calEvent.groupId = ?");
2206
2207 query.append(" ");
2208
2209 Query q = session.createQuery(query.toString());
2210
2211 QueryPos qPos = QueryPos.getInstance(q);
2212
2213 if (uuid != null) {
2214 qPos.add(uuid);
2215 }
2216
2217 qPos.add(groupId);
2218
2219 count = (Long)q.uniqueResult();
2220 }
2221 catch (Exception e) {
2222 throw processException(e);
2223 }
2224 finally {
2225 if (count == null) {
2226 count = Long.valueOf(0);
2227 }
2228
2229 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2230 finderArgs, count);
2231
2232 closeSession(session);
2233 }
2234 }
2235
2236 return count.intValue();
2237 }
2238
2239 public int countByGroupId(long groupId) throws SystemException {
2240 Object[] finderArgs = new Object[] { new Long(groupId) };
2241
2242 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2243 finderArgs, this);
2244
2245 if (count == null) {
2246 Session session = null;
2247
2248 try {
2249 session = openSession();
2250
2251 StringBuilder query = new StringBuilder();
2252
2253 query.append("SELECT COUNT(calEvent) ");
2254 query.append("FROM CalEvent calEvent WHERE ");
2255
2256 query.append("calEvent.groupId = ?");
2257
2258 query.append(" ");
2259
2260 Query q = session.createQuery(query.toString());
2261
2262 QueryPos qPos = QueryPos.getInstance(q);
2263
2264 qPos.add(groupId);
2265
2266 count = (Long)q.uniqueResult();
2267 }
2268 catch (Exception e) {
2269 throw processException(e);
2270 }
2271 finally {
2272 if (count == null) {
2273 count = Long.valueOf(0);
2274 }
2275
2276 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2277 finderArgs, count);
2278
2279 closeSession(session);
2280 }
2281 }
2282
2283 return count.intValue();
2284 }
2285
2286 public int countByRemindBy(int remindBy) throws SystemException {
2287 Object[] finderArgs = new Object[] { new Integer(remindBy) };
2288
2289 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_REMINDBY,
2290 finderArgs, this);
2291
2292 if (count == null) {
2293 Session session = null;
2294
2295 try {
2296 session = openSession();
2297
2298 StringBuilder query = new StringBuilder();
2299
2300 query.append("SELECT COUNT(calEvent) ");
2301 query.append("FROM CalEvent calEvent WHERE ");
2302
2303 query.append("calEvent.remindBy != ?");
2304
2305 query.append(" ");
2306
2307 Query q = session.createQuery(query.toString());
2308
2309 QueryPos qPos = QueryPos.getInstance(q);
2310
2311 qPos.add(remindBy);
2312
2313 count = (Long)q.uniqueResult();
2314 }
2315 catch (Exception e) {
2316 throw processException(e);
2317 }
2318 finally {
2319 if (count == null) {
2320 count = Long.valueOf(0);
2321 }
2322
2323 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_REMINDBY,
2324 finderArgs, count);
2325
2326 closeSession(session);
2327 }
2328 }
2329
2330 return count.intValue();
2331 }
2332
2333 public int countByG_T(long groupId, String type) throws SystemException {
2334 Object[] finderArgs = new Object[] { new Long(groupId), type };
2335
2336 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_T,
2337 finderArgs, this);
2338
2339 if (count == null) {
2340 Session session = null;
2341
2342 try {
2343 session = openSession();
2344
2345 StringBuilder query = new StringBuilder();
2346
2347 query.append("SELECT COUNT(calEvent) ");
2348 query.append("FROM CalEvent calEvent WHERE ");
2349
2350 query.append("calEvent.groupId = ?");
2351
2352 query.append(" AND ");
2353
2354 if (type == null) {
2355 query.append("calEvent.type IS NULL");
2356 }
2357 else {
2358 query.append("calEvent.type = ?");
2359 }
2360
2361 query.append(" ");
2362
2363 Query q = session.createQuery(query.toString());
2364
2365 QueryPos qPos = QueryPos.getInstance(q);
2366
2367 qPos.add(groupId);
2368
2369 if (type != null) {
2370 qPos.add(type);
2371 }
2372
2373 count = (Long)q.uniqueResult();
2374 }
2375 catch (Exception e) {
2376 throw processException(e);
2377 }
2378 finally {
2379 if (count == null) {
2380 count = Long.valueOf(0);
2381 }
2382
2383 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_T, finderArgs,
2384 count);
2385
2386 closeSession(session);
2387 }
2388 }
2389
2390 return count.intValue();
2391 }
2392
2393 public int countByG_R(long groupId, boolean repeating)
2394 throws SystemException {
2395 Object[] finderArgs = new Object[] {
2396 new Long(groupId), Boolean.valueOf(repeating)
2397 };
2398
2399 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
2400 finderArgs, this);
2401
2402 if (count == null) {
2403 Session session = null;
2404
2405 try {
2406 session = openSession();
2407
2408 StringBuilder query = new StringBuilder();
2409
2410 query.append("SELECT COUNT(calEvent) ");
2411 query.append("FROM CalEvent calEvent WHERE ");
2412
2413 query.append("calEvent.groupId = ?");
2414
2415 query.append(" AND ");
2416
2417 query.append("calEvent.repeating = ?");
2418
2419 query.append(" ");
2420
2421 Query q = session.createQuery(query.toString());
2422
2423 QueryPos qPos = QueryPos.getInstance(q);
2424
2425 qPos.add(groupId);
2426
2427 qPos.add(repeating);
2428
2429 count = (Long)q.uniqueResult();
2430 }
2431 catch (Exception e) {
2432 throw processException(e);
2433 }
2434 finally {
2435 if (count == null) {
2436 count = Long.valueOf(0);
2437 }
2438
2439 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_R, finderArgs,
2440 count);
2441
2442 closeSession(session);
2443 }
2444 }
2445
2446 return count.intValue();
2447 }
2448
2449 public int countAll() throws SystemException {
2450 Object[] finderArgs = new Object[0];
2451
2452 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2453 finderArgs, this);
2454
2455 if (count == null) {
2456 Session session = null;
2457
2458 try {
2459 session = openSession();
2460
2461 Query q = session.createQuery(
2462 "SELECT COUNT(calEvent) FROM CalEvent calEvent");
2463
2464 count = (Long)q.uniqueResult();
2465 }
2466 catch (Exception e) {
2467 throw processException(e);
2468 }
2469 finally {
2470 if (count == null) {
2471 count = Long.valueOf(0);
2472 }
2473
2474 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2475 count);
2476
2477 closeSession(session);
2478 }
2479 }
2480
2481 return count.intValue();
2482 }
2483
2484 public void afterPropertiesSet() {
2485 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2486 com.liferay.portal.util.PropsUtil.get(
2487 "value.object.listener.com.liferay.portlet.calendar.model.CalEvent")));
2488
2489 if (listenerClassNames.length > 0) {
2490 try {
2491 List<ModelListener<CalEvent>> listenersList = new ArrayList<ModelListener<CalEvent>>();
2492
2493 for (String listenerClassName : listenerClassNames) {
2494 listenersList.add((ModelListener<CalEvent>)Class.forName(
2495 listenerClassName).newInstance());
2496 }
2497
2498 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2499 }
2500 catch (Exception e) {
2501 _log.error(e);
2502 }
2503 }
2504 }
2505
2506 @BeanReference(name = "com.liferay.portlet.calendar.service.persistence.CalEventPersistence.impl")
2507 protected com.liferay.portlet.calendar.service.persistence.CalEventPersistence calEventPersistence;
2508 @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
2509 protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
2510 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
2511 protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
2512 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
2513 protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
2514 @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
2515 protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
2516 @BeanReference(name = "com.liferay.portlet.social.service.persistence.SocialActivityPersistence.impl")
2517 protected com.liferay.portlet.social.service.persistence.SocialActivityPersistence socialActivityPersistence;
2518 private static Log _log = LogFactoryUtil.getLog(CalEventPersistenceImpl.class);
2519}