001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchSubscriptionException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.ModelListener;
039 import com.liferay.portal.model.Subscription;
040 import com.liferay.portal.model.impl.SubscriptionImpl;
041 import com.liferay.portal.model.impl.SubscriptionModelImpl;
042 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043
044 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
045 import com.liferay.portlet.messageboards.service.persistence.MBThreadPersistence;
046 import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
047
048 import java.io.Serializable;
049
050 import java.util.ArrayList;
051 import java.util.Collections;
052 import java.util.List;
053
054
066 public class SubscriptionPersistenceImpl extends BasePersistenceImpl<Subscription>
067 implements SubscriptionPersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = SubscriptionImpl.class.getName();
074 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075 ".List1";
076 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077 ".List2";
078 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
079 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
080 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserId",
081 new String[] {
082 Long.class.getName(),
083
084 "java.lang.Integer", "java.lang.Integer",
085 "com.liferay.portal.kernel.util.OrderByComparator"
086 });
087 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
088 new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
089 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
090 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
091 new String[] { Long.class.getName() },
092 SubscriptionModelImpl.USERID_COLUMN_BITMASK);
093 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
094 SubscriptionModelImpl.FINDER_CACHE_ENABLED, Long.class,
095 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
096 new String[] { Long.class.getName() });
097 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_U_C = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
098 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
099 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByU_C",
100 new String[] {
101 Long.class.getName(), Long.class.getName(),
102
103 "java.lang.Integer", "java.lang.Integer",
104 "com.liferay.portal.kernel.util.OrderByComparator"
105 });
106 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
107 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
108 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByU_C",
109 new String[] { Long.class.getName(), Long.class.getName() },
110 SubscriptionModelImpl.USERID_COLUMN_BITMASK |
111 SubscriptionModelImpl.CLASSNAMEID_COLUMN_BITMASK);
112 public static final FinderPath FINDER_PATH_COUNT_BY_U_C = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
113 SubscriptionModelImpl.FINDER_CACHE_ENABLED, Long.class,
114 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByU_C",
115 new String[] { Long.class.getName(), Long.class.getName() });
116 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
117 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
118 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_C",
119 new String[] {
120 Long.class.getName(), Long.class.getName(), Long.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_WITHOUT_PAGINATION_FIND_BY_C_C_C = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
126 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
127 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_C",
128 new String[] {
129 Long.class.getName(), Long.class.getName(), Long.class.getName()
130 },
131 SubscriptionModelImpl.COMPANYID_COLUMN_BITMASK |
132 SubscriptionModelImpl.CLASSNAMEID_COLUMN_BITMASK |
133 SubscriptionModelImpl.CLASSPK_COLUMN_BITMASK);
134 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
135 SubscriptionModelImpl.FINDER_CACHE_ENABLED, Long.class,
136 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_C",
137 new String[] {
138 Long.class.getName(), Long.class.getName(), Long.class.getName()
139 });
140 public static final FinderPath FINDER_PATH_FETCH_BY_C_U_C_C = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
141 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
142 FINDER_CLASS_NAME_ENTITY, "fetchByC_U_C_C",
143 new String[] {
144 Long.class.getName(), Long.class.getName(), Long.class.getName(),
145 Long.class.getName()
146 },
147 SubscriptionModelImpl.COMPANYID_COLUMN_BITMASK |
148 SubscriptionModelImpl.USERID_COLUMN_BITMASK |
149 SubscriptionModelImpl.CLASSNAMEID_COLUMN_BITMASK |
150 SubscriptionModelImpl.CLASSPK_COLUMN_BITMASK);
151 public static final FinderPath FINDER_PATH_COUNT_BY_C_U_C_C = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
152 SubscriptionModelImpl.FINDER_CACHE_ENABLED, Long.class,
153 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_U_C_C",
154 new String[] {
155 Long.class.getName(), Long.class.getName(), Long.class.getName(),
156 Long.class.getName()
157 });
158 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
159 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
160 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
161 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
162 SubscriptionModelImpl.FINDER_CACHE_ENABLED, SubscriptionImpl.class,
163 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
164 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
165 SubscriptionModelImpl.FINDER_CACHE_ENABLED, Long.class,
166 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
167
168
173 public void cacheResult(Subscription subscription) {
174 EntityCacheUtil.putResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
175 SubscriptionImpl.class, subscription.getPrimaryKey(), subscription);
176
177 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
178 new Object[] {
179 Long.valueOf(subscription.getCompanyId()),
180 Long.valueOf(subscription.getUserId()),
181 Long.valueOf(subscription.getClassNameId()),
182 Long.valueOf(subscription.getClassPK())
183 }, subscription);
184
185 subscription.resetOriginalValues();
186 }
187
188
193 public void cacheResult(List<Subscription> subscriptions) {
194 for (Subscription subscription : subscriptions) {
195 if (EntityCacheUtil.getResult(
196 SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
197 SubscriptionImpl.class, subscription.getPrimaryKey()) == null) {
198 cacheResult(subscription);
199 }
200 else {
201 subscription.resetOriginalValues();
202 }
203 }
204 }
205
206
213 @Override
214 public void clearCache() {
215 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
216 CacheRegistryUtil.clear(SubscriptionImpl.class.getName());
217 }
218
219 EntityCacheUtil.clearCache(SubscriptionImpl.class.getName());
220
221 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
222 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
223 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
224 }
225
226
233 @Override
234 public void clearCache(Subscription subscription) {
235 EntityCacheUtil.removeResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
236 SubscriptionImpl.class, subscription.getPrimaryKey());
237
238 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
239 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
240
241 clearUniqueFindersCache(subscription);
242 }
243
244 @Override
245 public void clearCache(List<Subscription> subscriptions) {
246 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
247 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
248
249 for (Subscription subscription : subscriptions) {
250 EntityCacheUtil.removeResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
251 SubscriptionImpl.class, subscription.getPrimaryKey());
252
253 clearUniqueFindersCache(subscription);
254 }
255 }
256
257 protected void clearUniqueFindersCache(Subscription subscription) {
258 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U_C_C,
259 new Object[] {
260 Long.valueOf(subscription.getCompanyId()),
261 Long.valueOf(subscription.getUserId()),
262 Long.valueOf(subscription.getClassNameId()),
263 Long.valueOf(subscription.getClassPK())
264 });
265 }
266
267
273 public Subscription create(long subscriptionId) {
274 Subscription subscription = new SubscriptionImpl();
275
276 subscription.setNew(true);
277 subscription.setPrimaryKey(subscriptionId);
278
279 return subscription;
280 }
281
282
290 public Subscription remove(long subscriptionId)
291 throws NoSuchSubscriptionException, SystemException {
292 return remove(Long.valueOf(subscriptionId));
293 }
294
295
303 @Override
304 public Subscription remove(Serializable primaryKey)
305 throws NoSuchSubscriptionException, SystemException {
306 Session session = null;
307
308 try {
309 session = openSession();
310
311 Subscription subscription = (Subscription)session.get(SubscriptionImpl.class,
312 primaryKey);
313
314 if (subscription == null) {
315 if (_log.isWarnEnabled()) {
316 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
317 }
318
319 throw new NoSuchSubscriptionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
320 primaryKey);
321 }
322
323 return remove(subscription);
324 }
325 catch (NoSuchSubscriptionException nsee) {
326 throw nsee;
327 }
328 catch (Exception e) {
329 throw processException(e);
330 }
331 finally {
332 closeSession(session);
333 }
334 }
335
336 @Override
337 protected Subscription removeImpl(Subscription subscription)
338 throws SystemException {
339 subscription = toUnwrappedModel(subscription);
340
341 Session session = null;
342
343 try {
344 session = openSession();
345
346 BatchSessionUtil.delete(session, subscription);
347 }
348 catch (Exception e) {
349 throw processException(e);
350 }
351 finally {
352 closeSession(session);
353 }
354
355 clearCache(subscription);
356
357 return subscription;
358 }
359
360 @Override
361 public Subscription updateImpl(
362 com.liferay.portal.model.Subscription subscription, boolean merge)
363 throws SystemException {
364 subscription = toUnwrappedModel(subscription);
365
366 boolean isNew = subscription.isNew();
367
368 SubscriptionModelImpl subscriptionModelImpl = (SubscriptionModelImpl)subscription;
369
370 Session session = null;
371
372 try {
373 session = openSession();
374
375 BatchSessionUtil.update(session, subscription, merge);
376
377 subscription.setNew(false);
378 }
379 catch (Exception e) {
380 throw processException(e);
381 }
382 finally {
383 closeSession(session);
384 }
385
386 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
387
388 if (isNew || !SubscriptionModelImpl.COLUMN_BITMASK_ENABLED) {
389 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
390 }
391
392 else {
393 if ((subscriptionModelImpl.getColumnBitmask() &
394 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
395 Object[] args = new Object[] {
396 Long.valueOf(subscriptionModelImpl.getOriginalUserId())
397 };
398
399 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
400 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
401 args);
402
403 args = new Object[] {
404 Long.valueOf(subscriptionModelImpl.getUserId())
405 };
406
407 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
408 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
409 args);
410 }
411
412 if ((subscriptionModelImpl.getColumnBitmask() &
413 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C.getColumnBitmask()) != 0) {
414 Object[] args = new Object[] {
415 Long.valueOf(subscriptionModelImpl.getOriginalUserId()),
416 Long.valueOf(subscriptionModelImpl.getOriginalClassNameId())
417 };
418
419 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_C, args);
420 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C,
421 args);
422
423 args = new Object[] {
424 Long.valueOf(subscriptionModelImpl.getUserId()),
425 Long.valueOf(subscriptionModelImpl.getClassNameId())
426 };
427
428 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_C, args);
429 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C,
430 args);
431 }
432
433 if ((subscriptionModelImpl.getColumnBitmask() &
434 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C.getColumnBitmask()) != 0) {
435 Object[] args = new Object[] {
436 Long.valueOf(subscriptionModelImpl.getOriginalCompanyId()),
437 Long.valueOf(subscriptionModelImpl.getOriginalClassNameId()),
438 Long.valueOf(subscriptionModelImpl.getOriginalClassPK())
439 };
440
441 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
442 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
443 args);
444
445 args = new Object[] {
446 Long.valueOf(subscriptionModelImpl.getCompanyId()),
447 Long.valueOf(subscriptionModelImpl.getClassNameId()),
448 Long.valueOf(subscriptionModelImpl.getClassPK())
449 };
450
451 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
452 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
453 args);
454 }
455 }
456
457 EntityCacheUtil.putResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
458 SubscriptionImpl.class, subscription.getPrimaryKey(), subscription);
459
460 if (isNew) {
461 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
462 new Object[] {
463 Long.valueOf(subscription.getCompanyId()),
464 Long.valueOf(subscription.getUserId()),
465 Long.valueOf(subscription.getClassNameId()),
466 Long.valueOf(subscription.getClassPK())
467 }, subscription);
468 }
469 else {
470 if ((subscriptionModelImpl.getColumnBitmask() &
471 FINDER_PATH_FETCH_BY_C_U_C_C.getColumnBitmask()) != 0) {
472 Object[] args = new Object[] {
473 Long.valueOf(subscriptionModelImpl.getOriginalCompanyId()),
474 Long.valueOf(subscriptionModelImpl.getOriginalUserId()),
475 Long.valueOf(subscriptionModelImpl.getOriginalClassNameId()),
476 Long.valueOf(subscriptionModelImpl.getOriginalClassPK())
477 };
478
479 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U_C_C, args);
480 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U_C_C, args);
481
482 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
483 new Object[] {
484 Long.valueOf(subscription.getCompanyId()),
485 Long.valueOf(subscription.getUserId()),
486 Long.valueOf(subscription.getClassNameId()),
487 Long.valueOf(subscription.getClassPK())
488 }, subscription);
489 }
490 }
491
492 return subscription;
493 }
494
495 protected Subscription toUnwrappedModel(Subscription subscription) {
496 if (subscription instanceof SubscriptionImpl) {
497 return subscription;
498 }
499
500 SubscriptionImpl subscriptionImpl = new SubscriptionImpl();
501
502 subscriptionImpl.setNew(subscription.isNew());
503 subscriptionImpl.setPrimaryKey(subscription.getPrimaryKey());
504
505 subscriptionImpl.setSubscriptionId(subscription.getSubscriptionId());
506 subscriptionImpl.setCompanyId(subscription.getCompanyId());
507 subscriptionImpl.setUserId(subscription.getUserId());
508 subscriptionImpl.setUserName(subscription.getUserName());
509 subscriptionImpl.setCreateDate(subscription.getCreateDate());
510 subscriptionImpl.setModifiedDate(subscription.getModifiedDate());
511 subscriptionImpl.setClassNameId(subscription.getClassNameId());
512 subscriptionImpl.setClassPK(subscription.getClassPK());
513 subscriptionImpl.setFrequency(subscription.getFrequency());
514
515 return subscriptionImpl;
516 }
517
518
526 @Override
527 public Subscription findByPrimaryKey(Serializable primaryKey)
528 throws NoSuchModelException, SystemException {
529 return findByPrimaryKey(((Long)primaryKey).longValue());
530 }
531
532
540 public Subscription findByPrimaryKey(long subscriptionId)
541 throws NoSuchSubscriptionException, SystemException {
542 Subscription subscription = fetchByPrimaryKey(subscriptionId);
543
544 if (subscription == null) {
545 if (_log.isWarnEnabled()) {
546 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + subscriptionId);
547 }
548
549 throw new NoSuchSubscriptionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
550 subscriptionId);
551 }
552
553 return subscription;
554 }
555
556
563 @Override
564 public Subscription fetchByPrimaryKey(Serializable primaryKey)
565 throws SystemException {
566 return fetchByPrimaryKey(((Long)primaryKey).longValue());
567 }
568
569
576 public Subscription fetchByPrimaryKey(long subscriptionId)
577 throws SystemException {
578 Subscription subscription = (Subscription)EntityCacheUtil.getResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
579 SubscriptionImpl.class, subscriptionId);
580
581 if (subscription == _nullSubscription) {
582 return null;
583 }
584
585 if (subscription == null) {
586 Session session = null;
587
588 boolean hasException = false;
589
590 try {
591 session = openSession();
592
593 subscription = (Subscription)session.get(SubscriptionImpl.class,
594 Long.valueOf(subscriptionId));
595 }
596 catch (Exception e) {
597 hasException = true;
598
599 throw processException(e);
600 }
601 finally {
602 if (subscription != null) {
603 cacheResult(subscription);
604 }
605 else if (!hasException) {
606 EntityCacheUtil.putResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
607 SubscriptionImpl.class, subscriptionId,
608 _nullSubscription);
609 }
610
611 closeSession(session);
612 }
613 }
614
615 return subscription;
616 }
617
618
625 public List<Subscription> findByUserId(long userId)
626 throws SystemException {
627 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
628 }
629
630
643 public List<Subscription> findByUserId(long userId, int start, int end)
644 throws SystemException {
645 return findByUserId(userId, start, end, null);
646 }
647
648
662 public List<Subscription> findByUserId(long userId, int start, int end,
663 OrderByComparator orderByComparator) throws SystemException {
664 FinderPath finderPath = null;
665 Object[] finderArgs = null;
666
667 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
668 (orderByComparator == null)) {
669 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
670 finderArgs = new Object[] { userId };
671 }
672 else {
673 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
674 finderArgs = new Object[] { userId, start, end, orderByComparator };
675 }
676
677 List<Subscription> list = (List<Subscription>)FinderCacheUtil.getResult(finderPath,
678 finderArgs, this);
679
680 if (list == null) {
681 StringBundler query = null;
682
683 if (orderByComparator != null) {
684 query = new StringBundler(3 +
685 (orderByComparator.getOrderByFields().length * 3));
686 }
687 else {
688 query = new StringBundler(2);
689 }
690
691 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
692
693 query.append(_FINDER_COLUMN_USERID_USERID_2);
694
695 if (orderByComparator != null) {
696 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
697 orderByComparator);
698 }
699
700 String sql = query.toString();
701
702 Session session = null;
703
704 try {
705 session = openSession();
706
707 Query q = session.createQuery(sql);
708
709 QueryPos qPos = QueryPos.getInstance(q);
710
711 qPos.add(userId);
712
713 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
714 start, end);
715 }
716 catch (Exception e) {
717 throw processException(e);
718 }
719 finally {
720 if (list == null) {
721 FinderCacheUtil.removeResult(finderPath, finderArgs);
722 }
723 else {
724 cacheResult(list);
725
726 FinderCacheUtil.putResult(finderPath, finderArgs, list);
727 }
728
729 closeSession(session);
730 }
731 }
732
733 return list;
734 }
735
736
749 public Subscription findByUserId_First(long userId,
750 OrderByComparator orderByComparator)
751 throws NoSuchSubscriptionException, SystemException {
752 List<Subscription> list = findByUserId(userId, 0, 1, orderByComparator);
753
754 if (list.isEmpty()) {
755 StringBundler msg = new StringBundler(4);
756
757 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
758
759 msg.append("userId=");
760 msg.append(userId);
761
762 msg.append(StringPool.CLOSE_CURLY_BRACE);
763
764 throw new NoSuchSubscriptionException(msg.toString());
765 }
766 else {
767 return list.get(0);
768 }
769 }
770
771
784 public Subscription findByUserId_Last(long userId,
785 OrderByComparator orderByComparator)
786 throws NoSuchSubscriptionException, SystemException {
787 int count = countByUserId(userId);
788
789 List<Subscription> list = findByUserId(userId, count - 1, count,
790 orderByComparator);
791
792 if (list.isEmpty()) {
793 StringBundler msg = new StringBundler(4);
794
795 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
796
797 msg.append("userId=");
798 msg.append(userId);
799
800 msg.append(StringPool.CLOSE_CURLY_BRACE);
801
802 throw new NoSuchSubscriptionException(msg.toString());
803 }
804 else {
805 return list.get(0);
806 }
807 }
808
809
823 public Subscription[] findByUserId_PrevAndNext(long subscriptionId,
824 long userId, OrderByComparator orderByComparator)
825 throws NoSuchSubscriptionException, SystemException {
826 Subscription subscription = findByPrimaryKey(subscriptionId);
827
828 Session session = null;
829
830 try {
831 session = openSession();
832
833 Subscription[] array = new SubscriptionImpl[3];
834
835 array[0] = getByUserId_PrevAndNext(session, subscription, userId,
836 orderByComparator, true);
837
838 array[1] = subscription;
839
840 array[2] = getByUserId_PrevAndNext(session, subscription, userId,
841 orderByComparator, false);
842
843 return array;
844 }
845 catch (Exception e) {
846 throw processException(e);
847 }
848 finally {
849 closeSession(session);
850 }
851 }
852
853 protected Subscription getByUserId_PrevAndNext(Session session,
854 Subscription subscription, long userId,
855 OrderByComparator orderByComparator, boolean previous) {
856 StringBundler query = null;
857
858 if (orderByComparator != null) {
859 query = new StringBundler(6 +
860 (orderByComparator.getOrderByFields().length * 6));
861 }
862 else {
863 query = new StringBundler(3);
864 }
865
866 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
867
868 query.append(_FINDER_COLUMN_USERID_USERID_2);
869
870 if (orderByComparator != null) {
871 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
872
873 if (orderByConditionFields.length > 0) {
874 query.append(WHERE_AND);
875 }
876
877 for (int i = 0; i < orderByConditionFields.length; i++) {
878 query.append(_ORDER_BY_ENTITY_ALIAS);
879 query.append(orderByConditionFields[i]);
880
881 if ((i + 1) < orderByConditionFields.length) {
882 if (orderByComparator.isAscending() ^ previous) {
883 query.append(WHERE_GREATER_THAN_HAS_NEXT);
884 }
885 else {
886 query.append(WHERE_LESSER_THAN_HAS_NEXT);
887 }
888 }
889 else {
890 if (orderByComparator.isAscending() ^ previous) {
891 query.append(WHERE_GREATER_THAN);
892 }
893 else {
894 query.append(WHERE_LESSER_THAN);
895 }
896 }
897 }
898
899 query.append(ORDER_BY_CLAUSE);
900
901 String[] orderByFields = orderByComparator.getOrderByFields();
902
903 for (int i = 0; i < orderByFields.length; i++) {
904 query.append(_ORDER_BY_ENTITY_ALIAS);
905 query.append(orderByFields[i]);
906
907 if ((i + 1) < orderByFields.length) {
908 if (orderByComparator.isAscending() ^ previous) {
909 query.append(ORDER_BY_ASC_HAS_NEXT);
910 }
911 else {
912 query.append(ORDER_BY_DESC_HAS_NEXT);
913 }
914 }
915 else {
916 if (orderByComparator.isAscending() ^ previous) {
917 query.append(ORDER_BY_ASC);
918 }
919 else {
920 query.append(ORDER_BY_DESC);
921 }
922 }
923 }
924 }
925
926 String sql = query.toString();
927
928 Query q = session.createQuery(sql);
929
930 q.setFirstResult(0);
931 q.setMaxResults(2);
932
933 QueryPos qPos = QueryPos.getInstance(q);
934
935 qPos.add(userId);
936
937 if (orderByComparator != null) {
938 Object[] values = orderByComparator.getOrderByConditionValues(subscription);
939
940 for (Object value : values) {
941 qPos.add(value);
942 }
943 }
944
945 List<Subscription> list = q.list();
946
947 if (list.size() == 2) {
948 return list.get(1);
949 }
950 else {
951 return null;
952 }
953 }
954
955
963 public List<Subscription> findByU_C(long userId, long classNameId)
964 throws SystemException {
965 return findByU_C(userId, classNameId, QueryUtil.ALL_POS,
966 QueryUtil.ALL_POS, null);
967 }
968
969
983 public List<Subscription> findByU_C(long userId, long classNameId,
984 int start, int end) throws SystemException {
985 return findByU_C(userId, classNameId, start, end, null);
986 }
987
988
1003 public List<Subscription> findByU_C(long userId, long classNameId,
1004 int start, int end, OrderByComparator orderByComparator)
1005 throws SystemException {
1006 FinderPath finderPath = null;
1007 Object[] finderArgs = null;
1008
1009 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1010 (orderByComparator == null)) {
1011 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C;
1012 finderArgs = new Object[] { userId, classNameId };
1013 }
1014 else {
1015 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_U_C;
1016 finderArgs = new Object[] {
1017 userId, classNameId,
1018
1019 start, end, orderByComparator
1020 };
1021 }
1022
1023 List<Subscription> list = (List<Subscription>)FinderCacheUtil.getResult(finderPath,
1024 finderArgs, this);
1025
1026 if (list == null) {
1027 StringBundler query = null;
1028
1029 if (orderByComparator != null) {
1030 query = new StringBundler(4 +
1031 (orderByComparator.getOrderByFields().length * 3));
1032 }
1033 else {
1034 query = new StringBundler(3);
1035 }
1036
1037 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1038
1039 query.append(_FINDER_COLUMN_U_C_USERID_2);
1040
1041 query.append(_FINDER_COLUMN_U_C_CLASSNAMEID_2);
1042
1043 if (orderByComparator != null) {
1044 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1045 orderByComparator);
1046 }
1047
1048 String sql = query.toString();
1049
1050 Session session = null;
1051
1052 try {
1053 session = openSession();
1054
1055 Query q = session.createQuery(sql);
1056
1057 QueryPos qPos = QueryPos.getInstance(q);
1058
1059 qPos.add(userId);
1060
1061 qPos.add(classNameId);
1062
1063 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
1064 start, end);
1065 }
1066 catch (Exception e) {
1067 throw processException(e);
1068 }
1069 finally {
1070 if (list == null) {
1071 FinderCacheUtil.removeResult(finderPath, finderArgs);
1072 }
1073 else {
1074 cacheResult(list);
1075
1076 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1077 }
1078
1079 closeSession(session);
1080 }
1081 }
1082
1083 return list;
1084 }
1085
1086
1100 public Subscription findByU_C_First(long userId, long classNameId,
1101 OrderByComparator orderByComparator)
1102 throws NoSuchSubscriptionException, SystemException {
1103 List<Subscription> list = findByU_C(userId, classNameId, 0, 1,
1104 orderByComparator);
1105
1106 if (list.isEmpty()) {
1107 StringBundler msg = new StringBundler(6);
1108
1109 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1110
1111 msg.append("userId=");
1112 msg.append(userId);
1113
1114 msg.append(", classNameId=");
1115 msg.append(classNameId);
1116
1117 msg.append(StringPool.CLOSE_CURLY_BRACE);
1118
1119 throw new NoSuchSubscriptionException(msg.toString());
1120 }
1121 else {
1122 return list.get(0);
1123 }
1124 }
1125
1126
1140 public Subscription findByU_C_Last(long userId, long classNameId,
1141 OrderByComparator orderByComparator)
1142 throws NoSuchSubscriptionException, SystemException {
1143 int count = countByU_C(userId, classNameId);
1144
1145 List<Subscription> list = findByU_C(userId, classNameId, count - 1,
1146 count, orderByComparator);
1147
1148 if (list.isEmpty()) {
1149 StringBundler msg = new StringBundler(6);
1150
1151 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1152
1153 msg.append("userId=");
1154 msg.append(userId);
1155
1156 msg.append(", classNameId=");
1157 msg.append(classNameId);
1158
1159 msg.append(StringPool.CLOSE_CURLY_BRACE);
1160
1161 throw new NoSuchSubscriptionException(msg.toString());
1162 }
1163 else {
1164 return list.get(0);
1165 }
1166 }
1167
1168
1183 public Subscription[] findByU_C_PrevAndNext(long subscriptionId,
1184 long userId, long classNameId, OrderByComparator orderByComparator)
1185 throws NoSuchSubscriptionException, SystemException {
1186 Subscription subscription = findByPrimaryKey(subscriptionId);
1187
1188 Session session = null;
1189
1190 try {
1191 session = openSession();
1192
1193 Subscription[] array = new SubscriptionImpl[3];
1194
1195 array[0] = getByU_C_PrevAndNext(session, subscription, userId,
1196 classNameId, orderByComparator, true);
1197
1198 array[1] = subscription;
1199
1200 array[2] = getByU_C_PrevAndNext(session, subscription, userId,
1201 classNameId, orderByComparator, false);
1202
1203 return array;
1204 }
1205 catch (Exception e) {
1206 throw processException(e);
1207 }
1208 finally {
1209 closeSession(session);
1210 }
1211 }
1212
1213 protected Subscription getByU_C_PrevAndNext(Session session,
1214 Subscription subscription, long userId, long classNameId,
1215 OrderByComparator orderByComparator, boolean previous) {
1216 StringBundler query = null;
1217
1218 if (orderByComparator != null) {
1219 query = new StringBundler(6 +
1220 (orderByComparator.getOrderByFields().length * 6));
1221 }
1222 else {
1223 query = new StringBundler(3);
1224 }
1225
1226 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1227
1228 query.append(_FINDER_COLUMN_U_C_USERID_2);
1229
1230 query.append(_FINDER_COLUMN_U_C_CLASSNAMEID_2);
1231
1232 if (orderByComparator != null) {
1233 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1234
1235 if (orderByConditionFields.length > 0) {
1236 query.append(WHERE_AND);
1237 }
1238
1239 for (int i = 0; i < orderByConditionFields.length; i++) {
1240 query.append(_ORDER_BY_ENTITY_ALIAS);
1241 query.append(orderByConditionFields[i]);
1242
1243 if ((i + 1) < orderByConditionFields.length) {
1244 if (orderByComparator.isAscending() ^ previous) {
1245 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1246 }
1247 else {
1248 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1249 }
1250 }
1251 else {
1252 if (orderByComparator.isAscending() ^ previous) {
1253 query.append(WHERE_GREATER_THAN);
1254 }
1255 else {
1256 query.append(WHERE_LESSER_THAN);
1257 }
1258 }
1259 }
1260
1261 query.append(ORDER_BY_CLAUSE);
1262
1263 String[] orderByFields = orderByComparator.getOrderByFields();
1264
1265 for (int i = 0; i < orderByFields.length; i++) {
1266 query.append(_ORDER_BY_ENTITY_ALIAS);
1267 query.append(orderByFields[i]);
1268
1269 if ((i + 1) < orderByFields.length) {
1270 if (orderByComparator.isAscending() ^ previous) {
1271 query.append(ORDER_BY_ASC_HAS_NEXT);
1272 }
1273 else {
1274 query.append(ORDER_BY_DESC_HAS_NEXT);
1275 }
1276 }
1277 else {
1278 if (orderByComparator.isAscending() ^ previous) {
1279 query.append(ORDER_BY_ASC);
1280 }
1281 else {
1282 query.append(ORDER_BY_DESC);
1283 }
1284 }
1285 }
1286 }
1287
1288 String sql = query.toString();
1289
1290 Query q = session.createQuery(sql);
1291
1292 q.setFirstResult(0);
1293 q.setMaxResults(2);
1294
1295 QueryPos qPos = QueryPos.getInstance(q);
1296
1297 qPos.add(userId);
1298
1299 qPos.add(classNameId);
1300
1301 if (orderByComparator != null) {
1302 Object[] values = orderByComparator.getOrderByConditionValues(subscription);
1303
1304 for (Object value : values) {
1305 qPos.add(value);
1306 }
1307 }
1308
1309 List<Subscription> list = q.list();
1310
1311 if (list.size() == 2) {
1312 return list.get(1);
1313 }
1314 else {
1315 return null;
1316 }
1317 }
1318
1319
1328 public List<Subscription> findByC_C_C(long companyId, long classNameId,
1329 long classPK) throws SystemException {
1330 return findByC_C_C(companyId, classNameId, classPK, QueryUtil.ALL_POS,
1331 QueryUtil.ALL_POS, null);
1332 }
1333
1334
1349 public List<Subscription> findByC_C_C(long companyId, long classNameId,
1350 long classPK, int start, int end) throws SystemException {
1351 return findByC_C_C(companyId, classNameId, classPK, start, end, null);
1352 }
1353
1354
1370 public List<Subscription> findByC_C_C(long companyId, long classNameId,
1371 long classPK, int start, int end, OrderByComparator orderByComparator)
1372 throws SystemException {
1373 FinderPath finderPath = null;
1374 Object[] finderArgs = null;
1375
1376 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1377 (orderByComparator == null)) {
1378 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C;
1379 finderArgs = new Object[] { companyId, classNameId, classPK };
1380 }
1381 else {
1382 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C;
1383 finderArgs = new Object[] {
1384 companyId, classNameId, classPK,
1385
1386 start, end, orderByComparator
1387 };
1388 }
1389
1390 List<Subscription> list = (List<Subscription>)FinderCacheUtil.getResult(finderPath,
1391 finderArgs, this);
1392
1393 if (list == null) {
1394 StringBundler query = null;
1395
1396 if (orderByComparator != null) {
1397 query = new StringBundler(5 +
1398 (orderByComparator.getOrderByFields().length * 3));
1399 }
1400 else {
1401 query = new StringBundler(4);
1402 }
1403
1404 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1405
1406 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1407
1408 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1409
1410 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1411
1412 if (orderByComparator != null) {
1413 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1414 orderByComparator);
1415 }
1416
1417 String sql = query.toString();
1418
1419 Session session = null;
1420
1421 try {
1422 session = openSession();
1423
1424 Query q = session.createQuery(sql);
1425
1426 QueryPos qPos = QueryPos.getInstance(q);
1427
1428 qPos.add(companyId);
1429
1430 qPos.add(classNameId);
1431
1432 qPos.add(classPK);
1433
1434 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
1435 start, end);
1436 }
1437 catch (Exception e) {
1438 throw processException(e);
1439 }
1440 finally {
1441 if (list == null) {
1442 FinderCacheUtil.removeResult(finderPath, finderArgs);
1443 }
1444 else {
1445 cacheResult(list);
1446
1447 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1448 }
1449
1450 closeSession(session);
1451 }
1452 }
1453
1454 return list;
1455 }
1456
1457
1472 public Subscription findByC_C_C_First(long companyId, long classNameId,
1473 long classPK, OrderByComparator orderByComparator)
1474 throws NoSuchSubscriptionException, SystemException {
1475 List<Subscription> list = findByC_C_C(companyId, classNameId, classPK,
1476 0, 1, orderByComparator);
1477
1478 if (list.isEmpty()) {
1479 StringBundler msg = new StringBundler(8);
1480
1481 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1482
1483 msg.append("companyId=");
1484 msg.append(companyId);
1485
1486 msg.append(", classNameId=");
1487 msg.append(classNameId);
1488
1489 msg.append(", classPK=");
1490 msg.append(classPK);
1491
1492 msg.append(StringPool.CLOSE_CURLY_BRACE);
1493
1494 throw new NoSuchSubscriptionException(msg.toString());
1495 }
1496 else {
1497 return list.get(0);
1498 }
1499 }
1500
1501
1516 public Subscription findByC_C_C_Last(long companyId, long classNameId,
1517 long classPK, OrderByComparator orderByComparator)
1518 throws NoSuchSubscriptionException, SystemException {
1519 int count = countByC_C_C(companyId, classNameId, classPK);
1520
1521 List<Subscription> list = findByC_C_C(companyId, classNameId, classPK,
1522 count - 1, count, orderByComparator);
1523
1524 if (list.isEmpty()) {
1525 StringBundler msg = new StringBundler(8);
1526
1527 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1528
1529 msg.append("companyId=");
1530 msg.append(companyId);
1531
1532 msg.append(", classNameId=");
1533 msg.append(classNameId);
1534
1535 msg.append(", classPK=");
1536 msg.append(classPK);
1537
1538 msg.append(StringPool.CLOSE_CURLY_BRACE);
1539
1540 throw new NoSuchSubscriptionException(msg.toString());
1541 }
1542 else {
1543 return list.get(0);
1544 }
1545 }
1546
1547
1563 public Subscription[] findByC_C_C_PrevAndNext(long subscriptionId,
1564 long companyId, long classNameId, long classPK,
1565 OrderByComparator orderByComparator)
1566 throws NoSuchSubscriptionException, SystemException {
1567 Subscription subscription = findByPrimaryKey(subscriptionId);
1568
1569 Session session = null;
1570
1571 try {
1572 session = openSession();
1573
1574 Subscription[] array = new SubscriptionImpl[3];
1575
1576 array[0] = getByC_C_C_PrevAndNext(session, subscription, companyId,
1577 classNameId, classPK, orderByComparator, true);
1578
1579 array[1] = subscription;
1580
1581 array[2] = getByC_C_C_PrevAndNext(session, subscription, companyId,
1582 classNameId, classPK, orderByComparator, false);
1583
1584 return array;
1585 }
1586 catch (Exception e) {
1587 throw processException(e);
1588 }
1589 finally {
1590 closeSession(session);
1591 }
1592 }
1593
1594 protected Subscription getByC_C_C_PrevAndNext(Session session,
1595 Subscription subscription, long companyId, long classNameId,
1596 long classPK, OrderByComparator orderByComparator, boolean previous) {
1597 StringBundler query = null;
1598
1599 if (orderByComparator != null) {
1600 query = new StringBundler(6 +
1601 (orderByComparator.getOrderByFields().length * 6));
1602 }
1603 else {
1604 query = new StringBundler(3);
1605 }
1606
1607 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1608
1609 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1610
1611 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1612
1613 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1614
1615 if (orderByComparator != null) {
1616 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1617
1618 if (orderByConditionFields.length > 0) {
1619 query.append(WHERE_AND);
1620 }
1621
1622 for (int i = 0; i < orderByConditionFields.length; i++) {
1623 query.append(_ORDER_BY_ENTITY_ALIAS);
1624 query.append(orderByConditionFields[i]);
1625
1626 if ((i + 1) < orderByConditionFields.length) {
1627 if (orderByComparator.isAscending() ^ previous) {
1628 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1629 }
1630 else {
1631 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1632 }
1633 }
1634 else {
1635 if (orderByComparator.isAscending() ^ previous) {
1636 query.append(WHERE_GREATER_THAN);
1637 }
1638 else {
1639 query.append(WHERE_LESSER_THAN);
1640 }
1641 }
1642 }
1643
1644 query.append(ORDER_BY_CLAUSE);
1645
1646 String[] orderByFields = orderByComparator.getOrderByFields();
1647
1648 for (int i = 0; i < orderByFields.length; i++) {
1649 query.append(_ORDER_BY_ENTITY_ALIAS);
1650 query.append(orderByFields[i]);
1651
1652 if ((i + 1) < orderByFields.length) {
1653 if (orderByComparator.isAscending() ^ previous) {
1654 query.append(ORDER_BY_ASC_HAS_NEXT);
1655 }
1656 else {
1657 query.append(ORDER_BY_DESC_HAS_NEXT);
1658 }
1659 }
1660 else {
1661 if (orderByComparator.isAscending() ^ previous) {
1662 query.append(ORDER_BY_ASC);
1663 }
1664 else {
1665 query.append(ORDER_BY_DESC);
1666 }
1667 }
1668 }
1669 }
1670
1671 String sql = query.toString();
1672
1673 Query q = session.createQuery(sql);
1674
1675 q.setFirstResult(0);
1676 q.setMaxResults(2);
1677
1678 QueryPos qPos = QueryPos.getInstance(q);
1679
1680 qPos.add(companyId);
1681
1682 qPos.add(classNameId);
1683
1684 qPos.add(classPK);
1685
1686 if (orderByComparator != null) {
1687 Object[] values = orderByComparator.getOrderByConditionValues(subscription);
1688
1689 for (Object value : values) {
1690 qPos.add(value);
1691 }
1692 }
1693
1694 List<Subscription> list = q.list();
1695
1696 if (list.size() == 2) {
1697 return list.get(1);
1698 }
1699 else {
1700 return null;
1701 }
1702 }
1703
1704
1715 public Subscription findByC_U_C_C(long companyId, long userId,
1716 long classNameId, long classPK)
1717 throws NoSuchSubscriptionException, SystemException {
1718 Subscription subscription = fetchByC_U_C_C(companyId, userId,
1719 classNameId, classPK);
1720
1721 if (subscription == null) {
1722 StringBundler msg = new StringBundler(10);
1723
1724 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1725
1726 msg.append("companyId=");
1727 msg.append(companyId);
1728
1729 msg.append(", userId=");
1730 msg.append(userId);
1731
1732 msg.append(", classNameId=");
1733 msg.append(classNameId);
1734
1735 msg.append(", classPK=");
1736 msg.append(classPK);
1737
1738 msg.append(StringPool.CLOSE_CURLY_BRACE);
1739
1740 if (_log.isWarnEnabled()) {
1741 _log.warn(msg.toString());
1742 }
1743
1744 throw new NoSuchSubscriptionException(msg.toString());
1745 }
1746
1747 return subscription;
1748 }
1749
1750
1760 public Subscription fetchByC_U_C_C(long companyId, long userId,
1761 long classNameId, long classPK) throws SystemException {
1762 return fetchByC_U_C_C(companyId, userId, classNameId, classPK, true);
1763 }
1764
1765
1776 public Subscription fetchByC_U_C_C(long companyId, long userId,
1777 long classNameId, long classPK, boolean retrieveFromCache)
1778 throws SystemException {
1779 Object[] finderArgs = new Object[] {
1780 companyId, userId, classNameId, classPK
1781 };
1782
1783 Object result = null;
1784
1785 if (retrieveFromCache) {
1786 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_U_C_C,
1787 finderArgs, this);
1788 }
1789
1790 if (result == null) {
1791 StringBundler query = new StringBundler(5);
1792
1793 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1794
1795 query.append(_FINDER_COLUMN_C_U_C_C_COMPANYID_2);
1796
1797 query.append(_FINDER_COLUMN_C_U_C_C_USERID_2);
1798
1799 query.append(_FINDER_COLUMN_C_U_C_C_CLASSNAMEID_2);
1800
1801 query.append(_FINDER_COLUMN_C_U_C_C_CLASSPK_2);
1802
1803 String sql = query.toString();
1804
1805 Session session = null;
1806
1807 try {
1808 session = openSession();
1809
1810 Query q = session.createQuery(sql);
1811
1812 QueryPos qPos = QueryPos.getInstance(q);
1813
1814 qPos.add(companyId);
1815
1816 qPos.add(userId);
1817
1818 qPos.add(classNameId);
1819
1820 qPos.add(classPK);
1821
1822 List<Subscription> list = q.list();
1823
1824 result = list;
1825
1826 Subscription subscription = null;
1827
1828 if (list.isEmpty()) {
1829 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
1830 finderArgs, list);
1831 }
1832 else {
1833 subscription = list.get(0);
1834
1835 cacheResult(subscription);
1836
1837 if ((subscription.getCompanyId() != companyId) ||
1838 (subscription.getUserId() != userId) ||
1839 (subscription.getClassNameId() != classNameId) ||
1840 (subscription.getClassPK() != classPK)) {
1841 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
1842 finderArgs, subscription);
1843 }
1844 }
1845
1846 return subscription;
1847 }
1848 catch (Exception e) {
1849 throw processException(e);
1850 }
1851 finally {
1852 if (result == null) {
1853 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U_C_C,
1854 finderArgs);
1855 }
1856
1857 closeSession(session);
1858 }
1859 }
1860 else {
1861 if (result instanceof List<?>) {
1862 return null;
1863 }
1864 else {
1865 return (Subscription)result;
1866 }
1867 }
1868 }
1869
1870
1876 public List<Subscription> findAll() throws SystemException {
1877 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1878 }
1879
1880
1892 public List<Subscription> findAll(int start, int end)
1893 throws SystemException {
1894 return findAll(start, end, null);
1895 }
1896
1897
1910 public List<Subscription> findAll(int start, int end,
1911 OrderByComparator orderByComparator) throws SystemException {
1912 FinderPath finderPath = null;
1913 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1914
1915 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1916 (orderByComparator == null)) {
1917 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1918 finderArgs = FINDER_ARGS_EMPTY;
1919 }
1920 else {
1921 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1922 finderArgs = new Object[] { start, end, orderByComparator };
1923 }
1924
1925 List<Subscription> list = (List<Subscription>)FinderCacheUtil.getResult(finderPath,
1926 finderArgs, this);
1927
1928 if (list == null) {
1929 StringBundler query = null;
1930 String sql = null;
1931
1932 if (orderByComparator != null) {
1933 query = new StringBundler(2 +
1934 (orderByComparator.getOrderByFields().length * 3));
1935
1936 query.append(_SQL_SELECT_SUBSCRIPTION);
1937
1938 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1939 orderByComparator);
1940
1941 sql = query.toString();
1942 }
1943 else {
1944 sql = _SQL_SELECT_SUBSCRIPTION;
1945 }
1946
1947 Session session = null;
1948
1949 try {
1950 session = openSession();
1951
1952 Query q = session.createQuery(sql);
1953
1954 if (orderByComparator == null) {
1955 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
1956 start, end, false);
1957
1958 Collections.sort(list);
1959 }
1960 else {
1961 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
1962 start, end);
1963 }
1964 }
1965 catch (Exception e) {
1966 throw processException(e);
1967 }
1968 finally {
1969 if (list == null) {
1970 FinderCacheUtil.removeResult(finderPath, finderArgs);
1971 }
1972 else {
1973 cacheResult(list);
1974
1975 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1976 }
1977
1978 closeSession(session);
1979 }
1980 }
1981
1982 return list;
1983 }
1984
1985
1991 public void removeByUserId(long userId) throws SystemException {
1992 for (Subscription subscription : findByUserId(userId)) {
1993 remove(subscription);
1994 }
1995 }
1996
1997
2004 public void removeByU_C(long userId, long classNameId)
2005 throws SystemException {
2006 for (Subscription subscription : findByU_C(userId, classNameId)) {
2007 remove(subscription);
2008 }
2009 }
2010
2011
2019 public void removeByC_C_C(long companyId, long classNameId, long classPK)
2020 throws SystemException {
2021 for (Subscription subscription : findByC_C_C(companyId, classNameId,
2022 classPK)) {
2023 remove(subscription);
2024 }
2025 }
2026
2027
2036 public void removeByC_U_C_C(long companyId, long userId, long classNameId,
2037 long classPK) throws NoSuchSubscriptionException, SystemException {
2038 Subscription subscription = findByC_U_C_C(companyId, userId,
2039 classNameId, classPK);
2040
2041 remove(subscription);
2042 }
2043
2044
2049 public void removeAll() throws SystemException {
2050 for (Subscription subscription : findAll()) {
2051 remove(subscription);
2052 }
2053 }
2054
2055
2062 public int countByUserId(long userId) throws SystemException {
2063 Object[] finderArgs = new Object[] { userId };
2064
2065 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2066 finderArgs, this);
2067
2068 if (count == null) {
2069 StringBundler query = new StringBundler(2);
2070
2071 query.append(_SQL_COUNT_SUBSCRIPTION_WHERE);
2072
2073 query.append(_FINDER_COLUMN_USERID_USERID_2);
2074
2075 String sql = query.toString();
2076
2077 Session session = null;
2078
2079 try {
2080 session = openSession();
2081
2082 Query q = session.createQuery(sql);
2083
2084 QueryPos qPos = QueryPos.getInstance(q);
2085
2086 qPos.add(userId);
2087
2088 count = (Long)q.uniqueResult();
2089 }
2090 catch (Exception e) {
2091 throw processException(e);
2092 }
2093 finally {
2094 if (count == null) {
2095 count = Long.valueOf(0);
2096 }
2097
2098 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2099 finderArgs, count);
2100
2101 closeSession(session);
2102 }
2103 }
2104
2105 return count.intValue();
2106 }
2107
2108
2116 public int countByU_C(long userId, long classNameId)
2117 throws SystemException {
2118 Object[] finderArgs = new Object[] { userId, classNameId };
2119
2120 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_C,
2121 finderArgs, this);
2122
2123 if (count == null) {
2124 StringBundler query = new StringBundler(3);
2125
2126 query.append(_SQL_COUNT_SUBSCRIPTION_WHERE);
2127
2128 query.append(_FINDER_COLUMN_U_C_USERID_2);
2129
2130 query.append(_FINDER_COLUMN_U_C_CLASSNAMEID_2);
2131
2132 String sql = query.toString();
2133
2134 Session session = null;
2135
2136 try {
2137 session = openSession();
2138
2139 Query q = session.createQuery(sql);
2140
2141 QueryPos qPos = QueryPos.getInstance(q);
2142
2143 qPos.add(userId);
2144
2145 qPos.add(classNameId);
2146
2147 count = (Long)q.uniqueResult();
2148 }
2149 catch (Exception e) {
2150 throw processException(e);
2151 }
2152 finally {
2153 if (count == null) {
2154 count = Long.valueOf(0);
2155 }
2156
2157 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_C, finderArgs,
2158 count);
2159
2160 closeSession(session);
2161 }
2162 }
2163
2164 return count.intValue();
2165 }
2166
2167
2176 public int countByC_C_C(long companyId, long classNameId, long classPK)
2177 throws SystemException {
2178 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
2179
2180 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
2181 finderArgs, this);
2182
2183 if (count == null) {
2184 StringBundler query = new StringBundler(4);
2185
2186 query.append(_SQL_COUNT_SUBSCRIPTION_WHERE);
2187
2188 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2189
2190 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2191
2192 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2193
2194 String sql = query.toString();
2195
2196 Session session = null;
2197
2198 try {
2199 session = openSession();
2200
2201 Query q = session.createQuery(sql);
2202
2203 QueryPos qPos = QueryPos.getInstance(q);
2204
2205 qPos.add(companyId);
2206
2207 qPos.add(classNameId);
2208
2209 qPos.add(classPK);
2210
2211 count = (Long)q.uniqueResult();
2212 }
2213 catch (Exception e) {
2214 throw processException(e);
2215 }
2216 finally {
2217 if (count == null) {
2218 count = Long.valueOf(0);
2219 }
2220
2221 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2222 finderArgs, count);
2223
2224 closeSession(session);
2225 }
2226 }
2227
2228 return count.intValue();
2229 }
2230
2231
2241 public int countByC_U_C_C(long companyId, long userId, long classNameId,
2242 long classPK) throws SystemException {
2243 Object[] finderArgs = new Object[] {
2244 companyId, userId, classNameId, classPK
2245 };
2246
2247 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U_C_C,
2248 finderArgs, this);
2249
2250 if (count == null) {
2251 StringBundler query = new StringBundler(5);
2252
2253 query.append(_SQL_COUNT_SUBSCRIPTION_WHERE);
2254
2255 query.append(_FINDER_COLUMN_C_U_C_C_COMPANYID_2);
2256
2257 query.append(_FINDER_COLUMN_C_U_C_C_USERID_2);
2258
2259 query.append(_FINDER_COLUMN_C_U_C_C_CLASSNAMEID_2);
2260
2261 query.append(_FINDER_COLUMN_C_U_C_C_CLASSPK_2);
2262
2263 String sql = query.toString();
2264
2265 Session session = null;
2266
2267 try {
2268 session = openSession();
2269
2270 Query q = session.createQuery(sql);
2271
2272 QueryPos qPos = QueryPos.getInstance(q);
2273
2274 qPos.add(companyId);
2275
2276 qPos.add(userId);
2277
2278 qPos.add(classNameId);
2279
2280 qPos.add(classPK);
2281
2282 count = (Long)q.uniqueResult();
2283 }
2284 catch (Exception e) {
2285 throw processException(e);
2286 }
2287 finally {
2288 if (count == null) {
2289 count = Long.valueOf(0);
2290 }
2291
2292 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U_C_C,
2293 finderArgs, count);
2294
2295 closeSession(session);
2296 }
2297 }
2298
2299 return count.intValue();
2300 }
2301
2302
2308 public int countAll() throws SystemException {
2309 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2310 FINDER_ARGS_EMPTY, this);
2311
2312 if (count == null) {
2313 Session session = null;
2314
2315 try {
2316 session = openSession();
2317
2318 Query q = session.createQuery(_SQL_COUNT_SUBSCRIPTION);
2319
2320 count = (Long)q.uniqueResult();
2321 }
2322 catch (Exception e) {
2323 throw processException(e);
2324 }
2325 finally {
2326 if (count == null) {
2327 count = Long.valueOf(0);
2328 }
2329
2330 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2331 FINDER_ARGS_EMPTY, count);
2332
2333 closeSession(session);
2334 }
2335 }
2336
2337 return count.intValue();
2338 }
2339
2340
2343 public void afterPropertiesSet() {
2344 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2345 com.liferay.portal.util.PropsUtil.get(
2346 "value.object.listener.com.liferay.portal.model.Subscription")));
2347
2348 if (listenerClassNames.length > 0) {
2349 try {
2350 List<ModelListener<Subscription>> listenersList = new ArrayList<ModelListener<Subscription>>();
2351
2352 for (String listenerClassName : listenerClassNames) {
2353 listenersList.add((ModelListener<Subscription>)InstanceFactory.newInstance(
2354 listenerClassName));
2355 }
2356
2357 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2358 }
2359 catch (Exception e) {
2360 _log.error(e);
2361 }
2362 }
2363 }
2364
2365 public void destroy() {
2366 EntityCacheUtil.removeCache(SubscriptionImpl.class.getName());
2367 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2368 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2369 }
2370
2371 @BeanReference(type = AccountPersistence.class)
2372 protected AccountPersistence accountPersistence;
2373 @BeanReference(type = AddressPersistence.class)
2374 protected AddressPersistence addressPersistence;
2375 @BeanReference(type = BrowserTrackerPersistence.class)
2376 protected BrowserTrackerPersistence browserTrackerPersistence;
2377 @BeanReference(type = ClassNamePersistence.class)
2378 protected ClassNamePersistence classNamePersistence;
2379 @BeanReference(type = ClusterGroupPersistence.class)
2380 protected ClusterGroupPersistence clusterGroupPersistence;
2381 @BeanReference(type = CompanyPersistence.class)
2382 protected CompanyPersistence companyPersistence;
2383 @BeanReference(type = ContactPersistence.class)
2384 protected ContactPersistence contactPersistence;
2385 @BeanReference(type = CountryPersistence.class)
2386 protected CountryPersistence countryPersistence;
2387 @BeanReference(type = EmailAddressPersistence.class)
2388 protected EmailAddressPersistence emailAddressPersistence;
2389 @BeanReference(type = GroupPersistence.class)
2390 protected GroupPersistence groupPersistence;
2391 @BeanReference(type = ImagePersistence.class)
2392 protected ImagePersistence imagePersistence;
2393 @BeanReference(type = LayoutPersistence.class)
2394 protected LayoutPersistence layoutPersistence;
2395 @BeanReference(type = LayoutBranchPersistence.class)
2396 protected LayoutBranchPersistence layoutBranchPersistence;
2397 @BeanReference(type = LayoutPrototypePersistence.class)
2398 protected LayoutPrototypePersistence layoutPrototypePersistence;
2399 @BeanReference(type = LayoutRevisionPersistence.class)
2400 protected LayoutRevisionPersistence layoutRevisionPersistence;
2401 @BeanReference(type = LayoutSetPersistence.class)
2402 protected LayoutSetPersistence layoutSetPersistence;
2403 @BeanReference(type = LayoutSetBranchPersistence.class)
2404 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2405 @BeanReference(type = LayoutSetPrototypePersistence.class)
2406 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2407 @BeanReference(type = ListTypePersistence.class)
2408 protected ListTypePersistence listTypePersistence;
2409 @BeanReference(type = LockPersistence.class)
2410 protected LockPersistence lockPersistence;
2411 @BeanReference(type = MembershipRequestPersistence.class)
2412 protected MembershipRequestPersistence membershipRequestPersistence;
2413 @BeanReference(type = OrganizationPersistence.class)
2414 protected OrganizationPersistence organizationPersistence;
2415 @BeanReference(type = OrgGroupPermissionPersistence.class)
2416 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2417 @BeanReference(type = OrgGroupRolePersistence.class)
2418 protected OrgGroupRolePersistence orgGroupRolePersistence;
2419 @BeanReference(type = OrgLaborPersistence.class)
2420 protected OrgLaborPersistence orgLaborPersistence;
2421 @BeanReference(type = PasswordPolicyPersistence.class)
2422 protected PasswordPolicyPersistence passwordPolicyPersistence;
2423 @BeanReference(type = PasswordPolicyRelPersistence.class)
2424 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2425 @BeanReference(type = PasswordTrackerPersistence.class)
2426 protected PasswordTrackerPersistence passwordTrackerPersistence;
2427 @BeanReference(type = PermissionPersistence.class)
2428 protected PermissionPersistence permissionPersistence;
2429 @BeanReference(type = PhonePersistence.class)
2430 protected PhonePersistence phonePersistence;
2431 @BeanReference(type = PluginSettingPersistence.class)
2432 protected PluginSettingPersistence pluginSettingPersistence;
2433 @BeanReference(type = PortalPreferencesPersistence.class)
2434 protected PortalPreferencesPersistence portalPreferencesPersistence;
2435 @BeanReference(type = PortletPersistence.class)
2436 protected PortletPersistence portletPersistence;
2437 @BeanReference(type = PortletItemPersistence.class)
2438 protected PortletItemPersistence portletItemPersistence;
2439 @BeanReference(type = PortletPreferencesPersistence.class)
2440 protected PortletPreferencesPersistence portletPreferencesPersistence;
2441 @BeanReference(type = RegionPersistence.class)
2442 protected RegionPersistence regionPersistence;
2443 @BeanReference(type = ReleasePersistence.class)
2444 protected ReleasePersistence releasePersistence;
2445 @BeanReference(type = RepositoryPersistence.class)
2446 protected RepositoryPersistence repositoryPersistence;
2447 @BeanReference(type = RepositoryEntryPersistence.class)
2448 protected RepositoryEntryPersistence repositoryEntryPersistence;
2449 @BeanReference(type = ResourcePersistence.class)
2450 protected ResourcePersistence resourcePersistence;
2451 @BeanReference(type = ResourceActionPersistence.class)
2452 protected ResourceActionPersistence resourceActionPersistence;
2453 @BeanReference(type = ResourceBlockPersistence.class)
2454 protected ResourceBlockPersistence resourceBlockPersistence;
2455 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2456 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2457 @BeanReference(type = ResourceCodePersistence.class)
2458 protected ResourceCodePersistence resourceCodePersistence;
2459 @BeanReference(type = ResourcePermissionPersistence.class)
2460 protected ResourcePermissionPersistence resourcePermissionPersistence;
2461 @BeanReference(type = ResourceTypePermissionPersistence.class)
2462 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2463 @BeanReference(type = RolePersistence.class)
2464 protected RolePersistence rolePersistence;
2465 @BeanReference(type = ServiceComponentPersistence.class)
2466 protected ServiceComponentPersistence serviceComponentPersistence;
2467 @BeanReference(type = ShardPersistence.class)
2468 protected ShardPersistence shardPersistence;
2469 @BeanReference(type = SubscriptionPersistence.class)
2470 protected SubscriptionPersistence subscriptionPersistence;
2471 @BeanReference(type = TeamPersistence.class)
2472 protected TeamPersistence teamPersistence;
2473 @BeanReference(type = TicketPersistence.class)
2474 protected TicketPersistence ticketPersistence;
2475 @BeanReference(type = UserPersistence.class)
2476 protected UserPersistence userPersistence;
2477 @BeanReference(type = UserGroupPersistence.class)
2478 protected UserGroupPersistence userGroupPersistence;
2479 @BeanReference(type = UserGroupGroupRolePersistence.class)
2480 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2481 @BeanReference(type = UserGroupRolePersistence.class)
2482 protected UserGroupRolePersistence userGroupRolePersistence;
2483 @BeanReference(type = UserIdMapperPersistence.class)
2484 protected UserIdMapperPersistence userIdMapperPersistence;
2485 @BeanReference(type = UserNotificationEventPersistence.class)
2486 protected UserNotificationEventPersistence userNotificationEventPersistence;
2487 @BeanReference(type = UserTrackerPersistence.class)
2488 protected UserTrackerPersistence userTrackerPersistence;
2489 @BeanReference(type = UserTrackerPathPersistence.class)
2490 protected UserTrackerPathPersistence userTrackerPathPersistence;
2491 @BeanReference(type = VirtualHostPersistence.class)
2492 protected VirtualHostPersistence virtualHostPersistence;
2493 @BeanReference(type = WebDAVPropsPersistence.class)
2494 protected WebDAVPropsPersistence webDAVPropsPersistence;
2495 @BeanReference(type = WebsitePersistence.class)
2496 protected WebsitePersistence websitePersistence;
2497 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2498 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2499 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2500 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2501 @BeanReference(type = AssetEntryPersistence.class)
2502 protected AssetEntryPersistence assetEntryPersistence;
2503 @BeanReference(type = MBThreadPersistence.class)
2504 protected MBThreadPersistence mbThreadPersistence;
2505 @BeanReference(type = SocialActivityPersistence.class)
2506 protected SocialActivityPersistence socialActivityPersistence;
2507 private static final String _SQL_SELECT_SUBSCRIPTION = "SELECT subscription FROM Subscription subscription";
2508 private static final String _SQL_SELECT_SUBSCRIPTION_WHERE = "SELECT subscription FROM Subscription subscription WHERE ";
2509 private static final String _SQL_COUNT_SUBSCRIPTION = "SELECT COUNT(subscription) FROM Subscription subscription";
2510 private static final String _SQL_COUNT_SUBSCRIPTION_WHERE = "SELECT COUNT(subscription) FROM Subscription subscription WHERE ";
2511 private static final String _FINDER_COLUMN_USERID_USERID_2 = "subscription.userId = ?";
2512 private static final String _FINDER_COLUMN_U_C_USERID_2 = "subscription.userId = ? AND ";
2513 private static final String _FINDER_COLUMN_U_C_CLASSNAMEID_2 = "subscription.classNameId = ?";
2514 private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "subscription.companyId = ? AND ";
2515 private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "subscription.classNameId = ? AND ";
2516 private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "subscription.classPK = ?";
2517 private static final String _FINDER_COLUMN_C_U_C_C_COMPANYID_2 = "subscription.companyId = ? AND ";
2518 private static final String _FINDER_COLUMN_C_U_C_C_USERID_2 = "subscription.userId = ? AND ";
2519 private static final String _FINDER_COLUMN_C_U_C_C_CLASSNAMEID_2 = "subscription.classNameId = ? AND ";
2520 private static final String _FINDER_COLUMN_C_U_C_C_CLASSPK_2 = "subscription.classPK = ?";
2521 private static final String _ORDER_BY_ENTITY_ALIAS = "subscription.";
2522 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Subscription exists with the primary key ";
2523 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Subscription exists with the key {";
2524 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2525 private static Log _log = LogFactoryUtil.getLog(SubscriptionPersistenceImpl.class);
2526 private static Subscription _nullSubscription = new SubscriptionImpl() {
2527 @Override
2528 public Object clone() {
2529 return this;
2530 }
2531
2532 @Override
2533 public CacheModel<Subscription> toCacheModel() {
2534 return _nullSubscriptionCacheModel;
2535 }
2536 };
2537
2538 private static CacheModel<Subscription> _nullSubscriptionCacheModel = new CacheModel<Subscription>() {
2539 public Subscription toEntityModel() {
2540 return _nullSubscription;
2541 }
2542 };
2543 }