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 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U_C_C,
242 new Object[] {
243 Long.valueOf(subscription.getCompanyId()),
244 Long.valueOf(subscription.getUserId()),
245 Long.valueOf(subscription.getClassNameId()),
246 Long.valueOf(subscription.getClassPK())
247 });
248 }
249
250
256 public Subscription create(long subscriptionId) {
257 Subscription subscription = new SubscriptionImpl();
258
259 subscription.setNew(true);
260 subscription.setPrimaryKey(subscriptionId);
261
262 return subscription;
263 }
264
265
273 @Override
274 public Subscription remove(Serializable primaryKey)
275 throws NoSuchModelException, SystemException {
276 return remove(((Long)primaryKey).longValue());
277 }
278
279
287 public Subscription remove(long subscriptionId)
288 throws NoSuchSubscriptionException, SystemException {
289 Session session = null;
290
291 try {
292 session = openSession();
293
294 Subscription subscription = (Subscription)session.get(SubscriptionImpl.class,
295 Long.valueOf(subscriptionId));
296
297 if (subscription == null) {
298 if (_log.isWarnEnabled()) {
299 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
300 subscriptionId);
301 }
302
303 throw new NoSuchSubscriptionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
304 subscriptionId);
305 }
306
307 return subscriptionPersistence.remove(subscription);
308 }
309 catch (NoSuchSubscriptionException nsee) {
310 throw nsee;
311 }
312 catch (Exception e) {
313 throw processException(e);
314 }
315 finally {
316 closeSession(session);
317 }
318 }
319
320
327 @Override
328 public Subscription remove(Subscription subscription)
329 throws SystemException {
330 return super.remove(subscription);
331 }
332
333 @Override
334 protected Subscription removeImpl(Subscription subscription)
335 throws SystemException {
336 subscription = toUnwrappedModel(subscription);
337
338 Session session = null;
339
340 try {
341 session = openSession();
342
343 BatchSessionUtil.delete(session, subscription);
344 }
345 catch (Exception e) {
346 throw processException(e);
347 }
348 finally {
349 closeSession(session);
350 }
351
352 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
353 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
354
355 SubscriptionModelImpl subscriptionModelImpl = (SubscriptionModelImpl)subscription;
356
357 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U_C_C,
358 new Object[] {
359 Long.valueOf(subscriptionModelImpl.getCompanyId()),
360 Long.valueOf(subscriptionModelImpl.getUserId()),
361 Long.valueOf(subscriptionModelImpl.getClassNameId()),
362 Long.valueOf(subscriptionModelImpl.getClassPK())
363 });
364
365 EntityCacheUtil.removeResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
366 SubscriptionImpl.class, subscription.getPrimaryKey());
367
368 return subscription;
369 }
370
371 @Override
372 public Subscription updateImpl(
373 com.liferay.portal.model.Subscription subscription, boolean merge)
374 throws SystemException {
375 subscription = toUnwrappedModel(subscription);
376
377 boolean isNew = subscription.isNew();
378
379 SubscriptionModelImpl subscriptionModelImpl = (SubscriptionModelImpl)subscription;
380
381 Session session = null;
382
383 try {
384 session = openSession();
385
386 BatchSessionUtil.update(session, subscription, merge);
387
388 subscription.setNew(false);
389 }
390 catch (Exception e) {
391 throw processException(e);
392 }
393 finally {
394 closeSession(session);
395 }
396
397 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
398
399 if (isNew || !SubscriptionModelImpl.COLUMN_BITMASK_ENABLED) {
400 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
401 }
402
403 else {
404 if ((subscriptionModelImpl.getColumnBitmask() &
405 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
406 Object[] args = new Object[] {
407 Long.valueOf(subscriptionModelImpl.getOriginalUserId())
408 };
409
410 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
411 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
412 args);
413
414 args = new Object[] {
415 Long.valueOf(subscriptionModelImpl.getUserId())
416 };
417
418 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
419 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
420 args);
421 }
422
423 if ((subscriptionModelImpl.getColumnBitmask() &
424 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C.getColumnBitmask()) != 0) {
425 Object[] args = new Object[] {
426 Long.valueOf(subscriptionModelImpl.getOriginalUserId()),
427 Long.valueOf(subscriptionModelImpl.getOriginalClassNameId())
428 };
429
430 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_C, args);
431 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C,
432 args);
433
434 args = new Object[] {
435 Long.valueOf(subscriptionModelImpl.getUserId()),
436 Long.valueOf(subscriptionModelImpl.getClassNameId())
437 };
438
439 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_C, args);
440 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C,
441 args);
442 }
443
444 if ((subscriptionModelImpl.getColumnBitmask() &
445 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C.getColumnBitmask()) != 0) {
446 Object[] args = new Object[] {
447 Long.valueOf(subscriptionModelImpl.getOriginalCompanyId()),
448 Long.valueOf(subscriptionModelImpl.getOriginalClassNameId()),
449 Long.valueOf(subscriptionModelImpl.getOriginalClassPK())
450 };
451
452 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
453 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
454 args);
455
456 args = new Object[] {
457 Long.valueOf(subscriptionModelImpl.getCompanyId()),
458 Long.valueOf(subscriptionModelImpl.getClassNameId()),
459 Long.valueOf(subscriptionModelImpl.getClassPK())
460 };
461
462 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
463 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
464 args);
465 }
466 }
467
468 EntityCacheUtil.putResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
469 SubscriptionImpl.class, subscription.getPrimaryKey(), subscription);
470
471 if (isNew) {
472 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
473 new Object[] {
474 Long.valueOf(subscription.getCompanyId()),
475 Long.valueOf(subscription.getUserId()),
476 Long.valueOf(subscription.getClassNameId()),
477 Long.valueOf(subscription.getClassPK())
478 }, subscription);
479 }
480 else {
481 if ((subscriptionModelImpl.getColumnBitmask() &
482 FINDER_PATH_FETCH_BY_C_U_C_C.getColumnBitmask()) != 0) {
483 Object[] args = new Object[] {
484 Long.valueOf(subscriptionModelImpl.getOriginalCompanyId()),
485 Long.valueOf(subscriptionModelImpl.getOriginalUserId()),
486 Long.valueOf(subscriptionModelImpl.getOriginalClassNameId()),
487 Long.valueOf(subscriptionModelImpl.getOriginalClassPK())
488 };
489
490 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U_C_C, args);
491 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U_C_C, args);
492
493 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
494 new Object[] {
495 Long.valueOf(subscription.getCompanyId()),
496 Long.valueOf(subscription.getUserId()),
497 Long.valueOf(subscription.getClassNameId()),
498 Long.valueOf(subscription.getClassPK())
499 }, subscription);
500 }
501 }
502
503 return subscription;
504 }
505
506 protected Subscription toUnwrappedModel(Subscription subscription) {
507 if (subscription instanceof SubscriptionImpl) {
508 return subscription;
509 }
510
511 SubscriptionImpl subscriptionImpl = new SubscriptionImpl();
512
513 subscriptionImpl.setNew(subscription.isNew());
514 subscriptionImpl.setPrimaryKey(subscription.getPrimaryKey());
515
516 subscriptionImpl.setSubscriptionId(subscription.getSubscriptionId());
517 subscriptionImpl.setCompanyId(subscription.getCompanyId());
518 subscriptionImpl.setUserId(subscription.getUserId());
519 subscriptionImpl.setUserName(subscription.getUserName());
520 subscriptionImpl.setCreateDate(subscription.getCreateDate());
521 subscriptionImpl.setModifiedDate(subscription.getModifiedDate());
522 subscriptionImpl.setClassNameId(subscription.getClassNameId());
523 subscriptionImpl.setClassPK(subscription.getClassPK());
524 subscriptionImpl.setFrequency(subscription.getFrequency());
525
526 return subscriptionImpl;
527 }
528
529
537 @Override
538 public Subscription findByPrimaryKey(Serializable primaryKey)
539 throws NoSuchModelException, SystemException {
540 return findByPrimaryKey(((Long)primaryKey).longValue());
541 }
542
543
551 public Subscription findByPrimaryKey(long subscriptionId)
552 throws NoSuchSubscriptionException, SystemException {
553 Subscription subscription = fetchByPrimaryKey(subscriptionId);
554
555 if (subscription == null) {
556 if (_log.isWarnEnabled()) {
557 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + subscriptionId);
558 }
559
560 throw new NoSuchSubscriptionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
561 subscriptionId);
562 }
563
564 return subscription;
565 }
566
567
574 @Override
575 public Subscription fetchByPrimaryKey(Serializable primaryKey)
576 throws SystemException {
577 return fetchByPrimaryKey(((Long)primaryKey).longValue());
578 }
579
580
587 public Subscription fetchByPrimaryKey(long subscriptionId)
588 throws SystemException {
589 Subscription subscription = (Subscription)EntityCacheUtil.getResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
590 SubscriptionImpl.class, subscriptionId);
591
592 if (subscription == _nullSubscription) {
593 return null;
594 }
595
596 if (subscription == null) {
597 Session session = null;
598
599 boolean hasException = false;
600
601 try {
602 session = openSession();
603
604 subscription = (Subscription)session.get(SubscriptionImpl.class,
605 Long.valueOf(subscriptionId));
606 }
607 catch (Exception e) {
608 hasException = true;
609
610 throw processException(e);
611 }
612 finally {
613 if (subscription != null) {
614 cacheResult(subscription);
615 }
616 else if (!hasException) {
617 EntityCacheUtil.putResult(SubscriptionModelImpl.ENTITY_CACHE_ENABLED,
618 SubscriptionImpl.class, subscriptionId,
619 _nullSubscription);
620 }
621
622 closeSession(session);
623 }
624 }
625
626 return subscription;
627 }
628
629
636 public List<Subscription> findByUserId(long userId)
637 throws SystemException {
638 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
639 }
640
641
654 public List<Subscription> findByUserId(long userId, int start, int end)
655 throws SystemException {
656 return findByUserId(userId, start, end, null);
657 }
658
659
673 public List<Subscription> findByUserId(long userId, int start, int end,
674 OrderByComparator orderByComparator) throws SystemException {
675 FinderPath finderPath = null;
676 Object[] finderArgs = null;
677
678 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
679 (orderByComparator == null)) {
680 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
681 finderArgs = new Object[] { userId };
682 }
683 else {
684 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
685 finderArgs = new Object[] { userId, start, end, orderByComparator };
686 }
687
688 List<Subscription> list = (List<Subscription>)FinderCacheUtil.getResult(finderPath,
689 finderArgs, this);
690
691 if (list == null) {
692 StringBundler query = null;
693
694 if (orderByComparator != null) {
695 query = new StringBundler(3 +
696 (orderByComparator.getOrderByFields().length * 3));
697 }
698 else {
699 query = new StringBundler(2);
700 }
701
702 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
703
704 query.append(_FINDER_COLUMN_USERID_USERID_2);
705
706 if (orderByComparator != null) {
707 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
708 orderByComparator);
709 }
710
711 String sql = query.toString();
712
713 Session session = null;
714
715 try {
716 session = openSession();
717
718 Query q = session.createQuery(sql);
719
720 QueryPos qPos = QueryPos.getInstance(q);
721
722 qPos.add(userId);
723
724 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
725 start, end);
726 }
727 catch (Exception e) {
728 throw processException(e);
729 }
730 finally {
731 if (list == null) {
732 FinderCacheUtil.removeResult(finderPath, finderArgs);
733 }
734 else {
735 cacheResult(list);
736
737 FinderCacheUtil.putResult(finderPath, finderArgs, list);
738 }
739
740 closeSession(session);
741 }
742 }
743
744 return list;
745 }
746
747
760 public Subscription findByUserId_First(long userId,
761 OrderByComparator orderByComparator)
762 throws NoSuchSubscriptionException, SystemException {
763 List<Subscription> list = findByUserId(userId, 0, 1, orderByComparator);
764
765 if (list.isEmpty()) {
766 StringBundler msg = new StringBundler(4);
767
768 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
769
770 msg.append("userId=");
771 msg.append(userId);
772
773 msg.append(StringPool.CLOSE_CURLY_BRACE);
774
775 throw new NoSuchSubscriptionException(msg.toString());
776 }
777 else {
778 return list.get(0);
779 }
780 }
781
782
795 public Subscription findByUserId_Last(long userId,
796 OrderByComparator orderByComparator)
797 throws NoSuchSubscriptionException, SystemException {
798 int count = countByUserId(userId);
799
800 List<Subscription> list = findByUserId(userId, count - 1, count,
801 orderByComparator);
802
803 if (list.isEmpty()) {
804 StringBundler msg = new StringBundler(4);
805
806 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
807
808 msg.append("userId=");
809 msg.append(userId);
810
811 msg.append(StringPool.CLOSE_CURLY_BRACE);
812
813 throw new NoSuchSubscriptionException(msg.toString());
814 }
815 else {
816 return list.get(0);
817 }
818 }
819
820
834 public Subscription[] findByUserId_PrevAndNext(long subscriptionId,
835 long userId, OrderByComparator orderByComparator)
836 throws NoSuchSubscriptionException, SystemException {
837 Subscription subscription = findByPrimaryKey(subscriptionId);
838
839 Session session = null;
840
841 try {
842 session = openSession();
843
844 Subscription[] array = new SubscriptionImpl[3];
845
846 array[0] = getByUserId_PrevAndNext(session, subscription, userId,
847 orderByComparator, true);
848
849 array[1] = subscription;
850
851 array[2] = getByUserId_PrevAndNext(session, subscription, userId,
852 orderByComparator, false);
853
854 return array;
855 }
856 catch (Exception e) {
857 throw processException(e);
858 }
859 finally {
860 closeSession(session);
861 }
862 }
863
864 protected Subscription getByUserId_PrevAndNext(Session session,
865 Subscription subscription, long userId,
866 OrderByComparator orderByComparator, boolean previous) {
867 StringBundler query = null;
868
869 if (orderByComparator != null) {
870 query = new StringBundler(6 +
871 (orderByComparator.getOrderByFields().length * 6));
872 }
873 else {
874 query = new StringBundler(3);
875 }
876
877 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
878
879 query.append(_FINDER_COLUMN_USERID_USERID_2);
880
881 if (orderByComparator != null) {
882 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
883
884 if (orderByConditionFields.length > 0) {
885 query.append(WHERE_AND);
886 }
887
888 for (int i = 0; i < orderByConditionFields.length; i++) {
889 query.append(_ORDER_BY_ENTITY_ALIAS);
890 query.append(orderByConditionFields[i]);
891
892 if ((i + 1) < orderByConditionFields.length) {
893 if (orderByComparator.isAscending() ^ previous) {
894 query.append(WHERE_GREATER_THAN_HAS_NEXT);
895 }
896 else {
897 query.append(WHERE_LESSER_THAN_HAS_NEXT);
898 }
899 }
900 else {
901 if (orderByComparator.isAscending() ^ previous) {
902 query.append(WHERE_GREATER_THAN);
903 }
904 else {
905 query.append(WHERE_LESSER_THAN);
906 }
907 }
908 }
909
910 query.append(ORDER_BY_CLAUSE);
911
912 String[] orderByFields = orderByComparator.getOrderByFields();
913
914 for (int i = 0; i < orderByFields.length; i++) {
915 query.append(_ORDER_BY_ENTITY_ALIAS);
916 query.append(orderByFields[i]);
917
918 if ((i + 1) < orderByFields.length) {
919 if (orderByComparator.isAscending() ^ previous) {
920 query.append(ORDER_BY_ASC_HAS_NEXT);
921 }
922 else {
923 query.append(ORDER_BY_DESC_HAS_NEXT);
924 }
925 }
926 else {
927 if (orderByComparator.isAscending() ^ previous) {
928 query.append(ORDER_BY_ASC);
929 }
930 else {
931 query.append(ORDER_BY_DESC);
932 }
933 }
934 }
935 }
936
937 String sql = query.toString();
938
939 Query q = session.createQuery(sql);
940
941 q.setFirstResult(0);
942 q.setMaxResults(2);
943
944 QueryPos qPos = QueryPos.getInstance(q);
945
946 qPos.add(userId);
947
948 if (orderByComparator != null) {
949 Object[] values = orderByComparator.getOrderByConditionValues(subscription);
950
951 for (Object value : values) {
952 qPos.add(value);
953 }
954 }
955
956 List<Subscription> list = q.list();
957
958 if (list.size() == 2) {
959 return list.get(1);
960 }
961 else {
962 return null;
963 }
964 }
965
966
974 public List<Subscription> findByU_C(long userId, long classNameId)
975 throws SystemException {
976 return findByU_C(userId, classNameId, QueryUtil.ALL_POS,
977 QueryUtil.ALL_POS, null);
978 }
979
980
994 public List<Subscription> findByU_C(long userId, long classNameId,
995 int start, int end) throws SystemException {
996 return findByU_C(userId, classNameId, start, end, null);
997 }
998
999
1014 public List<Subscription> findByU_C(long userId, long classNameId,
1015 int start, int end, OrderByComparator orderByComparator)
1016 throws SystemException {
1017 FinderPath finderPath = null;
1018 Object[] finderArgs = null;
1019
1020 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1021 (orderByComparator == null)) {
1022 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_C;
1023 finderArgs = new Object[] { userId, classNameId };
1024 }
1025 else {
1026 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_U_C;
1027 finderArgs = new Object[] {
1028 userId, classNameId,
1029
1030 start, end, orderByComparator
1031 };
1032 }
1033
1034 List<Subscription> list = (List<Subscription>)FinderCacheUtil.getResult(finderPath,
1035 finderArgs, this);
1036
1037 if (list == null) {
1038 StringBundler query = null;
1039
1040 if (orderByComparator != null) {
1041 query = new StringBundler(4 +
1042 (orderByComparator.getOrderByFields().length * 3));
1043 }
1044 else {
1045 query = new StringBundler(3);
1046 }
1047
1048 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1049
1050 query.append(_FINDER_COLUMN_U_C_USERID_2);
1051
1052 query.append(_FINDER_COLUMN_U_C_CLASSNAMEID_2);
1053
1054 if (orderByComparator != null) {
1055 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1056 orderByComparator);
1057 }
1058
1059 String sql = query.toString();
1060
1061 Session session = null;
1062
1063 try {
1064 session = openSession();
1065
1066 Query q = session.createQuery(sql);
1067
1068 QueryPos qPos = QueryPos.getInstance(q);
1069
1070 qPos.add(userId);
1071
1072 qPos.add(classNameId);
1073
1074 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
1075 start, end);
1076 }
1077 catch (Exception e) {
1078 throw processException(e);
1079 }
1080 finally {
1081 if (list == null) {
1082 FinderCacheUtil.removeResult(finderPath, finderArgs);
1083 }
1084 else {
1085 cacheResult(list);
1086
1087 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1088 }
1089
1090 closeSession(session);
1091 }
1092 }
1093
1094 return list;
1095 }
1096
1097
1111 public Subscription findByU_C_First(long userId, long classNameId,
1112 OrderByComparator orderByComparator)
1113 throws NoSuchSubscriptionException, SystemException {
1114 List<Subscription> list = findByU_C(userId, classNameId, 0, 1,
1115 orderByComparator);
1116
1117 if (list.isEmpty()) {
1118 StringBundler msg = new StringBundler(6);
1119
1120 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1121
1122 msg.append("userId=");
1123 msg.append(userId);
1124
1125 msg.append(", classNameId=");
1126 msg.append(classNameId);
1127
1128 msg.append(StringPool.CLOSE_CURLY_BRACE);
1129
1130 throw new NoSuchSubscriptionException(msg.toString());
1131 }
1132 else {
1133 return list.get(0);
1134 }
1135 }
1136
1137
1151 public Subscription findByU_C_Last(long userId, long classNameId,
1152 OrderByComparator orderByComparator)
1153 throws NoSuchSubscriptionException, SystemException {
1154 int count = countByU_C(userId, classNameId);
1155
1156 List<Subscription> list = findByU_C(userId, classNameId, count - 1,
1157 count, orderByComparator);
1158
1159 if (list.isEmpty()) {
1160 StringBundler msg = new StringBundler(6);
1161
1162 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1163
1164 msg.append("userId=");
1165 msg.append(userId);
1166
1167 msg.append(", classNameId=");
1168 msg.append(classNameId);
1169
1170 msg.append(StringPool.CLOSE_CURLY_BRACE);
1171
1172 throw new NoSuchSubscriptionException(msg.toString());
1173 }
1174 else {
1175 return list.get(0);
1176 }
1177 }
1178
1179
1194 public Subscription[] findByU_C_PrevAndNext(long subscriptionId,
1195 long userId, long classNameId, OrderByComparator orderByComparator)
1196 throws NoSuchSubscriptionException, SystemException {
1197 Subscription subscription = findByPrimaryKey(subscriptionId);
1198
1199 Session session = null;
1200
1201 try {
1202 session = openSession();
1203
1204 Subscription[] array = new SubscriptionImpl[3];
1205
1206 array[0] = getByU_C_PrevAndNext(session, subscription, userId,
1207 classNameId, orderByComparator, true);
1208
1209 array[1] = subscription;
1210
1211 array[2] = getByU_C_PrevAndNext(session, subscription, userId,
1212 classNameId, orderByComparator, false);
1213
1214 return array;
1215 }
1216 catch (Exception e) {
1217 throw processException(e);
1218 }
1219 finally {
1220 closeSession(session);
1221 }
1222 }
1223
1224 protected Subscription getByU_C_PrevAndNext(Session session,
1225 Subscription subscription, long userId, long classNameId,
1226 OrderByComparator orderByComparator, boolean previous) {
1227 StringBundler query = null;
1228
1229 if (orderByComparator != null) {
1230 query = new StringBundler(6 +
1231 (orderByComparator.getOrderByFields().length * 6));
1232 }
1233 else {
1234 query = new StringBundler(3);
1235 }
1236
1237 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1238
1239 query.append(_FINDER_COLUMN_U_C_USERID_2);
1240
1241 query.append(_FINDER_COLUMN_U_C_CLASSNAMEID_2);
1242
1243 if (orderByComparator != null) {
1244 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1245
1246 if (orderByConditionFields.length > 0) {
1247 query.append(WHERE_AND);
1248 }
1249
1250 for (int i = 0; i < orderByConditionFields.length; i++) {
1251 query.append(_ORDER_BY_ENTITY_ALIAS);
1252 query.append(orderByConditionFields[i]);
1253
1254 if ((i + 1) < orderByConditionFields.length) {
1255 if (orderByComparator.isAscending() ^ previous) {
1256 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1257 }
1258 else {
1259 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1260 }
1261 }
1262 else {
1263 if (orderByComparator.isAscending() ^ previous) {
1264 query.append(WHERE_GREATER_THAN);
1265 }
1266 else {
1267 query.append(WHERE_LESSER_THAN);
1268 }
1269 }
1270 }
1271
1272 query.append(ORDER_BY_CLAUSE);
1273
1274 String[] orderByFields = orderByComparator.getOrderByFields();
1275
1276 for (int i = 0; i < orderByFields.length; i++) {
1277 query.append(_ORDER_BY_ENTITY_ALIAS);
1278 query.append(orderByFields[i]);
1279
1280 if ((i + 1) < orderByFields.length) {
1281 if (orderByComparator.isAscending() ^ previous) {
1282 query.append(ORDER_BY_ASC_HAS_NEXT);
1283 }
1284 else {
1285 query.append(ORDER_BY_DESC_HAS_NEXT);
1286 }
1287 }
1288 else {
1289 if (orderByComparator.isAscending() ^ previous) {
1290 query.append(ORDER_BY_ASC);
1291 }
1292 else {
1293 query.append(ORDER_BY_DESC);
1294 }
1295 }
1296 }
1297 }
1298
1299 String sql = query.toString();
1300
1301 Query q = session.createQuery(sql);
1302
1303 q.setFirstResult(0);
1304 q.setMaxResults(2);
1305
1306 QueryPos qPos = QueryPos.getInstance(q);
1307
1308 qPos.add(userId);
1309
1310 qPos.add(classNameId);
1311
1312 if (orderByComparator != null) {
1313 Object[] values = orderByComparator.getOrderByConditionValues(subscription);
1314
1315 for (Object value : values) {
1316 qPos.add(value);
1317 }
1318 }
1319
1320 List<Subscription> list = q.list();
1321
1322 if (list.size() == 2) {
1323 return list.get(1);
1324 }
1325 else {
1326 return null;
1327 }
1328 }
1329
1330
1339 public List<Subscription> findByC_C_C(long companyId, long classNameId,
1340 long classPK) throws SystemException {
1341 return findByC_C_C(companyId, classNameId, classPK, QueryUtil.ALL_POS,
1342 QueryUtil.ALL_POS, null);
1343 }
1344
1345
1360 public List<Subscription> findByC_C_C(long companyId, long classNameId,
1361 long classPK, int start, int end) throws SystemException {
1362 return findByC_C_C(companyId, classNameId, classPK, start, end, null);
1363 }
1364
1365
1381 public List<Subscription> findByC_C_C(long companyId, long classNameId,
1382 long classPK, int start, int end, OrderByComparator orderByComparator)
1383 throws SystemException {
1384 FinderPath finderPath = null;
1385 Object[] finderArgs = null;
1386
1387 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1388 (orderByComparator == null)) {
1389 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C;
1390 finderArgs = new Object[] { companyId, classNameId, classPK };
1391 }
1392 else {
1393 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C;
1394 finderArgs = new Object[] {
1395 companyId, classNameId, classPK,
1396
1397 start, end, orderByComparator
1398 };
1399 }
1400
1401 List<Subscription> list = (List<Subscription>)FinderCacheUtil.getResult(finderPath,
1402 finderArgs, this);
1403
1404 if (list == null) {
1405 StringBundler query = null;
1406
1407 if (orderByComparator != null) {
1408 query = new StringBundler(5 +
1409 (orderByComparator.getOrderByFields().length * 3));
1410 }
1411 else {
1412 query = new StringBundler(4);
1413 }
1414
1415 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1416
1417 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1418
1419 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1420
1421 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1422
1423 if (orderByComparator != null) {
1424 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1425 orderByComparator);
1426 }
1427
1428 String sql = query.toString();
1429
1430 Session session = null;
1431
1432 try {
1433 session = openSession();
1434
1435 Query q = session.createQuery(sql);
1436
1437 QueryPos qPos = QueryPos.getInstance(q);
1438
1439 qPos.add(companyId);
1440
1441 qPos.add(classNameId);
1442
1443 qPos.add(classPK);
1444
1445 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
1446 start, end);
1447 }
1448 catch (Exception e) {
1449 throw processException(e);
1450 }
1451 finally {
1452 if (list == null) {
1453 FinderCacheUtil.removeResult(finderPath, finderArgs);
1454 }
1455 else {
1456 cacheResult(list);
1457
1458 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1459 }
1460
1461 closeSession(session);
1462 }
1463 }
1464
1465 return list;
1466 }
1467
1468
1483 public Subscription findByC_C_C_First(long companyId, long classNameId,
1484 long classPK, OrderByComparator orderByComparator)
1485 throws NoSuchSubscriptionException, SystemException {
1486 List<Subscription> list = findByC_C_C(companyId, classNameId, classPK,
1487 0, 1, orderByComparator);
1488
1489 if (list.isEmpty()) {
1490 StringBundler msg = new StringBundler(8);
1491
1492 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1493
1494 msg.append("companyId=");
1495 msg.append(companyId);
1496
1497 msg.append(", classNameId=");
1498 msg.append(classNameId);
1499
1500 msg.append(", classPK=");
1501 msg.append(classPK);
1502
1503 msg.append(StringPool.CLOSE_CURLY_BRACE);
1504
1505 throw new NoSuchSubscriptionException(msg.toString());
1506 }
1507 else {
1508 return list.get(0);
1509 }
1510 }
1511
1512
1527 public Subscription findByC_C_C_Last(long companyId, long classNameId,
1528 long classPK, OrderByComparator orderByComparator)
1529 throws NoSuchSubscriptionException, SystemException {
1530 int count = countByC_C_C(companyId, classNameId, classPK);
1531
1532 List<Subscription> list = findByC_C_C(companyId, classNameId, classPK,
1533 count - 1, count, orderByComparator);
1534
1535 if (list.isEmpty()) {
1536 StringBundler msg = new StringBundler(8);
1537
1538 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1539
1540 msg.append("companyId=");
1541 msg.append(companyId);
1542
1543 msg.append(", classNameId=");
1544 msg.append(classNameId);
1545
1546 msg.append(", classPK=");
1547 msg.append(classPK);
1548
1549 msg.append(StringPool.CLOSE_CURLY_BRACE);
1550
1551 throw new NoSuchSubscriptionException(msg.toString());
1552 }
1553 else {
1554 return list.get(0);
1555 }
1556 }
1557
1558
1574 public Subscription[] findByC_C_C_PrevAndNext(long subscriptionId,
1575 long companyId, long classNameId, long classPK,
1576 OrderByComparator orderByComparator)
1577 throws NoSuchSubscriptionException, SystemException {
1578 Subscription subscription = findByPrimaryKey(subscriptionId);
1579
1580 Session session = null;
1581
1582 try {
1583 session = openSession();
1584
1585 Subscription[] array = new SubscriptionImpl[3];
1586
1587 array[0] = getByC_C_C_PrevAndNext(session, subscription, companyId,
1588 classNameId, classPK, orderByComparator, true);
1589
1590 array[1] = subscription;
1591
1592 array[2] = getByC_C_C_PrevAndNext(session, subscription, companyId,
1593 classNameId, classPK, orderByComparator, false);
1594
1595 return array;
1596 }
1597 catch (Exception e) {
1598 throw processException(e);
1599 }
1600 finally {
1601 closeSession(session);
1602 }
1603 }
1604
1605 protected Subscription getByC_C_C_PrevAndNext(Session session,
1606 Subscription subscription, long companyId, long classNameId,
1607 long classPK, OrderByComparator orderByComparator, boolean previous) {
1608 StringBundler query = null;
1609
1610 if (orderByComparator != null) {
1611 query = new StringBundler(6 +
1612 (orderByComparator.getOrderByFields().length * 6));
1613 }
1614 else {
1615 query = new StringBundler(3);
1616 }
1617
1618 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1619
1620 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1621
1622 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1623
1624 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1625
1626 if (orderByComparator != null) {
1627 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1628
1629 if (orderByConditionFields.length > 0) {
1630 query.append(WHERE_AND);
1631 }
1632
1633 for (int i = 0; i < orderByConditionFields.length; i++) {
1634 query.append(_ORDER_BY_ENTITY_ALIAS);
1635 query.append(orderByConditionFields[i]);
1636
1637 if ((i + 1) < orderByConditionFields.length) {
1638 if (orderByComparator.isAscending() ^ previous) {
1639 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1640 }
1641 else {
1642 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1643 }
1644 }
1645 else {
1646 if (orderByComparator.isAscending() ^ previous) {
1647 query.append(WHERE_GREATER_THAN);
1648 }
1649 else {
1650 query.append(WHERE_LESSER_THAN);
1651 }
1652 }
1653 }
1654
1655 query.append(ORDER_BY_CLAUSE);
1656
1657 String[] orderByFields = orderByComparator.getOrderByFields();
1658
1659 for (int i = 0; i < orderByFields.length; i++) {
1660 query.append(_ORDER_BY_ENTITY_ALIAS);
1661 query.append(orderByFields[i]);
1662
1663 if ((i + 1) < orderByFields.length) {
1664 if (orderByComparator.isAscending() ^ previous) {
1665 query.append(ORDER_BY_ASC_HAS_NEXT);
1666 }
1667 else {
1668 query.append(ORDER_BY_DESC_HAS_NEXT);
1669 }
1670 }
1671 else {
1672 if (orderByComparator.isAscending() ^ previous) {
1673 query.append(ORDER_BY_ASC);
1674 }
1675 else {
1676 query.append(ORDER_BY_DESC);
1677 }
1678 }
1679 }
1680 }
1681
1682 String sql = query.toString();
1683
1684 Query q = session.createQuery(sql);
1685
1686 q.setFirstResult(0);
1687 q.setMaxResults(2);
1688
1689 QueryPos qPos = QueryPos.getInstance(q);
1690
1691 qPos.add(companyId);
1692
1693 qPos.add(classNameId);
1694
1695 qPos.add(classPK);
1696
1697 if (orderByComparator != null) {
1698 Object[] values = orderByComparator.getOrderByConditionValues(subscription);
1699
1700 for (Object value : values) {
1701 qPos.add(value);
1702 }
1703 }
1704
1705 List<Subscription> list = q.list();
1706
1707 if (list.size() == 2) {
1708 return list.get(1);
1709 }
1710 else {
1711 return null;
1712 }
1713 }
1714
1715
1726 public Subscription findByC_U_C_C(long companyId, long userId,
1727 long classNameId, long classPK)
1728 throws NoSuchSubscriptionException, SystemException {
1729 Subscription subscription = fetchByC_U_C_C(companyId, userId,
1730 classNameId, classPK);
1731
1732 if (subscription == null) {
1733 StringBundler msg = new StringBundler(10);
1734
1735 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1736
1737 msg.append("companyId=");
1738 msg.append(companyId);
1739
1740 msg.append(", userId=");
1741 msg.append(userId);
1742
1743 msg.append(", classNameId=");
1744 msg.append(classNameId);
1745
1746 msg.append(", classPK=");
1747 msg.append(classPK);
1748
1749 msg.append(StringPool.CLOSE_CURLY_BRACE);
1750
1751 if (_log.isWarnEnabled()) {
1752 _log.warn(msg.toString());
1753 }
1754
1755 throw new NoSuchSubscriptionException(msg.toString());
1756 }
1757
1758 return subscription;
1759 }
1760
1761
1771 public Subscription fetchByC_U_C_C(long companyId, long userId,
1772 long classNameId, long classPK) throws SystemException {
1773 return fetchByC_U_C_C(companyId, userId, classNameId, classPK, true);
1774 }
1775
1776
1787 public Subscription fetchByC_U_C_C(long companyId, long userId,
1788 long classNameId, long classPK, boolean retrieveFromCache)
1789 throws SystemException {
1790 Object[] finderArgs = new Object[] {
1791 companyId, userId, classNameId, classPK
1792 };
1793
1794 Object result = null;
1795
1796 if (retrieveFromCache) {
1797 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_U_C_C,
1798 finderArgs, this);
1799 }
1800
1801 if (result == null) {
1802 StringBundler query = new StringBundler(5);
1803
1804 query.append(_SQL_SELECT_SUBSCRIPTION_WHERE);
1805
1806 query.append(_FINDER_COLUMN_C_U_C_C_COMPANYID_2);
1807
1808 query.append(_FINDER_COLUMN_C_U_C_C_USERID_2);
1809
1810 query.append(_FINDER_COLUMN_C_U_C_C_CLASSNAMEID_2);
1811
1812 query.append(_FINDER_COLUMN_C_U_C_C_CLASSPK_2);
1813
1814 String sql = query.toString();
1815
1816 Session session = null;
1817
1818 try {
1819 session = openSession();
1820
1821 Query q = session.createQuery(sql);
1822
1823 QueryPos qPos = QueryPos.getInstance(q);
1824
1825 qPos.add(companyId);
1826
1827 qPos.add(userId);
1828
1829 qPos.add(classNameId);
1830
1831 qPos.add(classPK);
1832
1833 List<Subscription> list = q.list();
1834
1835 result = list;
1836
1837 Subscription subscription = null;
1838
1839 if (list.isEmpty()) {
1840 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
1841 finderArgs, list);
1842 }
1843 else {
1844 subscription = list.get(0);
1845
1846 cacheResult(subscription);
1847
1848 if ((subscription.getCompanyId() != companyId) ||
1849 (subscription.getUserId() != userId) ||
1850 (subscription.getClassNameId() != classNameId) ||
1851 (subscription.getClassPK() != classPK)) {
1852 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U_C_C,
1853 finderArgs, subscription);
1854 }
1855 }
1856
1857 return subscription;
1858 }
1859 catch (Exception e) {
1860 throw processException(e);
1861 }
1862 finally {
1863 if (result == null) {
1864 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U_C_C,
1865 finderArgs);
1866 }
1867
1868 closeSession(session);
1869 }
1870 }
1871 else {
1872 if (result instanceof List<?>) {
1873 return null;
1874 }
1875 else {
1876 return (Subscription)result;
1877 }
1878 }
1879 }
1880
1881
1887 public List<Subscription> findAll() throws SystemException {
1888 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1889 }
1890
1891
1903 public List<Subscription> findAll(int start, int end)
1904 throws SystemException {
1905 return findAll(start, end, null);
1906 }
1907
1908
1921 public List<Subscription> findAll(int start, int end,
1922 OrderByComparator orderByComparator) throws SystemException {
1923 FinderPath finderPath = null;
1924 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1925
1926 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1927 (orderByComparator == null)) {
1928 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1929 finderArgs = FINDER_ARGS_EMPTY;
1930 }
1931 else {
1932 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1933 finderArgs = new Object[] { start, end, orderByComparator };
1934 }
1935
1936 List<Subscription> list = (List<Subscription>)FinderCacheUtil.getResult(finderPath,
1937 finderArgs, this);
1938
1939 if (list == null) {
1940 StringBundler query = null;
1941 String sql = null;
1942
1943 if (orderByComparator != null) {
1944 query = new StringBundler(2 +
1945 (orderByComparator.getOrderByFields().length * 3));
1946
1947 query.append(_SQL_SELECT_SUBSCRIPTION);
1948
1949 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1950 orderByComparator);
1951
1952 sql = query.toString();
1953 }
1954 else {
1955 sql = _SQL_SELECT_SUBSCRIPTION;
1956 }
1957
1958 Session session = null;
1959
1960 try {
1961 session = openSession();
1962
1963 Query q = session.createQuery(sql);
1964
1965 if (orderByComparator == null) {
1966 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
1967 start, end, false);
1968
1969 Collections.sort(list);
1970 }
1971 else {
1972 list = (List<Subscription>)QueryUtil.list(q, getDialect(),
1973 start, end);
1974 }
1975 }
1976 catch (Exception e) {
1977 throw processException(e);
1978 }
1979 finally {
1980 if (list == null) {
1981 FinderCacheUtil.removeResult(finderPath, finderArgs);
1982 }
1983 else {
1984 cacheResult(list);
1985
1986 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1987 }
1988
1989 closeSession(session);
1990 }
1991 }
1992
1993 return list;
1994 }
1995
1996
2002 public void removeByUserId(long userId) throws SystemException {
2003 for (Subscription subscription : findByUserId(userId)) {
2004 subscriptionPersistence.remove(subscription);
2005 }
2006 }
2007
2008
2015 public void removeByU_C(long userId, long classNameId)
2016 throws SystemException {
2017 for (Subscription subscription : findByU_C(userId, classNameId)) {
2018 subscriptionPersistence.remove(subscription);
2019 }
2020 }
2021
2022
2030 public void removeByC_C_C(long companyId, long classNameId, long classPK)
2031 throws SystemException {
2032 for (Subscription subscription : findByC_C_C(companyId, classNameId,
2033 classPK)) {
2034 subscriptionPersistence.remove(subscription);
2035 }
2036 }
2037
2038
2047 public void removeByC_U_C_C(long companyId, long userId, long classNameId,
2048 long classPK) throws NoSuchSubscriptionException, SystemException {
2049 Subscription subscription = findByC_U_C_C(companyId, userId,
2050 classNameId, classPK);
2051
2052 subscriptionPersistence.remove(subscription);
2053 }
2054
2055
2060 public void removeAll() throws SystemException {
2061 for (Subscription subscription : findAll()) {
2062 subscriptionPersistence.remove(subscription);
2063 }
2064 }
2065
2066
2073 public int countByUserId(long userId) throws SystemException {
2074 Object[] finderArgs = new Object[] { userId };
2075
2076 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2077 finderArgs, this);
2078
2079 if (count == null) {
2080 StringBundler query = new StringBundler(2);
2081
2082 query.append(_SQL_COUNT_SUBSCRIPTION_WHERE);
2083
2084 query.append(_FINDER_COLUMN_USERID_USERID_2);
2085
2086 String sql = query.toString();
2087
2088 Session session = null;
2089
2090 try {
2091 session = openSession();
2092
2093 Query q = session.createQuery(sql);
2094
2095 QueryPos qPos = QueryPos.getInstance(q);
2096
2097 qPos.add(userId);
2098
2099 count = (Long)q.uniqueResult();
2100 }
2101 catch (Exception e) {
2102 throw processException(e);
2103 }
2104 finally {
2105 if (count == null) {
2106 count = Long.valueOf(0);
2107 }
2108
2109 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2110 finderArgs, count);
2111
2112 closeSession(session);
2113 }
2114 }
2115
2116 return count.intValue();
2117 }
2118
2119
2127 public int countByU_C(long userId, long classNameId)
2128 throws SystemException {
2129 Object[] finderArgs = new Object[] { userId, classNameId };
2130
2131 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_C,
2132 finderArgs, this);
2133
2134 if (count == null) {
2135 StringBundler query = new StringBundler(3);
2136
2137 query.append(_SQL_COUNT_SUBSCRIPTION_WHERE);
2138
2139 query.append(_FINDER_COLUMN_U_C_USERID_2);
2140
2141 query.append(_FINDER_COLUMN_U_C_CLASSNAMEID_2);
2142
2143 String sql = query.toString();
2144
2145 Session session = null;
2146
2147 try {
2148 session = openSession();
2149
2150 Query q = session.createQuery(sql);
2151
2152 QueryPos qPos = QueryPos.getInstance(q);
2153
2154 qPos.add(userId);
2155
2156 qPos.add(classNameId);
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_U_C, finderArgs,
2169 count);
2170
2171 closeSession(session);
2172 }
2173 }
2174
2175 return count.intValue();
2176 }
2177
2178
2187 public int countByC_C_C(long companyId, long classNameId, long classPK)
2188 throws SystemException {
2189 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
2190
2191 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
2192 finderArgs, this);
2193
2194 if (count == null) {
2195 StringBundler query = new StringBundler(4);
2196
2197 query.append(_SQL_COUNT_SUBSCRIPTION_WHERE);
2198
2199 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2200
2201 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2202
2203 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2204
2205 String sql = query.toString();
2206
2207 Session session = null;
2208
2209 try {
2210 session = openSession();
2211
2212 Query q = session.createQuery(sql);
2213
2214 QueryPos qPos = QueryPos.getInstance(q);
2215
2216 qPos.add(companyId);
2217
2218 qPos.add(classNameId);
2219
2220 qPos.add(classPK);
2221
2222 count = (Long)q.uniqueResult();
2223 }
2224 catch (Exception e) {
2225 throw processException(e);
2226 }
2227 finally {
2228 if (count == null) {
2229 count = Long.valueOf(0);
2230 }
2231
2232 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2233 finderArgs, count);
2234
2235 closeSession(session);
2236 }
2237 }
2238
2239 return count.intValue();
2240 }
2241
2242
2252 public int countByC_U_C_C(long companyId, long userId, long classNameId,
2253 long classPK) throws SystemException {
2254 Object[] finderArgs = new Object[] {
2255 companyId, userId, classNameId, classPK
2256 };
2257
2258 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U_C_C,
2259 finderArgs, this);
2260
2261 if (count == null) {
2262 StringBundler query = new StringBundler(5);
2263
2264 query.append(_SQL_COUNT_SUBSCRIPTION_WHERE);
2265
2266 query.append(_FINDER_COLUMN_C_U_C_C_COMPANYID_2);
2267
2268 query.append(_FINDER_COLUMN_C_U_C_C_USERID_2);
2269
2270 query.append(_FINDER_COLUMN_C_U_C_C_CLASSNAMEID_2);
2271
2272 query.append(_FINDER_COLUMN_C_U_C_C_CLASSPK_2);
2273
2274 String sql = query.toString();
2275
2276 Session session = null;
2277
2278 try {
2279 session = openSession();
2280
2281 Query q = session.createQuery(sql);
2282
2283 QueryPos qPos = QueryPos.getInstance(q);
2284
2285 qPos.add(companyId);
2286
2287 qPos.add(userId);
2288
2289 qPos.add(classNameId);
2290
2291 qPos.add(classPK);
2292
2293 count = (Long)q.uniqueResult();
2294 }
2295 catch (Exception e) {
2296 throw processException(e);
2297 }
2298 finally {
2299 if (count == null) {
2300 count = Long.valueOf(0);
2301 }
2302
2303 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U_C_C,
2304 finderArgs, count);
2305
2306 closeSession(session);
2307 }
2308 }
2309
2310 return count.intValue();
2311 }
2312
2313
2319 public int countAll() throws SystemException {
2320 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2321 FINDER_ARGS_EMPTY, this);
2322
2323 if (count == null) {
2324 Session session = null;
2325
2326 try {
2327 session = openSession();
2328
2329 Query q = session.createQuery(_SQL_COUNT_SUBSCRIPTION);
2330
2331 count = (Long)q.uniqueResult();
2332 }
2333 catch (Exception e) {
2334 throw processException(e);
2335 }
2336 finally {
2337 if (count == null) {
2338 count = Long.valueOf(0);
2339 }
2340
2341 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2342 FINDER_ARGS_EMPTY, count);
2343
2344 closeSession(session);
2345 }
2346 }
2347
2348 return count.intValue();
2349 }
2350
2351
2354 public void afterPropertiesSet() {
2355 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2356 com.liferay.portal.util.PropsUtil.get(
2357 "value.object.listener.com.liferay.portal.model.Subscription")));
2358
2359 if (listenerClassNames.length > 0) {
2360 try {
2361 List<ModelListener<Subscription>> listenersList = new ArrayList<ModelListener<Subscription>>();
2362
2363 for (String listenerClassName : listenerClassNames) {
2364 listenersList.add((ModelListener<Subscription>)InstanceFactory.newInstance(
2365 listenerClassName));
2366 }
2367
2368 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2369 }
2370 catch (Exception e) {
2371 _log.error(e);
2372 }
2373 }
2374 }
2375
2376 public void destroy() {
2377 EntityCacheUtil.removeCache(SubscriptionImpl.class.getName());
2378 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2379 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2380 }
2381
2382 @BeanReference(type = AccountPersistence.class)
2383 protected AccountPersistence accountPersistence;
2384 @BeanReference(type = AddressPersistence.class)
2385 protected AddressPersistence addressPersistence;
2386 @BeanReference(type = BrowserTrackerPersistence.class)
2387 protected BrowserTrackerPersistence browserTrackerPersistence;
2388 @BeanReference(type = ClassNamePersistence.class)
2389 protected ClassNamePersistence classNamePersistence;
2390 @BeanReference(type = ClusterGroupPersistence.class)
2391 protected ClusterGroupPersistence clusterGroupPersistence;
2392 @BeanReference(type = CompanyPersistence.class)
2393 protected CompanyPersistence companyPersistence;
2394 @BeanReference(type = ContactPersistence.class)
2395 protected ContactPersistence contactPersistence;
2396 @BeanReference(type = CountryPersistence.class)
2397 protected CountryPersistence countryPersistence;
2398 @BeanReference(type = EmailAddressPersistence.class)
2399 protected EmailAddressPersistence emailAddressPersistence;
2400 @BeanReference(type = GroupPersistence.class)
2401 protected GroupPersistence groupPersistence;
2402 @BeanReference(type = ImagePersistence.class)
2403 protected ImagePersistence imagePersistence;
2404 @BeanReference(type = LayoutPersistence.class)
2405 protected LayoutPersistence layoutPersistence;
2406 @BeanReference(type = LayoutBranchPersistence.class)
2407 protected LayoutBranchPersistence layoutBranchPersistence;
2408 @BeanReference(type = LayoutPrototypePersistence.class)
2409 protected LayoutPrototypePersistence layoutPrototypePersistence;
2410 @BeanReference(type = LayoutRevisionPersistence.class)
2411 protected LayoutRevisionPersistence layoutRevisionPersistence;
2412 @BeanReference(type = LayoutSetPersistence.class)
2413 protected LayoutSetPersistence layoutSetPersistence;
2414 @BeanReference(type = LayoutSetBranchPersistence.class)
2415 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2416 @BeanReference(type = LayoutSetPrototypePersistence.class)
2417 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2418 @BeanReference(type = ListTypePersistence.class)
2419 protected ListTypePersistence listTypePersistence;
2420 @BeanReference(type = LockPersistence.class)
2421 protected LockPersistence lockPersistence;
2422 @BeanReference(type = MembershipRequestPersistence.class)
2423 protected MembershipRequestPersistence membershipRequestPersistence;
2424 @BeanReference(type = OrganizationPersistence.class)
2425 protected OrganizationPersistence organizationPersistence;
2426 @BeanReference(type = OrgGroupPermissionPersistence.class)
2427 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2428 @BeanReference(type = OrgGroupRolePersistence.class)
2429 protected OrgGroupRolePersistence orgGroupRolePersistence;
2430 @BeanReference(type = OrgLaborPersistence.class)
2431 protected OrgLaborPersistence orgLaborPersistence;
2432 @BeanReference(type = PasswordPolicyPersistence.class)
2433 protected PasswordPolicyPersistence passwordPolicyPersistence;
2434 @BeanReference(type = PasswordPolicyRelPersistence.class)
2435 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2436 @BeanReference(type = PasswordTrackerPersistence.class)
2437 protected PasswordTrackerPersistence passwordTrackerPersistence;
2438 @BeanReference(type = PermissionPersistence.class)
2439 protected PermissionPersistence permissionPersistence;
2440 @BeanReference(type = PhonePersistence.class)
2441 protected PhonePersistence phonePersistence;
2442 @BeanReference(type = PluginSettingPersistence.class)
2443 protected PluginSettingPersistence pluginSettingPersistence;
2444 @BeanReference(type = PortalPreferencesPersistence.class)
2445 protected PortalPreferencesPersistence portalPreferencesPersistence;
2446 @BeanReference(type = PortletPersistence.class)
2447 protected PortletPersistence portletPersistence;
2448 @BeanReference(type = PortletItemPersistence.class)
2449 protected PortletItemPersistence portletItemPersistence;
2450 @BeanReference(type = PortletPreferencesPersistence.class)
2451 protected PortletPreferencesPersistence portletPreferencesPersistence;
2452 @BeanReference(type = RegionPersistence.class)
2453 protected RegionPersistence regionPersistence;
2454 @BeanReference(type = ReleasePersistence.class)
2455 protected ReleasePersistence releasePersistence;
2456 @BeanReference(type = RepositoryPersistence.class)
2457 protected RepositoryPersistence repositoryPersistence;
2458 @BeanReference(type = RepositoryEntryPersistence.class)
2459 protected RepositoryEntryPersistence repositoryEntryPersistence;
2460 @BeanReference(type = ResourcePersistence.class)
2461 protected ResourcePersistence resourcePersistence;
2462 @BeanReference(type = ResourceActionPersistence.class)
2463 protected ResourceActionPersistence resourceActionPersistence;
2464 @BeanReference(type = ResourceBlockPersistence.class)
2465 protected ResourceBlockPersistence resourceBlockPersistence;
2466 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2467 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2468 @BeanReference(type = ResourceCodePersistence.class)
2469 protected ResourceCodePersistence resourceCodePersistence;
2470 @BeanReference(type = ResourcePermissionPersistence.class)
2471 protected ResourcePermissionPersistence resourcePermissionPersistence;
2472 @BeanReference(type = ResourceTypePermissionPersistence.class)
2473 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2474 @BeanReference(type = RolePersistence.class)
2475 protected RolePersistence rolePersistence;
2476 @BeanReference(type = ServiceComponentPersistence.class)
2477 protected ServiceComponentPersistence serviceComponentPersistence;
2478 @BeanReference(type = ShardPersistence.class)
2479 protected ShardPersistence shardPersistence;
2480 @BeanReference(type = SubscriptionPersistence.class)
2481 protected SubscriptionPersistence subscriptionPersistence;
2482 @BeanReference(type = TeamPersistence.class)
2483 protected TeamPersistence teamPersistence;
2484 @BeanReference(type = TicketPersistence.class)
2485 protected TicketPersistence ticketPersistence;
2486 @BeanReference(type = UserPersistence.class)
2487 protected UserPersistence userPersistence;
2488 @BeanReference(type = UserGroupPersistence.class)
2489 protected UserGroupPersistence userGroupPersistence;
2490 @BeanReference(type = UserGroupGroupRolePersistence.class)
2491 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2492 @BeanReference(type = UserGroupRolePersistence.class)
2493 protected UserGroupRolePersistence userGroupRolePersistence;
2494 @BeanReference(type = UserIdMapperPersistence.class)
2495 protected UserIdMapperPersistence userIdMapperPersistence;
2496 @BeanReference(type = UserNotificationEventPersistence.class)
2497 protected UserNotificationEventPersistence userNotificationEventPersistence;
2498 @BeanReference(type = UserTrackerPersistence.class)
2499 protected UserTrackerPersistence userTrackerPersistence;
2500 @BeanReference(type = UserTrackerPathPersistence.class)
2501 protected UserTrackerPathPersistence userTrackerPathPersistence;
2502 @BeanReference(type = VirtualHostPersistence.class)
2503 protected VirtualHostPersistence virtualHostPersistence;
2504 @BeanReference(type = WebDAVPropsPersistence.class)
2505 protected WebDAVPropsPersistence webDAVPropsPersistence;
2506 @BeanReference(type = WebsitePersistence.class)
2507 protected WebsitePersistence websitePersistence;
2508 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2509 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2510 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2511 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2512 @BeanReference(type = AssetEntryPersistence.class)
2513 protected AssetEntryPersistence assetEntryPersistence;
2514 @BeanReference(type = MBThreadPersistence.class)
2515 protected MBThreadPersistence mbThreadPersistence;
2516 @BeanReference(type = SocialActivityPersistence.class)
2517 protected SocialActivityPersistence socialActivityPersistence;
2518 private static final String _SQL_SELECT_SUBSCRIPTION = "SELECT subscription FROM Subscription subscription";
2519 private static final String _SQL_SELECT_SUBSCRIPTION_WHERE = "SELECT subscription FROM Subscription subscription WHERE ";
2520 private static final String _SQL_COUNT_SUBSCRIPTION = "SELECT COUNT(subscription) FROM Subscription subscription";
2521 private static final String _SQL_COUNT_SUBSCRIPTION_WHERE = "SELECT COUNT(subscription) FROM Subscription subscription WHERE ";
2522 private static final String _FINDER_COLUMN_USERID_USERID_2 = "subscription.userId = ?";
2523 private static final String _FINDER_COLUMN_U_C_USERID_2 = "subscription.userId = ? AND ";
2524 private static final String _FINDER_COLUMN_U_C_CLASSNAMEID_2 = "subscription.classNameId = ?";
2525 private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "subscription.companyId = ? AND ";
2526 private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "subscription.classNameId = ? AND ";
2527 private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "subscription.classPK = ?";
2528 private static final String _FINDER_COLUMN_C_U_C_C_COMPANYID_2 = "subscription.companyId = ? AND ";
2529 private static final String _FINDER_COLUMN_C_U_C_C_USERID_2 = "subscription.userId = ? AND ";
2530 private static final String _FINDER_COLUMN_C_U_C_C_CLASSNAMEID_2 = "subscription.classNameId = ? AND ";
2531 private static final String _FINDER_COLUMN_C_U_C_C_CLASSPK_2 = "subscription.classPK = ?";
2532 private static final String _ORDER_BY_ENTITY_ALIAS = "subscription.";
2533 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Subscription exists with the primary key ";
2534 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Subscription exists with the key {";
2535 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2536 private static Log _log = LogFactoryUtil.getLog(SubscriptionPersistenceImpl.class);
2537 private static Subscription _nullSubscription = new SubscriptionImpl() {
2538 @Override
2539 public Object clone() {
2540 return this;
2541 }
2542
2543 @Override
2544 public CacheModel<Subscription> toCacheModel() {
2545 return _nullSubscriptionCacheModel;
2546 }
2547 };
2548
2549 private static CacheModel<Subscription> _nullSubscriptionCacheModel = new CacheModel<Subscription>() {
2550 public Subscription toEntityModel() {
2551 return _nullSubscription;
2552 }
2553 };
2554 }