001
014
015 package com.liferay.portlet.social.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.model.ModelListener;
037 import com.liferay.portal.service.persistence.BatchSessionUtil;
038 import com.liferay.portal.service.persistence.ResourcePersistence;
039 import com.liferay.portal.service.persistence.UserPersistence;
040 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
041
042 import com.liferay.portlet.social.NoSuchEquityUserException;
043 import com.liferay.portlet.social.model.SocialEquityUser;
044 import com.liferay.portlet.social.model.impl.SocialEquityUserImpl;
045 import com.liferay.portlet.social.model.impl.SocialEquityUserModelImpl;
046
047 import java.io.Serializable;
048
049 import java.util.ArrayList;
050 import java.util.Collections;
051 import java.util.List;
052
053
069 public class SocialEquityUserPersistenceImpl extends BasePersistenceImpl<SocialEquityUser>
070 implements SocialEquityUserPersistence {
071 public static final String FINDER_CLASS_NAME_ENTITY = SocialEquityUserImpl.class.getName();
072 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
073 ".List";
074 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
075 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
076 FINDER_CLASS_NAME_LIST, "findByGroupId",
077 new String[] {
078 Long.class.getName(),
079
080 "java.lang.Integer", "java.lang.Integer",
081 "com.liferay.portal.kernel.util.OrderByComparator"
082 });
083 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
084 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
085 FINDER_CLASS_NAME_LIST, "countByGroupId",
086 new String[] { Long.class.getName() });
087 public static final FinderPath FINDER_PATH_FIND_BY_GROUPRANKED = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
088 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
089 FINDER_CLASS_NAME_LIST, "findByGroupRanked",
090 new String[] {
091 Long.class.getName(),
092
093 "java.lang.Integer", "java.lang.Integer",
094 "com.liferay.portal.kernel.util.OrderByComparator"
095 });
096 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPRANKED = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
097 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
098 FINDER_CLASS_NAME_LIST, "countByGroupRanked",
099 new String[] { Long.class.getName() });
100 public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
101 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
102 FINDER_CLASS_NAME_LIST, "findByUserId",
103 new String[] {
104 Long.class.getName(),
105
106 "java.lang.Integer", "java.lang.Integer",
107 "com.liferay.portal.kernel.util.OrderByComparator"
108 });
109 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
110 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
111 FINDER_CLASS_NAME_LIST, "countByUserId",
112 new String[] { Long.class.getName() });
113 public static final FinderPath FINDER_PATH_FIND_BY_RANK = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
114 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
115 FINDER_CLASS_NAME_LIST, "findByRank",
116 new String[] {
117 Integer.class.getName(),
118
119 "java.lang.Integer", "java.lang.Integer",
120 "com.liferay.portal.kernel.util.OrderByComparator"
121 });
122 public static final FinderPath FINDER_PATH_COUNT_BY_RANK = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
123 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
124 FINDER_CLASS_NAME_LIST, "countByRank",
125 new String[] { Integer.class.getName() });
126 public static final FinderPath FINDER_PATH_FETCH_BY_G_U = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
127 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
128 FINDER_CLASS_NAME_ENTITY, "fetchByG_U",
129 new String[] { Long.class.getName(), Long.class.getName() });
130 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
131 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
132 FINDER_CLASS_NAME_LIST, "countByG_U",
133 new String[] { Long.class.getName(), Long.class.getName() });
134 public static final FinderPath FINDER_PATH_FIND_BY_G_R = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
135 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
136 FINDER_CLASS_NAME_LIST, "findByG_R",
137 new String[] {
138 Long.class.getName(), Integer.class.getName(),
139
140 "java.lang.Integer", "java.lang.Integer",
141 "com.liferay.portal.kernel.util.OrderByComparator"
142 });
143 public static final FinderPath FINDER_PATH_COUNT_BY_G_R = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
144 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
145 FINDER_CLASS_NAME_LIST, "countByG_R",
146 new String[] { Long.class.getName(), Integer.class.getName() });
147 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
148 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
149 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
150 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
151 SocialEquityUserModelImpl.FINDER_CACHE_ENABLED,
152 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
153
154
159 public void cacheResult(SocialEquityUser socialEquityUser) {
160 EntityCacheUtil.putResult(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
161 SocialEquityUserImpl.class, socialEquityUser.getPrimaryKey(),
162 socialEquityUser);
163
164 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
165 new Object[] {
166 new Long(socialEquityUser.getGroupId()),
167 new Long(socialEquityUser.getUserId())
168 }, socialEquityUser);
169 }
170
171
176 public void cacheResult(List<SocialEquityUser> socialEquityUsers) {
177 for (SocialEquityUser socialEquityUser : socialEquityUsers) {
178 if (EntityCacheUtil.getResult(
179 SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
180 SocialEquityUserImpl.class,
181 socialEquityUser.getPrimaryKey(), this) == null) {
182 cacheResult(socialEquityUser);
183 }
184 }
185 }
186
187
194 public void clearCache() {
195 CacheRegistryUtil.clear(SocialEquityUserImpl.class.getName());
196 EntityCacheUtil.clearCache(SocialEquityUserImpl.class.getName());
197 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
198 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
199 }
200
201
208 public void clearCache(SocialEquityUser socialEquityUser) {
209 EntityCacheUtil.removeResult(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
210 SocialEquityUserImpl.class, socialEquityUser.getPrimaryKey());
211
212 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
213 new Object[] {
214 new Long(socialEquityUser.getGroupId()),
215 new Long(socialEquityUser.getUserId())
216 });
217 }
218
219
225 public SocialEquityUser create(long equityUserId) {
226 SocialEquityUser socialEquityUser = new SocialEquityUserImpl();
227
228 socialEquityUser.setNew(true);
229 socialEquityUser.setPrimaryKey(equityUserId);
230
231 return socialEquityUser;
232 }
233
234
242 public SocialEquityUser remove(Serializable primaryKey)
243 throws NoSuchModelException, SystemException {
244 return remove(((Long)primaryKey).longValue());
245 }
246
247
255 public SocialEquityUser remove(long equityUserId)
256 throws NoSuchEquityUserException, SystemException {
257 Session session = null;
258
259 try {
260 session = openSession();
261
262 SocialEquityUser socialEquityUser = (SocialEquityUser)session.get(SocialEquityUserImpl.class,
263 new Long(equityUserId));
264
265 if (socialEquityUser == null) {
266 if (_log.isWarnEnabled()) {
267 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + equityUserId);
268 }
269
270 throw new NoSuchEquityUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
271 equityUserId);
272 }
273
274 return remove(socialEquityUser);
275 }
276 catch (NoSuchEquityUserException nsee) {
277 throw nsee;
278 }
279 catch (Exception e) {
280 throw processException(e);
281 }
282 finally {
283 closeSession(session);
284 }
285 }
286
287 protected SocialEquityUser removeImpl(SocialEquityUser socialEquityUser)
288 throws SystemException {
289 socialEquityUser = toUnwrappedModel(socialEquityUser);
290
291 Session session = null;
292
293 try {
294 session = openSession();
295
296 if (socialEquityUser.isCachedModel() ||
297 BatchSessionUtil.isEnabled()) {
298 Object staleObject = session.get(SocialEquityUserImpl.class,
299 socialEquityUser.getPrimaryKeyObj());
300
301 if (staleObject != null) {
302 session.evict(staleObject);
303 }
304 }
305
306 session.delete(socialEquityUser);
307
308 session.flush();
309 }
310 catch (Exception e) {
311 throw processException(e);
312 }
313 finally {
314 closeSession(session);
315 }
316
317 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
318
319 SocialEquityUserModelImpl socialEquityUserModelImpl = (SocialEquityUserModelImpl)socialEquityUser;
320
321 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
322 new Object[] {
323 new Long(socialEquityUserModelImpl.getOriginalGroupId()),
324 new Long(socialEquityUserModelImpl.getOriginalUserId())
325 });
326
327 EntityCacheUtil.removeResult(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
328 SocialEquityUserImpl.class, socialEquityUser.getPrimaryKey());
329
330 return socialEquityUser;
331 }
332
333 public SocialEquityUser updateImpl(
334 com.liferay.portlet.social.model.SocialEquityUser socialEquityUser,
335 boolean merge) throws SystemException {
336 socialEquityUser = toUnwrappedModel(socialEquityUser);
337
338 boolean isNew = socialEquityUser.isNew();
339
340 SocialEquityUserModelImpl socialEquityUserModelImpl = (SocialEquityUserModelImpl)socialEquityUser;
341
342 Session session = null;
343
344 try {
345 session = openSession();
346
347 BatchSessionUtil.update(session, socialEquityUser, merge);
348
349 socialEquityUser.setNew(false);
350 }
351 catch (Exception e) {
352 throw processException(e);
353 }
354 finally {
355 closeSession(session);
356 }
357
358 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
359
360 EntityCacheUtil.putResult(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
361 SocialEquityUserImpl.class, socialEquityUser.getPrimaryKey(),
362 socialEquityUser);
363
364 if (!isNew &&
365 ((socialEquityUser.getGroupId() != socialEquityUserModelImpl.getOriginalGroupId()) ||
366 (socialEquityUser.getUserId() != socialEquityUserModelImpl.getOriginalUserId()))) {
367 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
368 new Object[] {
369 new Long(socialEquityUserModelImpl.getOriginalGroupId()),
370 new Long(socialEquityUserModelImpl.getOriginalUserId())
371 });
372 }
373
374 if (isNew ||
375 ((socialEquityUser.getGroupId() != socialEquityUserModelImpl.getOriginalGroupId()) ||
376 (socialEquityUser.getUserId() != socialEquityUserModelImpl.getOriginalUserId()))) {
377 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
378 new Object[] {
379 new Long(socialEquityUser.getGroupId()),
380 new Long(socialEquityUser.getUserId())
381 }, socialEquityUser);
382 }
383
384 return socialEquityUser;
385 }
386
387 protected SocialEquityUser toUnwrappedModel(
388 SocialEquityUser socialEquityUser) {
389 if (socialEquityUser instanceof SocialEquityUserImpl) {
390 return socialEquityUser;
391 }
392
393 SocialEquityUserImpl socialEquityUserImpl = new SocialEquityUserImpl();
394
395 socialEquityUserImpl.setNew(socialEquityUser.isNew());
396 socialEquityUserImpl.setPrimaryKey(socialEquityUser.getPrimaryKey());
397
398 socialEquityUserImpl.setEquityUserId(socialEquityUser.getEquityUserId());
399 socialEquityUserImpl.setGroupId(socialEquityUser.getGroupId());
400 socialEquityUserImpl.setCompanyId(socialEquityUser.getCompanyId());
401 socialEquityUserImpl.setUserId(socialEquityUser.getUserId());
402 socialEquityUserImpl.setContributionK(socialEquityUser.getContributionK());
403 socialEquityUserImpl.setContributionB(socialEquityUser.getContributionB());
404 socialEquityUserImpl.setParticipationK(socialEquityUser.getParticipationK());
405 socialEquityUserImpl.setParticipationB(socialEquityUser.getParticipationB());
406 socialEquityUserImpl.setRank(socialEquityUser.getRank());
407
408 return socialEquityUserImpl;
409 }
410
411
419 public SocialEquityUser findByPrimaryKey(Serializable primaryKey)
420 throws NoSuchModelException, SystemException {
421 return findByPrimaryKey(((Long)primaryKey).longValue());
422 }
423
424
432 public SocialEquityUser findByPrimaryKey(long equityUserId)
433 throws NoSuchEquityUserException, SystemException {
434 SocialEquityUser socialEquityUser = fetchByPrimaryKey(equityUserId);
435
436 if (socialEquityUser == null) {
437 if (_log.isWarnEnabled()) {
438 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + equityUserId);
439 }
440
441 throw new NoSuchEquityUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
442 equityUserId);
443 }
444
445 return socialEquityUser;
446 }
447
448
455 public SocialEquityUser fetchByPrimaryKey(Serializable primaryKey)
456 throws SystemException {
457 return fetchByPrimaryKey(((Long)primaryKey).longValue());
458 }
459
460
467 public SocialEquityUser fetchByPrimaryKey(long equityUserId)
468 throws SystemException {
469 SocialEquityUser socialEquityUser = (SocialEquityUser)EntityCacheUtil.getResult(SocialEquityUserModelImpl.ENTITY_CACHE_ENABLED,
470 SocialEquityUserImpl.class, equityUserId, this);
471
472 if (socialEquityUser == null) {
473 Session session = null;
474
475 try {
476 session = openSession();
477
478 socialEquityUser = (SocialEquityUser)session.get(SocialEquityUserImpl.class,
479 new Long(equityUserId));
480 }
481 catch (Exception e) {
482 throw processException(e);
483 }
484 finally {
485 if (socialEquityUser != null) {
486 cacheResult(socialEquityUser);
487 }
488
489 closeSession(session);
490 }
491 }
492
493 return socialEquityUser;
494 }
495
496
503 public List<SocialEquityUser> findByGroupId(long groupId)
504 throws SystemException {
505 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
506 }
507
508
521 public List<SocialEquityUser> findByGroupId(long groupId, int start, int end)
522 throws SystemException {
523 return findByGroupId(groupId, start, end, null);
524 }
525
526
540 public List<SocialEquityUser> findByGroupId(long groupId, int start,
541 int end, OrderByComparator orderByComparator) throws SystemException {
542 Object[] finderArgs = new Object[] {
543 groupId,
544
545 String.valueOf(start), String.valueOf(end),
546 String.valueOf(orderByComparator)
547 };
548
549 List<SocialEquityUser> list = (List<SocialEquityUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
550 finderArgs, this);
551
552 if (list == null) {
553 Session session = null;
554
555 try {
556 session = openSession();
557
558 StringBundler query = null;
559
560 if (orderByComparator != null) {
561 query = new StringBundler(3 +
562 (orderByComparator.getOrderByFields().length * 3));
563 }
564 else {
565 query = new StringBundler(2);
566 }
567
568 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
569
570 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
571
572 if (orderByComparator != null) {
573 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
574 orderByComparator);
575 }
576
577 String sql = query.toString();
578
579 Query q = session.createQuery(sql);
580
581 QueryPos qPos = QueryPos.getInstance(q);
582
583 qPos.add(groupId);
584
585 list = (List<SocialEquityUser>)QueryUtil.list(q, getDialect(),
586 start, end);
587 }
588 catch (Exception e) {
589 throw processException(e);
590 }
591 finally {
592 if (list == null) {
593 list = new ArrayList<SocialEquityUser>();
594 }
595
596 cacheResult(list);
597
598 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
599 finderArgs, list);
600
601 closeSession(session);
602 }
603 }
604
605 return list;
606 }
607
608
621 public SocialEquityUser findByGroupId_First(long groupId,
622 OrderByComparator orderByComparator)
623 throws NoSuchEquityUserException, SystemException {
624 List<SocialEquityUser> list = findByGroupId(groupId, 0, 1,
625 orderByComparator);
626
627 if (list.isEmpty()) {
628 StringBundler msg = new StringBundler(4);
629
630 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
631
632 msg.append("groupId=");
633 msg.append(groupId);
634
635 msg.append(StringPool.CLOSE_CURLY_BRACE);
636
637 throw new NoSuchEquityUserException(msg.toString());
638 }
639 else {
640 return list.get(0);
641 }
642 }
643
644
657 public SocialEquityUser findByGroupId_Last(long groupId,
658 OrderByComparator orderByComparator)
659 throws NoSuchEquityUserException, SystemException {
660 int count = countByGroupId(groupId);
661
662 List<SocialEquityUser> list = findByGroupId(groupId, count - 1, count,
663 orderByComparator);
664
665 if (list.isEmpty()) {
666 StringBundler msg = new StringBundler(4);
667
668 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
669
670 msg.append("groupId=");
671 msg.append(groupId);
672
673 msg.append(StringPool.CLOSE_CURLY_BRACE);
674
675 throw new NoSuchEquityUserException(msg.toString());
676 }
677 else {
678 return list.get(0);
679 }
680 }
681
682
696 public SocialEquityUser[] findByGroupId_PrevAndNext(long equityUserId,
697 long groupId, OrderByComparator orderByComparator)
698 throws NoSuchEquityUserException, SystemException {
699 SocialEquityUser socialEquityUser = findByPrimaryKey(equityUserId);
700
701 Session session = null;
702
703 try {
704 session = openSession();
705
706 SocialEquityUser[] array = new SocialEquityUserImpl[3];
707
708 array[0] = getByGroupId_PrevAndNext(session, socialEquityUser,
709 groupId, orderByComparator, true);
710
711 array[1] = socialEquityUser;
712
713 array[2] = getByGroupId_PrevAndNext(session, socialEquityUser,
714 groupId, orderByComparator, false);
715
716 return array;
717 }
718 catch (Exception e) {
719 throw processException(e);
720 }
721 finally {
722 closeSession(session);
723 }
724 }
725
726 protected SocialEquityUser getByGroupId_PrevAndNext(Session session,
727 SocialEquityUser socialEquityUser, long groupId,
728 OrderByComparator orderByComparator, boolean previous) {
729 StringBundler query = null;
730
731 if (orderByComparator != null) {
732 query = new StringBundler(6 +
733 (orderByComparator.getOrderByFields().length * 6));
734 }
735 else {
736 query = new StringBundler(3);
737 }
738
739 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
740
741 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
742
743 if (orderByComparator != null) {
744 String[] orderByFields = orderByComparator.getOrderByFields();
745
746 if (orderByFields.length > 0) {
747 query.append(WHERE_AND);
748 }
749
750 for (int i = 0; i < orderByFields.length; i++) {
751 query.append(_ORDER_BY_ENTITY_ALIAS);
752 query.append(orderByFields[i]);
753
754 if ((i + 1) < orderByFields.length) {
755 if (orderByComparator.isAscending() ^ previous) {
756 query.append(WHERE_GREATER_THAN_HAS_NEXT);
757 }
758 else {
759 query.append(WHERE_LESSER_THAN_HAS_NEXT);
760 }
761 }
762 else {
763 if (orderByComparator.isAscending() ^ previous) {
764 query.append(WHERE_GREATER_THAN);
765 }
766 else {
767 query.append(WHERE_LESSER_THAN);
768 }
769 }
770 }
771
772 query.append(ORDER_BY_CLAUSE);
773
774 for (int i = 0; i < orderByFields.length; i++) {
775 query.append(_ORDER_BY_ENTITY_ALIAS);
776 query.append(orderByFields[i]);
777
778 if ((i + 1) < orderByFields.length) {
779 if (orderByComparator.isAscending() ^ previous) {
780 query.append(ORDER_BY_ASC_HAS_NEXT);
781 }
782 else {
783 query.append(ORDER_BY_DESC_HAS_NEXT);
784 }
785 }
786 else {
787 if (orderByComparator.isAscending() ^ previous) {
788 query.append(ORDER_BY_ASC);
789 }
790 else {
791 query.append(ORDER_BY_DESC);
792 }
793 }
794 }
795 }
796
797 String sql = query.toString();
798
799 Query q = session.createQuery(sql);
800
801 q.setFirstResult(0);
802 q.setMaxResults(2);
803
804 QueryPos qPos = QueryPos.getInstance(q);
805
806 qPos.add(groupId);
807
808 if (orderByComparator != null) {
809 Object[] values = orderByComparator.getOrderByValues(socialEquityUser);
810
811 for (Object value : values) {
812 qPos.add(value);
813 }
814 }
815
816 List<SocialEquityUser> list = q.list();
817
818 if (list.size() == 2) {
819 return list.get(1);
820 }
821 else {
822 return null;
823 }
824 }
825
826
833 public List<SocialEquityUser> findByGroupRanked(long groupId)
834 throws SystemException {
835 return findByGroupRanked(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
836 null);
837 }
838
839
852 public List<SocialEquityUser> findByGroupRanked(long groupId, int start,
853 int end) throws SystemException {
854 return findByGroupRanked(groupId, start, end, null);
855 }
856
857
871 public List<SocialEquityUser> findByGroupRanked(long groupId, int start,
872 int end, OrderByComparator orderByComparator) throws SystemException {
873 Object[] finderArgs = new Object[] {
874 groupId,
875
876 String.valueOf(start), String.valueOf(end),
877 String.valueOf(orderByComparator)
878 };
879
880 List<SocialEquityUser> list = (List<SocialEquityUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPRANKED,
881 finderArgs, this);
882
883 if (list == null) {
884 Session session = null;
885
886 try {
887 session = openSession();
888
889 StringBundler query = null;
890
891 if (orderByComparator != null) {
892 query = new StringBundler(3 +
893 (orderByComparator.getOrderByFields().length * 3));
894 }
895 else {
896 query = new StringBundler(2);
897 }
898
899 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
900
901 query.append(_FINDER_COLUMN_GROUPRANKED_GROUPID_2);
902
903 if (orderByComparator != null) {
904 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
905 orderByComparator);
906 }
907
908 String sql = query.toString();
909
910 Query q = session.createQuery(sql);
911
912 QueryPos qPos = QueryPos.getInstance(q);
913
914 qPos.add(groupId);
915
916 list = (List<SocialEquityUser>)QueryUtil.list(q, getDialect(),
917 start, end);
918 }
919 catch (Exception e) {
920 throw processException(e);
921 }
922 finally {
923 if (list == null) {
924 list = new ArrayList<SocialEquityUser>();
925 }
926
927 cacheResult(list);
928
929 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPRANKED,
930 finderArgs, list);
931
932 closeSession(session);
933 }
934 }
935
936 return list;
937 }
938
939
952 public SocialEquityUser findByGroupRanked_First(long groupId,
953 OrderByComparator orderByComparator)
954 throws NoSuchEquityUserException, SystemException {
955 List<SocialEquityUser> list = findByGroupRanked(groupId, 0, 1,
956 orderByComparator);
957
958 if (list.isEmpty()) {
959 StringBundler msg = new StringBundler(4);
960
961 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
962
963 msg.append("groupId=");
964 msg.append(groupId);
965
966 msg.append(StringPool.CLOSE_CURLY_BRACE);
967
968 throw new NoSuchEquityUserException(msg.toString());
969 }
970 else {
971 return list.get(0);
972 }
973 }
974
975
988 public SocialEquityUser findByGroupRanked_Last(long groupId,
989 OrderByComparator orderByComparator)
990 throws NoSuchEquityUserException, SystemException {
991 int count = countByGroupRanked(groupId);
992
993 List<SocialEquityUser> list = findByGroupRanked(groupId, count - 1,
994 count, orderByComparator);
995
996 if (list.isEmpty()) {
997 StringBundler msg = new StringBundler(4);
998
999 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1000
1001 msg.append("groupId=");
1002 msg.append(groupId);
1003
1004 msg.append(StringPool.CLOSE_CURLY_BRACE);
1005
1006 throw new NoSuchEquityUserException(msg.toString());
1007 }
1008 else {
1009 return list.get(0);
1010 }
1011 }
1012
1013
1027 public SocialEquityUser[] findByGroupRanked_PrevAndNext(long equityUserId,
1028 long groupId, OrderByComparator orderByComparator)
1029 throws NoSuchEquityUserException, SystemException {
1030 SocialEquityUser socialEquityUser = findByPrimaryKey(equityUserId);
1031
1032 Session session = null;
1033
1034 try {
1035 session = openSession();
1036
1037 SocialEquityUser[] array = new SocialEquityUserImpl[3];
1038
1039 array[0] = getByGroupRanked_PrevAndNext(session, socialEquityUser,
1040 groupId, orderByComparator, true);
1041
1042 array[1] = socialEquityUser;
1043
1044 array[2] = getByGroupRanked_PrevAndNext(session, socialEquityUser,
1045 groupId, orderByComparator, false);
1046
1047 return array;
1048 }
1049 catch (Exception e) {
1050 throw processException(e);
1051 }
1052 finally {
1053 closeSession(session);
1054 }
1055 }
1056
1057 protected SocialEquityUser getByGroupRanked_PrevAndNext(Session session,
1058 SocialEquityUser socialEquityUser, long groupId,
1059 OrderByComparator orderByComparator, boolean previous) {
1060 StringBundler query = null;
1061
1062 if (orderByComparator != null) {
1063 query = new StringBundler(6 +
1064 (orderByComparator.getOrderByFields().length * 6));
1065 }
1066 else {
1067 query = new StringBundler(3);
1068 }
1069
1070 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
1071
1072 query.append(_FINDER_COLUMN_GROUPRANKED_GROUPID_2);
1073
1074 if (orderByComparator != null) {
1075 String[] orderByFields = orderByComparator.getOrderByFields();
1076
1077 if (orderByFields.length > 0) {
1078 query.append(WHERE_AND);
1079 }
1080
1081 for (int i = 0; i < orderByFields.length; i++) {
1082 query.append(_ORDER_BY_ENTITY_ALIAS);
1083 query.append(orderByFields[i]);
1084
1085 if ((i + 1) < orderByFields.length) {
1086 if (orderByComparator.isAscending() ^ previous) {
1087 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1088 }
1089 else {
1090 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1091 }
1092 }
1093 else {
1094 if (orderByComparator.isAscending() ^ previous) {
1095 query.append(WHERE_GREATER_THAN);
1096 }
1097 else {
1098 query.append(WHERE_LESSER_THAN);
1099 }
1100 }
1101 }
1102
1103 query.append(ORDER_BY_CLAUSE);
1104
1105 for (int i = 0; i < orderByFields.length; i++) {
1106 query.append(_ORDER_BY_ENTITY_ALIAS);
1107 query.append(orderByFields[i]);
1108
1109 if ((i + 1) < orderByFields.length) {
1110 if (orderByComparator.isAscending() ^ previous) {
1111 query.append(ORDER_BY_ASC_HAS_NEXT);
1112 }
1113 else {
1114 query.append(ORDER_BY_DESC_HAS_NEXT);
1115 }
1116 }
1117 else {
1118 if (orderByComparator.isAscending() ^ previous) {
1119 query.append(ORDER_BY_ASC);
1120 }
1121 else {
1122 query.append(ORDER_BY_DESC);
1123 }
1124 }
1125 }
1126 }
1127
1128 String sql = query.toString();
1129
1130 Query q = session.createQuery(sql);
1131
1132 q.setFirstResult(0);
1133 q.setMaxResults(2);
1134
1135 QueryPos qPos = QueryPos.getInstance(q);
1136
1137 qPos.add(groupId);
1138
1139 if (orderByComparator != null) {
1140 Object[] values = orderByComparator.getOrderByValues(socialEquityUser);
1141
1142 for (Object value : values) {
1143 qPos.add(value);
1144 }
1145 }
1146
1147 List<SocialEquityUser> list = q.list();
1148
1149 if (list.size() == 2) {
1150 return list.get(1);
1151 }
1152 else {
1153 return null;
1154 }
1155 }
1156
1157
1164 public List<SocialEquityUser> findByUserId(long userId)
1165 throws SystemException {
1166 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1167 }
1168
1169
1182 public List<SocialEquityUser> findByUserId(long userId, int start, int end)
1183 throws SystemException {
1184 return findByUserId(userId, start, end, null);
1185 }
1186
1187
1201 public List<SocialEquityUser> findByUserId(long userId, int start, int end,
1202 OrderByComparator orderByComparator) throws SystemException {
1203 Object[] finderArgs = new Object[] {
1204 userId,
1205
1206 String.valueOf(start), String.valueOf(end),
1207 String.valueOf(orderByComparator)
1208 };
1209
1210 List<SocialEquityUser> list = (List<SocialEquityUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
1211 finderArgs, this);
1212
1213 if (list == null) {
1214 Session session = null;
1215
1216 try {
1217 session = openSession();
1218
1219 StringBundler query = null;
1220
1221 if (orderByComparator != null) {
1222 query = new StringBundler(3 +
1223 (orderByComparator.getOrderByFields().length * 3));
1224 }
1225 else {
1226 query = new StringBundler(2);
1227 }
1228
1229 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
1230
1231 query.append(_FINDER_COLUMN_USERID_USERID_2);
1232
1233 if (orderByComparator != null) {
1234 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1235 orderByComparator);
1236 }
1237
1238 String sql = query.toString();
1239
1240 Query q = session.createQuery(sql);
1241
1242 QueryPos qPos = QueryPos.getInstance(q);
1243
1244 qPos.add(userId);
1245
1246 list = (List<SocialEquityUser>)QueryUtil.list(q, getDialect(),
1247 start, end);
1248 }
1249 catch (Exception e) {
1250 throw processException(e);
1251 }
1252 finally {
1253 if (list == null) {
1254 list = new ArrayList<SocialEquityUser>();
1255 }
1256
1257 cacheResult(list);
1258
1259 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
1260 finderArgs, list);
1261
1262 closeSession(session);
1263 }
1264 }
1265
1266 return list;
1267 }
1268
1269
1282 public SocialEquityUser findByUserId_First(long userId,
1283 OrderByComparator orderByComparator)
1284 throws NoSuchEquityUserException, SystemException {
1285 List<SocialEquityUser> list = findByUserId(userId, 0, 1,
1286 orderByComparator);
1287
1288 if (list.isEmpty()) {
1289 StringBundler msg = new StringBundler(4);
1290
1291 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1292
1293 msg.append("userId=");
1294 msg.append(userId);
1295
1296 msg.append(StringPool.CLOSE_CURLY_BRACE);
1297
1298 throw new NoSuchEquityUserException(msg.toString());
1299 }
1300 else {
1301 return list.get(0);
1302 }
1303 }
1304
1305
1318 public SocialEquityUser findByUserId_Last(long userId,
1319 OrderByComparator orderByComparator)
1320 throws NoSuchEquityUserException, SystemException {
1321 int count = countByUserId(userId);
1322
1323 List<SocialEquityUser> list = findByUserId(userId, count - 1, count,
1324 orderByComparator);
1325
1326 if (list.isEmpty()) {
1327 StringBundler msg = new StringBundler(4);
1328
1329 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1330
1331 msg.append("userId=");
1332 msg.append(userId);
1333
1334 msg.append(StringPool.CLOSE_CURLY_BRACE);
1335
1336 throw new NoSuchEquityUserException(msg.toString());
1337 }
1338 else {
1339 return list.get(0);
1340 }
1341 }
1342
1343
1357 public SocialEquityUser[] findByUserId_PrevAndNext(long equityUserId,
1358 long userId, OrderByComparator orderByComparator)
1359 throws NoSuchEquityUserException, SystemException {
1360 SocialEquityUser socialEquityUser = findByPrimaryKey(equityUserId);
1361
1362 Session session = null;
1363
1364 try {
1365 session = openSession();
1366
1367 SocialEquityUser[] array = new SocialEquityUserImpl[3];
1368
1369 array[0] = getByUserId_PrevAndNext(session, socialEquityUser,
1370 userId, orderByComparator, true);
1371
1372 array[1] = socialEquityUser;
1373
1374 array[2] = getByUserId_PrevAndNext(session, socialEquityUser,
1375 userId, orderByComparator, false);
1376
1377 return array;
1378 }
1379 catch (Exception e) {
1380 throw processException(e);
1381 }
1382 finally {
1383 closeSession(session);
1384 }
1385 }
1386
1387 protected SocialEquityUser getByUserId_PrevAndNext(Session session,
1388 SocialEquityUser socialEquityUser, long userId,
1389 OrderByComparator orderByComparator, boolean previous) {
1390 StringBundler query = null;
1391
1392 if (orderByComparator != null) {
1393 query = new StringBundler(6 +
1394 (orderByComparator.getOrderByFields().length * 6));
1395 }
1396 else {
1397 query = new StringBundler(3);
1398 }
1399
1400 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
1401
1402 query.append(_FINDER_COLUMN_USERID_USERID_2);
1403
1404 if (orderByComparator != null) {
1405 String[] orderByFields = orderByComparator.getOrderByFields();
1406
1407 if (orderByFields.length > 0) {
1408 query.append(WHERE_AND);
1409 }
1410
1411 for (int i = 0; i < orderByFields.length; i++) {
1412 query.append(_ORDER_BY_ENTITY_ALIAS);
1413 query.append(orderByFields[i]);
1414
1415 if ((i + 1) < orderByFields.length) {
1416 if (orderByComparator.isAscending() ^ previous) {
1417 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1418 }
1419 else {
1420 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1421 }
1422 }
1423 else {
1424 if (orderByComparator.isAscending() ^ previous) {
1425 query.append(WHERE_GREATER_THAN);
1426 }
1427 else {
1428 query.append(WHERE_LESSER_THAN);
1429 }
1430 }
1431 }
1432
1433 query.append(ORDER_BY_CLAUSE);
1434
1435 for (int i = 0; i < orderByFields.length; i++) {
1436 query.append(_ORDER_BY_ENTITY_ALIAS);
1437 query.append(orderByFields[i]);
1438
1439 if ((i + 1) < orderByFields.length) {
1440 if (orderByComparator.isAscending() ^ previous) {
1441 query.append(ORDER_BY_ASC_HAS_NEXT);
1442 }
1443 else {
1444 query.append(ORDER_BY_DESC_HAS_NEXT);
1445 }
1446 }
1447 else {
1448 if (orderByComparator.isAscending() ^ previous) {
1449 query.append(ORDER_BY_ASC);
1450 }
1451 else {
1452 query.append(ORDER_BY_DESC);
1453 }
1454 }
1455 }
1456 }
1457
1458 String sql = query.toString();
1459
1460 Query q = session.createQuery(sql);
1461
1462 q.setFirstResult(0);
1463 q.setMaxResults(2);
1464
1465 QueryPos qPos = QueryPos.getInstance(q);
1466
1467 qPos.add(userId);
1468
1469 if (orderByComparator != null) {
1470 Object[] values = orderByComparator.getOrderByValues(socialEquityUser);
1471
1472 for (Object value : values) {
1473 qPos.add(value);
1474 }
1475 }
1476
1477 List<SocialEquityUser> list = q.list();
1478
1479 if (list.size() == 2) {
1480 return list.get(1);
1481 }
1482 else {
1483 return null;
1484 }
1485 }
1486
1487
1494 public List<SocialEquityUser> findByRank(int rank)
1495 throws SystemException {
1496 return findByRank(rank, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1497 }
1498
1499
1512 public List<SocialEquityUser> findByRank(int rank, int start, int end)
1513 throws SystemException {
1514 return findByRank(rank, start, end, null);
1515 }
1516
1517
1531 public List<SocialEquityUser> findByRank(int rank, int start, int end,
1532 OrderByComparator orderByComparator) throws SystemException {
1533 Object[] finderArgs = new Object[] {
1534 rank,
1535
1536 String.valueOf(start), String.valueOf(end),
1537 String.valueOf(orderByComparator)
1538 };
1539
1540 List<SocialEquityUser> list = (List<SocialEquityUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_RANK,
1541 finderArgs, this);
1542
1543 if (list == null) {
1544 Session session = null;
1545
1546 try {
1547 session = openSession();
1548
1549 StringBundler query = null;
1550
1551 if (orderByComparator != null) {
1552 query = new StringBundler(3 +
1553 (orderByComparator.getOrderByFields().length * 3));
1554 }
1555 else {
1556 query = new StringBundler(2);
1557 }
1558
1559 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
1560
1561 query.append(_FINDER_COLUMN_RANK_RANK_2);
1562
1563 if (orderByComparator != null) {
1564 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1565 orderByComparator);
1566 }
1567
1568 String sql = query.toString();
1569
1570 Query q = session.createQuery(sql);
1571
1572 QueryPos qPos = QueryPos.getInstance(q);
1573
1574 qPos.add(rank);
1575
1576 list = (List<SocialEquityUser>)QueryUtil.list(q, getDialect(),
1577 start, end);
1578 }
1579 catch (Exception e) {
1580 throw processException(e);
1581 }
1582 finally {
1583 if (list == null) {
1584 list = new ArrayList<SocialEquityUser>();
1585 }
1586
1587 cacheResult(list);
1588
1589 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_RANK, finderArgs,
1590 list);
1591
1592 closeSession(session);
1593 }
1594 }
1595
1596 return list;
1597 }
1598
1599
1612 public SocialEquityUser findByRank_First(int rank,
1613 OrderByComparator orderByComparator)
1614 throws NoSuchEquityUserException, SystemException {
1615 List<SocialEquityUser> list = findByRank(rank, 0, 1, orderByComparator);
1616
1617 if (list.isEmpty()) {
1618 StringBundler msg = new StringBundler(4);
1619
1620 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1621
1622 msg.append("rank=");
1623 msg.append(rank);
1624
1625 msg.append(StringPool.CLOSE_CURLY_BRACE);
1626
1627 throw new NoSuchEquityUserException(msg.toString());
1628 }
1629 else {
1630 return list.get(0);
1631 }
1632 }
1633
1634
1647 public SocialEquityUser findByRank_Last(int rank,
1648 OrderByComparator orderByComparator)
1649 throws NoSuchEquityUserException, SystemException {
1650 int count = countByRank(rank);
1651
1652 List<SocialEquityUser> list = findByRank(rank, count - 1, count,
1653 orderByComparator);
1654
1655 if (list.isEmpty()) {
1656 StringBundler msg = new StringBundler(4);
1657
1658 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1659
1660 msg.append("rank=");
1661 msg.append(rank);
1662
1663 msg.append(StringPool.CLOSE_CURLY_BRACE);
1664
1665 throw new NoSuchEquityUserException(msg.toString());
1666 }
1667 else {
1668 return list.get(0);
1669 }
1670 }
1671
1672
1686 public SocialEquityUser[] findByRank_PrevAndNext(long equityUserId,
1687 int rank, OrderByComparator orderByComparator)
1688 throws NoSuchEquityUserException, SystemException {
1689 SocialEquityUser socialEquityUser = findByPrimaryKey(equityUserId);
1690
1691 Session session = null;
1692
1693 try {
1694 session = openSession();
1695
1696 SocialEquityUser[] array = new SocialEquityUserImpl[3];
1697
1698 array[0] = getByRank_PrevAndNext(session, socialEquityUser, rank,
1699 orderByComparator, true);
1700
1701 array[1] = socialEquityUser;
1702
1703 array[2] = getByRank_PrevAndNext(session, socialEquityUser, rank,
1704 orderByComparator, false);
1705
1706 return array;
1707 }
1708 catch (Exception e) {
1709 throw processException(e);
1710 }
1711 finally {
1712 closeSession(session);
1713 }
1714 }
1715
1716 protected SocialEquityUser getByRank_PrevAndNext(Session session,
1717 SocialEquityUser socialEquityUser, int rank,
1718 OrderByComparator orderByComparator, boolean previous) {
1719 StringBundler query = null;
1720
1721 if (orderByComparator != null) {
1722 query = new StringBundler(6 +
1723 (orderByComparator.getOrderByFields().length * 6));
1724 }
1725 else {
1726 query = new StringBundler(3);
1727 }
1728
1729 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
1730
1731 query.append(_FINDER_COLUMN_RANK_RANK_2);
1732
1733 if (orderByComparator != null) {
1734 String[] orderByFields = orderByComparator.getOrderByFields();
1735
1736 if (orderByFields.length > 0) {
1737 query.append(WHERE_AND);
1738 }
1739
1740 for (int i = 0; i < orderByFields.length; i++) {
1741 query.append(_ORDER_BY_ENTITY_ALIAS);
1742 query.append(orderByFields[i]);
1743
1744 if ((i + 1) < orderByFields.length) {
1745 if (orderByComparator.isAscending() ^ previous) {
1746 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1747 }
1748 else {
1749 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1750 }
1751 }
1752 else {
1753 if (orderByComparator.isAscending() ^ previous) {
1754 query.append(WHERE_GREATER_THAN);
1755 }
1756 else {
1757 query.append(WHERE_LESSER_THAN);
1758 }
1759 }
1760 }
1761
1762 query.append(ORDER_BY_CLAUSE);
1763
1764 for (int i = 0; i < orderByFields.length; i++) {
1765 query.append(_ORDER_BY_ENTITY_ALIAS);
1766 query.append(orderByFields[i]);
1767
1768 if ((i + 1) < orderByFields.length) {
1769 if (orderByComparator.isAscending() ^ previous) {
1770 query.append(ORDER_BY_ASC_HAS_NEXT);
1771 }
1772 else {
1773 query.append(ORDER_BY_DESC_HAS_NEXT);
1774 }
1775 }
1776 else {
1777 if (orderByComparator.isAscending() ^ previous) {
1778 query.append(ORDER_BY_ASC);
1779 }
1780 else {
1781 query.append(ORDER_BY_DESC);
1782 }
1783 }
1784 }
1785 }
1786
1787 String sql = query.toString();
1788
1789 Query q = session.createQuery(sql);
1790
1791 q.setFirstResult(0);
1792 q.setMaxResults(2);
1793
1794 QueryPos qPos = QueryPos.getInstance(q);
1795
1796 qPos.add(rank);
1797
1798 if (orderByComparator != null) {
1799 Object[] values = orderByComparator.getOrderByValues(socialEquityUser);
1800
1801 for (Object value : values) {
1802 qPos.add(value);
1803 }
1804 }
1805
1806 List<SocialEquityUser> list = q.list();
1807
1808 if (list.size() == 2) {
1809 return list.get(1);
1810 }
1811 else {
1812 return null;
1813 }
1814 }
1815
1816
1825 public SocialEquityUser findByG_U(long groupId, long userId)
1826 throws NoSuchEquityUserException, SystemException {
1827 SocialEquityUser socialEquityUser = fetchByG_U(groupId, userId);
1828
1829 if (socialEquityUser == null) {
1830 StringBundler msg = new StringBundler(6);
1831
1832 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1833
1834 msg.append("groupId=");
1835 msg.append(groupId);
1836
1837 msg.append(", userId=");
1838 msg.append(userId);
1839
1840 msg.append(StringPool.CLOSE_CURLY_BRACE);
1841
1842 if (_log.isWarnEnabled()) {
1843 _log.warn(msg.toString());
1844 }
1845
1846 throw new NoSuchEquityUserException(msg.toString());
1847 }
1848
1849 return socialEquityUser;
1850 }
1851
1852
1860 public SocialEquityUser fetchByG_U(long groupId, long userId)
1861 throws SystemException {
1862 return fetchByG_U(groupId, userId, true);
1863 }
1864
1865
1873 public SocialEquityUser fetchByG_U(long groupId, long userId,
1874 boolean retrieveFromCache) throws SystemException {
1875 Object[] finderArgs = new Object[] { groupId, userId };
1876
1877 Object result = null;
1878
1879 if (retrieveFromCache) {
1880 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_U,
1881 finderArgs, this);
1882 }
1883
1884 if (result == null) {
1885 Session session = null;
1886
1887 try {
1888 session = openSession();
1889
1890 StringBundler query = new StringBundler(3);
1891
1892 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
1893
1894 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1895
1896 query.append(_FINDER_COLUMN_G_U_USERID_2);
1897
1898 String sql = query.toString();
1899
1900 Query q = session.createQuery(sql);
1901
1902 QueryPos qPos = QueryPos.getInstance(q);
1903
1904 qPos.add(groupId);
1905
1906 qPos.add(userId);
1907
1908 List<SocialEquityUser> list = q.list();
1909
1910 result = list;
1911
1912 SocialEquityUser socialEquityUser = null;
1913
1914 if (list.isEmpty()) {
1915 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1916 finderArgs, list);
1917 }
1918 else {
1919 socialEquityUser = list.get(0);
1920
1921 cacheResult(socialEquityUser);
1922
1923 if ((socialEquityUser.getGroupId() != groupId) ||
1924 (socialEquityUser.getUserId() != userId)) {
1925 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1926 finderArgs, socialEquityUser);
1927 }
1928 }
1929
1930 return socialEquityUser;
1931 }
1932 catch (Exception e) {
1933 throw processException(e);
1934 }
1935 finally {
1936 if (result == null) {
1937 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1938 finderArgs, new ArrayList<SocialEquityUser>());
1939 }
1940
1941 closeSession(session);
1942 }
1943 }
1944 else {
1945 if (result instanceof List<?>) {
1946 return null;
1947 }
1948 else {
1949 return (SocialEquityUser)result;
1950 }
1951 }
1952 }
1953
1954
1962 public List<SocialEquityUser> findByG_R(long groupId, int rank)
1963 throws SystemException {
1964 return findByG_R(groupId, rank, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1965 null);
1966 }
1967
1968
1982 public List<SocialEquityUser> findByG_R(long groupId, int rank, int start,
1983 int end) throws SystemException {
1984 return findByG_R(groupId, rank, start, end, null);
1985 }
1986
1987
2002 public List<SocialEquityUser> findByG_R(long groupId, int rank, int start,
2003 int end, OrderByComparator orderByComparator) throws SystemException {
2004 Object[] finderArgs = new Object[] {
2005 groupId, rank,
2006
2007 String.valueOf(start), String.valueOf(end),
2008 String.valueOf(orderByComparator)
2009 };
2010
2011 List<SocialEquityUser> list = (List<SocialEquityUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_R,
2012 finderArgs, this);
2013
2014 if (list == null) {
2015 Session session = null;
2016
2017 try {
2018 session = openSession();
2019
2020 StringBundler query = null;
2021
2022 if (orderByComparator != null) {
2023 query = new StringBundler(4 +
2024 (orderByComparator.getOrderByFields().length * 3));
2025 }
2026 else {
2027 query = new StringBundler(3);
2028 }
2029
2030 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
2031
2032 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2033
2034 query.append(_FINDER_COLUMN_G_R_RANK_2);
2035
2036 if (orderByComparator != null) {
2037 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2038 orderByComparator);
2039 }
2040
2041 String sql = query.toString();
2042
2043 Query q = session.createQuery(sql);
2044
2045 QueryPos qPos = QueryPos.getInstance(q);
2046
2047 qPos.add(groupId);
2048
2049 qPos.add(rank);
2050
2051 list = (List<SocialEquityUser>)QueryUtil.list(q, getDialect(),
2052 start, end);
2053 }
2054 catch (Exception e) {
2055 throw processException(e);
2056 }
2057 finally {
2058 if (list == null) {
2059 list = new ArrayList<SocialEquityUser>();
2060 }
2061
2062 cacheResult(list);
2063
2064 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_R, finderArgs,
2065 list);
2066
2067 closeSession(session);
2068 }
2069 }
2070
2071 return list;
2072 }
2073
2074
2088 public SocialEquityUser findByG_R_First(long groupId, int rank,
2089 OrderByComparator orderByComparator)
2090 throws NoSuchEquityUserException, SystemException {
2091 List<SocialEquityUser> list = findByG_R(groupId, rank, 0, 1,
2092 orderByComparator);
2093
2094 if (list.isEmpty()) {
2095 StringBundler msg = new StringBundler(6);
2096
2097 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2098
2099 msg.append("groupId=");
2100 msg.append(groupId);
2101
2102 msg.append(", rank=");
2103 msg.append(rank);
2104
2105 msg.append(StringPool.CLOSE_CURLY_BRACE);
2106
2107 throw new NoSuchEquityUserException(msg.toString());
2108 }
2109 else {
2110 return list.get(0);
2111 }
2112 }
2113
2114
2128 public SocialEquityUser findByG_R_Last(long groupId, int rank,
2129 OrderByComparator orderByComparator)
2130 throws NoSuchEquityUserException, SystemException {
2131 int count = countByG_R(groupId, rank);
2132
2133 List<SocialEquityUser> list = findByG_R(groupId, rank, count - 1,
2134 count, orderByComparator);
2135
2136 if (list.isEmpty()) {
2137 StringBundler msg = new StringBundler(6);
2138
2139 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2140
2141 msg.append("groupId=");
2142 msg.append(groupId);
2143
2144 msg.append(", rank=");
2145 msg.append(rank);
2146
2147 msg.append(StringPool.CLOSE_CURLY_BRACE);
2148
2149 throw new NoSuchEquityUserException(msg.toString());
2150 }
2151 else {
2152 return list.get(0);
2153 }
2154 }
2155
2156
2171 public SocialEquityUser[] findByG_R_PrevAndNext(long equityUserId,
2172 long groupId, int rank, OrderByComparator orderByComparator)
2173 throws NoSuchEquityUserException, SystemException {
2174 SocialEquityUser socialEquityUser = findByPrimaryKey(equityUserId);
2175
2176 Session session = null;
2177
2178 try {
2179 session = openSession();
2180
2181 SocialEquityUser[] array = new SocialEquityUserImpl[3];
2182
2183 array[0] = getByG_R_PrevAndNext(session, socialEquityUser, groupId,
2184 rank, orderByComparator, true);
2185
2186 array[1] = socialEquityUser;
2187
2188 array[2] = getByG_R_PrevAndNext(session, socialEquityUser, groupId,
2189 rank, orderByComparator, false);
2190
2191 return array;
2192 }
2193 catch (Exception e) {
2194 throw processException(e);
2195 }
2196 finally {
2197 closeSession(session);
2198 }
2199 }
2200
2201 protected SocialEquityUser getByG_R_PrevAndNext(Session session,
2202 SocialEquityUser socialEquityUser, long groupId, int rank,
2203 OrderByComparator orderByComparator, boolean previous) {
2204 StringBundler query = null;
2205
2206 if (orderByComparator != null) {
2207 query = new StringBundler(6 +
2208 (orderByComparator.getOrderByFields().length * 6));
2209 }
2210 else {
2211 query = new StringBundler(3);
2212 }
2213
2214 query.append(_SQL_SELECT_SOCIALEQUITYUSER_WHERE);
2215
2216 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2217
2218 query.append(_FINDER_COLUMN_G_R_RANK_2);
2219
2220 if (orderByComparator != null) {
2221 String[] orderByFields = orderByComparator.getOrderByFields();
2222
2223 if (orderByFields.length > 0) {
2224 query.append(WHERE_AND);
2225 }
2226
2227 for (int i = 0; i < orderByFields.length; i++) {
2228 query.append(_ORDER_BY_ENTITY_ALIAS);
2229 query.append(orderByFields[i]);
2230
2231 if ((i + 1) < orderByFields.length) {
2232 if (orderByComparator.isAscending() ^ previous) {
2233 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2234 }
2235 else {
2236 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2237 }
2238 }
2239 else {
2240 if (orderByComparator.isAscending() ^ previous) {
2241 query.append(WHERE_GREATER_THAN);
2242 }
2243 else {
2244 query.append(WHERE_LESSER_THAN);
2245 }
2246 }
2247 }
2248
2249 query.append(ORDER_BY_CLAUSE);
2250
2251 for (int i = 0; i < orderByFields.length; i++) {
2252 query.append(_ORDER_BY_ENTITY_ALIAS);
2253 query.append(orderByFields[i]);
2254
2255 if ((i + 1) < orderByFields.length) {
2256 if (orderByComparator.isAscending() ^ previous) {
2257 query.append(ORDER_BY_ASC_HAS_NEXT);
2258 }
2259 else {
2260 query.append(ORDER_BY_DESC_HAS_NEXT);
2261 }
2262 }
2263 else {
2264 if (orderByComparator.isAscending() ^ previous) {
2265 query.append(ORDER_BY_ASC);
2266 }
2267 else {
2268 query.append(ORDER_BY_DESC);
2269 }
2270 }
2271 }
2272 }
2273
2274 String sql = query.toString();
2275
2276 Query q = session.createQuery(sql);
2277
2278 q.setFirstResult(0);
2279 q.setMaxResults(2);
2280
2281 QueryPos qPos = QueryPos.getInstance(q);
2282
2283 qPos.add(groupId);
2284
2285 qPos.add(rank);
2286
2287 if (orderByComparator != null) {
2288 Object[] values = orderByComparator.getOrderByValues(socialEquityUser);
2289
2290 for (Object value : values) {
2291 qPos.add(value);
2292 }
2293 }
2294
2295 List<SocialEquityUser> list = q.list();
2296
2297 if (list.size() == 2) {
2298 return list.get(1);
2299 }
2300 else {
2301 return null;
2302 }
2303 }
2304
2305
2311 public List<SocialEquityUser> findAll() throws SystemException {
2312 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2313 }
2314
2315
2327 public List<SocialEquityUser> findAll(int start, int end)
2328 throws SystemException {
2329 return findAll(start, end, null);
2330 }
2331
2332
2345 public List<SocialEquityUser> findAll(int start, int end,
2346 OrderByComparator orderByComparator) throws SystemException {
2347 Object[] finderArgs = new Object[] {
2348 String.valueOf(start), String.valueOf(end),
2349 String.valueOf(orderByComparator)
2350 };
2351
2352 List<SocialEquityUser> list = (List<SocialEquityUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2353 finderArgs, this);
2354
2355 if (list == null) {
2356 Session session = null;
2357
2358 try {
2359 session = openSession();
2360
2361 StringBundler query = null;
2362 String sql = null;
2363
2364 if (orderByComparator != null) {
2365 query = new StringBundler(2 +
2366 (orderByComparator.getOrderByFields().length * 3));
2367
2368 query.append(_SQL_SELECT_SOCIALEQUITYUSER);
2369
2370 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2371 orderByComparator);
2372
2373 sql = query.toString();
2374 }
2375 else {
2376 sql = _SQL_SELECT_SOCIALEQUITYUSER;
2377 }
2378
2379 Query q = session.createQuery(sql);
2380
2381 if (orderByComparator == null) {
2382 list = (List<SocialEquityUser>)QueryUtil.list(q,
2383 getDialect(), start, end, false);
2384
2385 Collections.sort(list);
2386 }
2387 else {
2388 list = (List<SocialEquityUser>)QueryUtil.list(q,
2389 getDialect(), start, end);
2390 }
2391 }
2392 catch (Exception e) {
2393 throw processException(e);
2394 }
2395 finally {
2396 if (list == null) {
2397 list = new ArrayList<SocialEquityUser>();
2398 }
2399
2400 cacheResult(list);
2401
2402 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2403
2404 closeSession(session);
2405 }
2406 }
2407
2408 return list;
2409 }
2410
2411
2417 public void removeByGroupId(long groupId) throws SystemException {
2418 for (SocialEquityUser socialEquityUser : findByGroupId(groupId)) {
2419 remove(socialEquityUser);
2420 }
2421 }
2422
2423
2429 public void removeByGroupRanked(long groupId) throws SystemException {
2430 for (SocialEquityUser socialEquityUser : findByGroupRanked(groupId)) {
2431 remove(socialEquityUser);
2432 }
2433 }
2434
2435
2441 public void removeByUserId(long userId) throws SystemException {
2442 for (SocialEquityUser socialEquityUser : findByUserId(userId)) {
2443 remove(socialEquityUser);
2444 }
2445 }
2446
2447
2453 public void removeByRank(int rank) throws SystemException {
2454 for (SocialEquityUser socialEquityUser : findByRank(rank)) {
2455 remove(socialEquityUser);
2456 }
2457 }
2458
2459
2466 public void removeByG_U(long groupId, long userId)
2467 throws NoSuchEquityUserException, SystemException {
2468 SocialEquityUser socialEquityUser = findByG_U(groupId, userId);
2469
2470 remove(socialEquityUser);
2471 }
2472
2473
2480 public void removeByG_R(long groupId, int rank) throws SystemException {
2481 for (SocialEquityUser socialEquityUser : findByG_R(groupId, rank)) {
2482 remove(socialEquityUser);
2483 }
2484 }
2485
2486
2491 public void removeAll() throws SystemException {
2492 for (SocialEquityUser socialEquityUser : findAll()) {
2493 remove(socialEquityUser);
2494 }
2495 }
2496
2497
2504 public int countByGroupId(long groupId) throws SystemException {
2505 Object[] finderArgs = new Object[] { groupId };
2506
2507 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2508 finderArgs, this);
2509
2510 if (count == null) {
2511 Session session = null;
2512
2513 try {
2514 session = openSession();
2515
2516 StringBundler query = new StringBundler(2);
2517
2518 query.append(_SQL_COUNT_SOCIALEQUITYUSER_WHERE);
2519
2520 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2521
2522 String sql = query.toString();
2523
2524 Query q = session.createQuery(sql);
2525
2526 QueryPos qPos = QueryPos.getInstance(q);
2527
2528 qPos.add(groupId);
2529
2530 count = (Long)q.uniqueResult();
2531 }
2532 catch (Exception e) {
2533 throw processException(e);
2534 }
2535 finally {
2536 if (count == null) {
2537 count = Long.valueOf(0);
2538 }
2539
2540 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2541 finderArgs, count);
2542
2543 closeSession(session);
2544 }
2545 }
2546
2547 return count.intValue();
2548 }
2549
2550
2557 public int countByGroupRanked(long groupId) throws SystemException {
2558 Object[] finderArgs = new Object[] { groupId };
2559
2560 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPRANKED,
2561 finderArgs, this);
2562
2563 if (count == null) {
2564 Session session = null;
2565
2566 try {
2567 session = openSession();
2568
2569 StringBundler query = new StringBundler(2);
2570
2571 query.append(_SQL_COUNT_SOCIALEQUITYUSER_WHERE);
2572
2573 query.append(_FINDER_COLUMN_GROUPRANKED_GROUPID_2);
2574
2575 String sql = query.toString();
2576
2577 Query q = session.createQuery(sql);
2578
2579 QueryPos qPos = QueryPos.getInstance(q);
2580
2581 qPos.add(groupId);
2582
2583 count = (Long)q.uniqueResult();
2584 }
2585 catch (Exception e) {
2586 throw processException(e);
2587 }
2588 finally {
2589 if (count == null) {
2590 count = Long.valueOf(0);
2591 }
2592
2593 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPRANKED,
2594 finderArgs, count);
2595
2596 closeSession(session);
2597 }
2598 }
2599
2600 return count.intValue();
2601 }
2602
2603
2610 public int countByUserId(long userId) throws SystemException {
2611 Object[] finderArgs = new Object[] { userId };
2612
2613 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2614 finderArgs, this);
2615
2616 if (count == null) {
2617 Session session = null;
2618
2619 try {
2620 session = openSession();
2621
2622 StringBundler query = new StringBundler(2);
2623
2624 query.append(_SQL_COUNT_SOCIALEQUITYUSER_WHERE);
2625
2626 query.append(_FINDER_COLUMN_USERID_USERID_2);
2627
2628 String sql = query.toString();
2629
2630 Query q = session.createQuery(sql);
2631
2632 QueryPos qPos = QueryPos.getInstance(q);
2633
2634 qPos.add(userId);
2635
2636 count = (Long)q.uniqueResult();
2637 }
2638 catch (Exception e) {
2639 throw processException(e);
2640 }
2641 finally {
2642 if (count == null) {
2643 count = Long.valueOf(0);
2644 }
2645
2646 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2647 finderArgs, count);
2648
2649 closeSession(session);
2650 }
2651 }
2652
2653 return count.intValue();
2654 }
2655
2656
2663 public int countByRank(int rank) throws SystemException {
2664 Object[] finderArgs = new Object[] { rank };
2665
2666 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RANK,
2667 finderArgs, this);
2668
2669 if (count == null) {
2670 Session session = null;
2671
2672 try {
2673 session = openSession();
2674
2675 StringBundler query = new StringBundler(2);
2676
2677 query.append(_SQL_COUNT_SOCIALEQUITYUSER_WHERE);
2678
2679 query.append(_FINDER_COLUMN_RANK_RANK_2);
2680
2681 String sql = query.toString();
2682
2683 Query q = session.createQuery(sql);
2684
2685 QueryPos qPos = QueryPos.getInstance(q);
2686
2687 qPos.add(rank);
2688
2689 count = (Long)q.uniqueResult();
2690 }
2691 catch (Exception e) {
2692 throw processException(e);
2693 }
2694 finally {
2695 if (count == null) {
2696 count = Long.valueOf(0);
2697 }
2698
2699 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RANK,
2700 finderArgs, count);
2701
2702 closeSession(session);
2703 }
2704 }
2705
2706 return count.intValue();
2707 }
2708
2709
2717 public int countByG_U(long groupId, long userId) throws SystemException {
2718 Object[] finderArgs = new Object[] { groupId, userId };
2719
2720 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
2721 finderArgs, this);
2722
2723 if (count == null) {
2724 Session session = null;
2725
2726 try {
2727 session = openSession();
2728
2729 StringBundler query = new StringBundler(3);
2730
2731 query.append(_SQL_COUNT_SOCIALEQUITYUSER_WHERE);
2732
2733 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2734
2735 query.append(_FINDER_COLUMN_G_U_USERID_2);
2736
2737 String sql = query.toString();
2738
2739 Query q = session.createQuery(sql);
2740
2741 QueryPos qPos = QueryPos.getInstance(q);
2742
2743 qPos.add(groupId);
2744
2745 qPos.add(userId);
2746
2747 count = (Long)q.uniqueResult();
2748 }
2749 catch (Exception e) {
2750 throw processException(e);
2751 }
2752 finally {
2753 if (count == null) {
2754 count = Long.valueOf(0);
2755 }
2756
2757 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
2758 count);
2759
2760 closeSession(session);
2761 }
2762 }
2763
2764 return count.intValue();
2765 }
2766
2767
2775 public int countByG_R(long groupId, int rank) throws SystemException {
2776 Object[] finderArgs = new Object[] { groupId, rank };
2777
2778 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
2779 finderArgs, this);
2780
2781 if (count == null) {
2782 Session session = null;
2783
2784 try {
2785 session = openSession();
2786
2787 StringBundler query = new StringBundler(3);
2788
2789 query.append(_SQL_COUNT_SOCIALEQUITYUSER_WHERE);
2790
2791 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2792
2793 query.append(_FINDER_COLUMN_G_R_RANK_2);
2794
2795 String sql = query.toString();
2796
2797 Query q = session.createQuery(sql);
2798
2799 QueryPos qPos = QueryPos.getInstance(q);
2800
2801 qPos.add(groupId);
2802
2803 qPos.add(rank);
2804
2805 count = (Long)q.uniqueResult();
2806 }
2807 catch (Exception e) {
2808 throw processException(e);
2809 }
2810 finally {
2811 if (count == null) {
2812 count = Long.valueOf(0);
2813 }
2814
2815 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_R, finderArgs,
2816 count);
2817
2818 closeSession(session);
2819 }
2820 }
2821
2822 return count.intValue();
2823 }
2824
2825
2831 public int countAll() throws SystemException {
2832 Object[] finderArgs = new Object[0];
2833
2834 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2835 finderArgs, this);
2836
2837 if (count == null) {
2838 Session session = null;
2839
2840 try {
2841 session = openSession();
2842
2843 Query q = session.createQuery(_SQL_COUNT_SOCIALEQUITYUSER);
2844
2845 count = (Long)q.uniqueResult();
2846 }
2847 catch (Exception e) {
2848 throw processException(e);
2849 }
2850 finally {
2851 if (count == null) {
2852 count = Long.valueOf(0);
2853 }
2854
2855 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2856 count);
2857
2858 closeSession(session);
2859 }
2860 }
2861
2862 return count.intValue();
2863 }
2864
2865
2868 public void afterPropertiesSet() {
2869 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2870 com.liferay.portal.util.PropsUtil.get(
2871 "value.object.listener.com.liferay.portlet.social.model.SocialEquityUser")));
2872
2873 if (listenerClassNames.length > 0) {
2874 try {
2875 List<ModelListener<SocialEquityUser>> listenersList = new ArrayList<ModelListener<SocialEquityUser>>();
2876
2877 for (String listenerClassName : listenerClassNames) {
2878 listenersList.add((ModelListener<SocialEquityUser>)InstanceFactory.newInstance(
2879 listenerClassName));
2880 }
2881
2882 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2883 }
2884 catch (Exception e) {
2885 _log.error(e);
2886 }
2887 }
2888 }
2889
2890 @BeanReference(type = SocialActivityPersistence.class)
2891 protected SocialActivityPersistence socialActivityPersistence;
2892 @BeanReference(type = SocialEquityAssetEntryPersistence.class)
2893 protected SocialEquityAssetEntryPersistence socialEquityAssetEntryPersistence;
2894 @BeanReference(type = SocialEquityHistoryPersistence.class)
2895 protected SocialEquityHistoryPersistence socialEquityHistoryPersistence;
2896 @BeanReference(type = SocialEquityLogPersistence.class)
2897 protected SocialEquityLogPersistence socialEquityLogPersistence;
2898 @BeanReference(type = SocialEquitySettingPersistence.class)
2899 protected SocialEquitySettingPersistence socialEquitySettingPersistence;
2900 @BeanReference(type = SocialEquityUserPersistence.class)
2901 protected SocialEquityUserPersistence socialEquityUserPersistence;
2902 @BeanReference(type = SocialRelationPersistence.class)
2903 protected SocialRelationPersistence socialRelationPersistence;
2904 @BeanReference(type = SocialRequestPersistence.class)
2905 protected SocialRequestPersistence socialRequestPersistence;
2906 @BeanReference(type = ResourcePersistence.class)
2907 protected ResourcePersistence resourcePersistence;
2908 @BeanReference(type = UserPersistence.class)
2909 protected UserPersistence userPersistence;
2910 private static final String _SQL_SELECT_SOCIALEQUITYUSER = "SELECT socialEquityUser FROM SocialEquityUser socialEquityUser";
2911 private static final String _SQL_SELECT_SOCIALEQUITYUSER_WHERE = "SELECT socialEquityUser FROM SocialEquityUser socialEquityUser WHERE ";
2912 private static final String _SQL_COUNT_SOCIALEQUITYUSER = "SELECT COUNT(socialEquityUser) FROM SocialEquityUser socialEquityUser";
2913 private static final String _SQL_COUNT_SOCIALEQUITYUSER_WHERE = "SELECT COUNT(socialEquityUser) FROM SocialEquityUser socialEquityUser WHERE ";
2914 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "socialEquityUser.groupId = ?";
2915 private static final String _FINDER_COLUMN_GROUPRANKED_GROUPID_2 = "socialEquityUser.groupId = ? AND socialEquityUser.rank > 0";
2916 private static final String _FINDER_COLUMN_USERID_USERID_2 = "socialEquityUser.userId = ?";
2917 private static final String _FINDER_COLUMN_RANK_RANK_2 = "socialEquityUser.rank = ?";
2918 private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "socialEquityUser.groupId = ? AND ";
2919 private static final String _FINDER_COLUMN_G_U_USERID_2 = "socialEquityUser.userId = ?";
2920 private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "socialEquityUser.groupId = ? AND ";
2921 private static final String _FINDER_COLUMN_G_R_RANK_2 = "socialEquityUser.rank = ?";
2922 private static final String _ORDER_BY_ENTITY_ALIAS = "socialEquityUser.";
2923 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SocialEquityUser exists with the primary key ";
2924 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SocialEquityUser exists with the key {";
2925 private static Log _log = LogFactoryUtil.getLog(SocialEquityUserPersistenceImpl.class);
2926 }