001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchUserGroupRoleException;
019 import com.liferay.portal.kernel.annotation.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.ModelListener;
038 import com.liferay.portal.model.UserGroupRole;
039 import com.liferay.portal.model.impl.UserGroupRoleImpl;
040 import com.liferay.portal.model.impl.UserGroupRoleModelImpl;
041 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042
043 import java.io.Serializable;
044
045 import java.util.ArrayList;
046 import java.util.Collections;
047 import java.util.List;
048
049
065 public class UserGroupRolePersistenceImpl extends BasePersistenceImpl<UserGroupRole>
066 implements UserGroupRolePersistence {
067 public static final String FINDER_CLASS_NAME_ENTITY = UserGroupRoleImpl.class.getName();
068 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
069 ".List";
070 public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
071 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
072 FINDER_CLASS_NAME_LIST, "findByUserId",
073 new String[] {
074 Long.class.getName(),
075
076 "java.lang.Integer", "java.lang.Integer",
077 "com.liferay.portal.kernel.util.OrderByComparator"
078 });
079 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
080 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
081 FINDER_CLASS_NAME_LIST, "countByUserId",
082 new String[] { Long.class.getName() });
083 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
084 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
085 FINDER_CLASS_NAME_LIST, "findByGroupId",
086 new String[] {
087 Long.class.getName(),
088
089 "java.lang.Integer", "java.lang.Integer",
090 "com.liferay.portal.kernel.util.OrderByComparator"
091 });
092 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
093 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
094 FINDER_CLASS_NAME_LIST, "countByGroupId",
095 new String[] { Long.class.getName() });
096 public static final FinderPath FINDER_PATH_FIND_BY_ROLEID = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
097 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
098 FINDER_CLASS_NAME_LIST, "findByRoleId",
099 new String[] {
100 Long.class.getName(),
101
102 "java.lang.Integer", "java.lang.Integer",
103 "com.liferay.portal.kernel.util.OrderByComparator"
104 });
105 public static final FinderPath FINDER_PATH_COUNT_BY_ROLEID = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
106 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
107 FINDER_CLASS_NAME_LIST, "countByRoleId",
108 new String[] { Long.class.getName() });
109 public static final FinderPath FINDER_PATH_FIND_BY_U_G = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
110 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
111 FINDER_CLASS_NAME_LIST, "findByU_G",
112 new String[] {
113 Long.class.getName(), Long.class.getName(),
114
115 "java.lang.Integer", "java.lang.Integer",
116 "com.liferay.portal.kernel.util.OrderByComparator"
117 });
118 public static final FinderPath FINDER_PATH_COUNT_BY_U_G = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
119 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
120 FINDER_CLASS_NAME_LIST, "countByU_G",
121 new String[] { Long.class.getName(), Long.class.getName() });
122 public static final FinderPath FINDER_PATH_FIND_BY_G_R = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
123 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
124 FINDER_CLASS_NAME_LIST, "findByG_R",
125 new String[] {
126 Long.class.getName(), Long.class.getName(),
127
128 "java.lang.Integer", "java.lang.Integer",
129 "com.liferay.portal.kernel.util.OrderByComparator"
130 });
131 public static final FinderPath FINDER_PATH_COUNT_BY_G_R = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
132 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
133 FINDER_CLASS_NAME_LIST, "countByG_R",
134 new String[] { Long.class.getName(), Long.class.getName() });
135 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
136 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
137 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
138 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
139 UserGroupRoleModelImpl.FINDER_CACHE_ENABLED,
140 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
141
142
147 public void cacheResult(UserGroupRole userGroupRole) {
148 EntityCacheUtil.putResult(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
149 UserGroupRoleImpl.class, userGroupRole.getPrimaryKey(),
150 userGroupRole);
151 }
152
153
158 public void cacheResult(List<UserGroupRole> userGroupRoles) {
159 for (UserGroupRole userGroupRole : userGroupRoles) {
160 if (EntityCacheUtil.getResult(
161 UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
162 UserGroupRoleImpl.class, userGroupRole.getPrimaryKey(),
163 this) == null) {
164 cacheResult(userGroupRole);
165 }
166 }
167 }
168
169
176 public void clearCache() {
177 CacheRegistryUtil.clear(UserGroupRoleImpl.class.getName());
178 EntityCacheUtil.clearCache(UserGroupRoleImpl.class.getName());
179 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
180 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
181 }
182
183
190 public void clearCache(UserGroupRole userGroupRole) {
191 EntityCacheUtil.removeResult(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
192 UserGroupRoleImpl.class, userGroupRole.getPrimaryKey());
193 }
194
195
201 public UserGroupRole create(UserGroupRolePK userGroupRolePK) {
202 UserGroupRole userGroupRole = new UserGroupRoleImpl();
203
204 userGroupRole.setNew(true);
205 userGroupRole.setPrimaryKey(userGroupRolePK);
206
207 return userGroupRole;
208 }
209
210
218 public UserGroupRole remove(Serializable primaryKey)
219 throws NoSuchModelException, SystemException {
220 return remove((UserGroupRolePK)primaryKey);
221 }
222
223
231 public UserGroupRole remove(UserGroupRolePK userGroupRolePK)
232 throws NoSuchUserGroupRoleException, SystemException {
233 Session session = null;
234
235 try {
236 session = openSession();
237
238 UserGroupRole userGroupRole = (UserGroupRole)session.get(UserGroupRoleImpl.class,
239 userGroupRolePK);
240
241 if (userGroupRole == null) {
242 if (_log.isWarnEnabled()) {
243 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
244 userGroupRolePK);
245 }
246
247 throw new NoSuchUserGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
248 userGroupRolePK);
249 }
250
251 return remove(userGroupRole);
252 }
253 catch (NoSuchUserGroupRoleException nsee) {
254 throw nsee;
255 }
256 catch (Exception e) {
257 throw processException(e);
258 }
259 finally {
260 closeSession(session);
261 }
262 }
263
264 protected UserGroupRole removeImpl(UserGroupRole userGroupRole)
265 throws SystemException {
266 userGroupRole = toUnwrappedModel(userGroupRole);
267
268 Session session = null;
269
270 try {
271 session = openSession();
272
273 BatchSessionUtil.delete(session, userGroupRole);
274 }
275 catch (Exception e) {
276 throw processException(e);
277 }
278 finally {
279 closeSession(session);
280 }
281
282 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
283
284 EntityCacheUtil.removeResult(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
285 UserGroupRoleImpl.class, userGroupRole.getPrimaryKey());
286
287 return userGroupRole;
288 }
289
290 public UserGroupRole updateImpl(
291 com.liferay.portal.model.UserGroupRole userGroupRole, boolean merge)
292 throws SystemException {
293 userGroupRole = toUnwrappedModel(userGroupRole);
294
295 Session session = null;
296
297 try {
298 session = openSession();
299
300 BatchSessionUtil.update(session, userGroupRole, merge);
301
302 userGroupRole.setNew(false);
303 }
304 catch (Exception e) {
305 throw processException(e);
306 }
307 finally {
308 closeSession(session);
309 }
310
311 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
312
313 EntityCacheUtil.putResult(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
314 UserGroupRoleImpl.class, userGroupRole.getPrimaryKey(),
315 userGroupRole);
316
317 return userGroupRole;
318 }
319
320 protected UserGroupRole toUnwrappedModel(UserGroupRole userGroupRole) {
321 if (userGroupRole instanceof UserGroupRoleImpl) {
322 return userGroupRole;
323 }
324
325 UserGroupRoleImpl userGroupRoleImpl = new UserGroupRoleImpl();
326
327 userGroupRoleImpl.setNew(userGroupRole.isNew());
328 userGroupRoleImpl.setPrimaryKey(userGroupRole.getPrimaryKey());
329
330 userGroupRoleImpl.setUserId(userGroupRole.getUserId());
331 userGroupRoleImpl.setGroupId(userGroupRole.getGroupId());
332 userGroupRoleImpl.setRoleId(userGroupRole.getRoleId());
333
334 return userGroupRoleImpl;
335 }
336
337
345 public UserGroupRole findByPrimaryKey(Serializable primaryKey)
346 throws NoSuchModelException, SystemException {
347 return findByPrimaryKey((UserGroupRolePK)primaryKey);
348 }
349
350
358 public UserGroupRole findByPrimaryKey(UserGroupRolePK userGroupRolePK)
359 throws NoSuchUserGroupRoleException, SystemException {
360 UserGroupRole userGroupRole = fetchByPrimaryKey(userGroupRolePK);
361
362 if (userGroupRole == null) {
363 if (_log.isWarnEnabled()) {
364 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userGroupRolePK);
365 }
366
367 throw new NoSuchUserGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
368 userGroupRolePK);
369 }
370
371 return userGroupRole;
372 }
373
374
381 public UserGroupRole fetchByPrimaryKey(Serializable primaryKey)
382 throws SystemException {
383 return fetchByPrimaryKey((UserGroupRolePK)primaryKey);
384 }
385
386
393 public UserGroupRole fetchByPrimaryKey(UserGroupRolePK userGroupRolePK)
394 throws SystemException {
395 UserGroupRole userGroupRole = (UserGroupRole)EntityCacheUtil.getResult(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
396 UserGroupRoleImpl.class, userGroupRolePK, this);
397
398 if (userGroupRole == null) {
399 Session session = null;
400
401 try {
402 session = openSession();
403
404 userGroupRole = (UserGroupRole)session.get(UserGroupRoleImpl.class,
405 userGroupRolePK);
406 }
407 catch (Exception e) {
408 throw processException(e);
409 }
410 finally {
411 if (userGroupRole != null) {
412 cacheResult(userGroupRole);
413 }
414
415 closeSession(session);
416 }
417 }
418
419 return userGroupRole;
420 }
421
422
429 public List<UserGroupRole> findByUserId(long userId)
430 throws SystemException {
431 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
432 }
433
434
447 public List<UserGroupRole> findByUserId(long userId, int start, int end)
448 throws SystemException {
449 return findByUserId(userId, start, end, null);
450 }
451
452
466 public List<UserGroupRole> findByUserId(long userId, int start, int end,
467 OrderByComparator orderByComparator) throws SystemException {
468 Object[] finderArgs = new Object[] {
469 userId,
470
471 String.valueOf(start), String.valueOf(end),
472 String.valueOf(orderByComparator)
473 };
474
475 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
476 finderArgs, this);
477
478 if (list == null) {
479 Session session = null;
480
481 try {
482 session = openSession();
483
484 StringBundler query = null;
485
486 if (orderByComparator != null) {
487 query = new StringBundler(3 +
488 (orderByComparator.getOrderByFields().length * 3));
489 }
490 else {
491 query = new StringBundler(2);
492 }
493
494 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
495
496 query.append(_FINDER_COLUMN_USERID_USERID_2);
497
498 if (orderByComparator != null) {
499 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
500 orderByComparator);
501 }
502
503 String sql = query.toString();
504
505 Query q = session.createQuery(sql);
506
507 QueryPos qPos = QueryPos.getInstance(q);
508
509 qPos.add(userId);
510
511 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
512 start, end);
513 }
514 catch (Exception e) {
515 throw processException(e);
516 }
517 finally {
518 if (list == null) {
519 list = new ArrayList<UserGroupRole>();
520 }
521
522 cacheResult(list);
523
524 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
525 finderArgs, list);
526
527 closeSession(session);
528 }
529 }
530
531 return list;
532 }
533
534
547 public UserGroupRole findByUserId_First(long userId,
548 OrderByComparator orderByComparator)
549 throws NoSuchUserGroupRoleException, SystemException {
550 List<UserGroupRole> list = findByUserId(userId, 0, 1, orderByComparator);
551
552 if (list.isEmpty()) {
553 StringBundler msg = new StringBundler(4);
554
555 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
556
557 msg.append("userId=");
558 msg.append(userId);
559
560 msg.append(StringPool.CLOSE_CURLY_BRACE);
561
562 throw new NoSuchUserGroupRoleException(msg.toString());
563 }
564 else {
565 return list.get(0);
566 }
567 }
568
569
582 public UserGroupRole findByUserId_Last(long userId,
583 OrderByComparator orderByComparator)
584 throws NoSuchUserGroupRoleException, SystemException {
585 int count = countByUserId(userId);
586
587 List<UserGroupRole> list = findByUserId(userId, count - 1, count,
588 orderByComparator);
589
590 if (list.isEmpty()) {
591 StringBundler msg = new StringBundler(4);
592
593 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
594
595 msg.append("userId=");
596 msg.append(userId);
597
598 msg.append(StringPool.CLOSE_CURLY_BRACE);
599
600 throw new NoSuchUserGroupRoleException(msg.toString());
601 }
602 else {
603 return list.get(0);
604 }
605 }
606
607
621 public UserGroupRole[] findByUserId_PrevAndNext(
622 UserGroupRolePK userGroupRolePK, long userId,
623 OrderByComparator orderByComparator)
624 throws NoSuchUserGroupRoleException, SystemException {
625 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
626
627 Session session = null;
628
629 try {
630 session = openSession();
631
632 UserGroupRole[] array = new UserGroupRoleImpl[3];
633
634 array[0] = getByUserId_PrevAndNext(session, userGroupRole, userId,
635 orderByComparator, true);
636
637 array[1] = userGroupRole;
638
639 array[2] = getByUserId_PrevAndNext(session, userGroupRole, userId,
640 orderByComparator, false);
641
642 return array;
643 }
644 catch (Exception e) {
645 throw processException(e);
646 }
647 finally {
648 closeSession(session);
649 }
650 }
651
652 protected UserGroupRole getByUserId_PrevAndNext(Session session,
653 UserGroupRole userGroupRole, long userId,
654 OrderByComparator orderByComparator, boolean previous) {
655 StringBundler query = null;
656
657 if (orderByComparator != null) {
658 query = new StringBundler(6 +
659 (orderByComparator.getOrderByFields().length * 6));
660 }
661 else {
662 query = new StringBundler(3);
663 }
664
665 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
666
667 query.append(_FINDER_COLUMN_USERID_USERID_2);
668
669 if (orderByComparator != null) {
670 String[] orderByFields = orderByComparator.getOrderByFields();
671
672 if (orderByFields.length > 0) {
673 query.append(WHERE_AND);
674 }
675
676 for (int i = 0; i < orderByFields.length; i++) {
677 query.append(_ORDER_BY_ENTITY_ALIAS);
678 query.append(orderByFields[i]);
679
680 if ((i + 1) < orderByFields.length) {
681 if (orderByComparator.isAscending() ^ previous) {
682 query.append(WHERE_GREATER_THAN_HAS_NEXT);
683 }
684 else {
685 query.append(WHERE_LESSER_THAN_HAS_NEXT);
686 }
687 }
688 else {
689 if (orderByComparator.isAscending() ^ previous) {
690 query.append(WHERE_GREATER_THAN);
691 }
692 else {
693 query.append(WHERE_LESSER_THAN);
694 }
695 }
696 }
697
698 query.append(ORDER_BY_CLAUSE);
699
700 for (int i = 0; i < orderByFields.length; i++) {
701 query.append(_ORDER_BY_ENTITY_ALIAS);
702 query.append(orderByFields[i]);
703
704 if ((i + 1) < orderByFields.length) {
705 if (orderByComparator.isAscending() ^ previous) {
706 query.append(ORDER_BY_ASC_HAS_NEXT);
707 }
708 else {
709 query.append(ORDER_BY_DESC_HAS_NEXT);
710 }
711 }
712 else {
713 if (orderByComparator.isAscending() ^ previous) {
714 query.append(ORDER_BY_ASC);
715 }
716 else {
717 query.append(ORDER_BY_DESC);
718 }
719 }
720 }
721 }
722
723 String sql = query.toString();
724
725 Query q = session.createQuery(sql);
726
727 q.setFirstResult(0);
728 q.setMaxResults(2);
729
730 QueryPos qPos = QueryPos.getInstance(q);
731
732 qPos.add(userId);
733
734 if (orderByComparator != null) {
735 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
736
737 for (Object value : values) {
738 qPos.add(value);
739 }
740 }
741
742 List<UserGroupRole> list = q.list();
743
744 if (list.size() == 2) {
745 return list.get(1);
746 }
747 else {
748 return null;
749 }
750 }
751
752
759 public List<UserGroupRole> findByGroupId(long groupId)
760 throws SystemException {
761 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
762 }
763
764
777 public List<UserGroupRole> findByGroupId(long groupId, int start, int end)
778 throws SystemException {
779 return findByGroupId(groupId, start, end, null);
780 }
781
782
796 public List<UserGroupRole> findByGroupId(long groupId, int start, int end,
797 OrderByComparator orderByComparator) throws SystemException {
798 Object[] finderArgs = new Object[] {
799 groupId,
800
801 String.valueOf(start), String.valueOf(end),
802 String.valueOf(orderByComparator)
803 };
804
805 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
806 finderArgs, this);
807
808 if (list == null) {
809 Session session = null;
810
811 try {
812 session = openSession();
813
814 StringBundler query = null;
815
816 if (orderByComparator != null) {
817 query = new StringBundler(3 +
818 (orderByComparator.getOrderByFields().length * 3));
819 }
820 else {
821 query = new StringBundler(2);
822 }
823
824 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
825
826 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
827
828 if (orderByComparator != null) {
829 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
830 orderByComparator);
831 }
832
833 String sql = query.toString();
834
835 Query q = session.createQuery(sql);
836
837 QueryPos qPos = QueryPos.getInstance(q);
838
839 qPos.add(groupId);
840
841 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
842 start, end);
843 }
844 catch (Exception e) {
845 throw processException(e);
846 }
847 finally {
848 if (list == null) {
849 list = new ArrayList<UserGroupRole>();
850 }
851
852 cacheResult(list);
853
854 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
855 finderArgs, list);
856
857 closeSession(session);
858 }
859 }
860
861 return list;
862 }
863
864
877 public UserGroupRole findByGroupId_First(long groupId,
878 OrderByComparator orderByComparator)
879 throws NoSuchUserGroupRoleException, SystemException {
880 List<UserGroupRole> list = findByGroupId(groupId, 0, 1,
881 orderByComparator);
882
883 if (list.isEmpty()) {
884 StringBundler msg = new StringBundler(4);
885
886 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
887
888 msg.append("groupId=");
889 msg.append(groupId);
890
891 msg.append(StringPool.CLOSE_CURLY_BRACE);
892
893 throw new NoSuchUserGroupRoleException(msg.toString());
894 }
895 else {
896 return list.get(0);
897 }
898 }
899
900
913 public UserGroupRole findByGroupId_Last(long groupId,
914 OrderByComparator orderByComparator)
915 throws NoSuchUserGroupRoleException, SystemException {
916 int count = countByGroupId(groupId);
917
918 List<UserGroupRole> list = findByGroupId(groupId, count - 1, count,
919 orderByComparator);
920
921 if (list.isEmpty()) {
922 StringBundler msg = new StringBundler(4);
923
924 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
925
926 msg.append("groupId=");
927 msg.append(groupId);
928
929 msg.append(StringPool.CLOSE_CURLY_BRACE);
930
931 throw new NoSuchUserGroupRoleException(msg.toString());
932 }
933 else {
934 return list.get(0);
935 }
936 }
937
938
952 public UserGroupRole[] findByGroupId_PrevAndNext(
953 UserGroupRolePK userGroupRolePK, long groupId,
954 OrderByComparator orderByComparator)
955 throws NoSuchUserGroupRoleException, SystemException {
956 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
957
958 Session session = null;
959
960 try {
961 session = openSession();
962
963 UserGroupRole[] array = new UserGroupRoleImpl[3];
964
965 array[0] = getByGroupId_PrevAndNext(session, userGroupRole,
966 groupId, orderByComparator, true);
967
968 array[1] = userGroupRole;
969
970 array[2] = getByGroupId_PrevAndNext(session, userGroupRole,
971 groupId, orderByComparator, false);
972
973 return array;
974 }
975 catch (Exception e) {
976 throw processException(e);
977 }
978 finally {
979 closeSession(session);
980 }
981 }
982
983 protected UserGroupRole getByGroupId_PrevAndNext(Session session,
984 UserGroupRole userGroupRole, long groupId,
985 OrderByComparator orderByComparator, boolean previous) {
986 StringBundler query = null;
987
988 if (orderByComparator != null) {
989 query = new StringBundler(6 +
990 (orderByComparator.getOrderByFields().length * 6));
991 }
992 else {
993 query = new StringBundler(3);
994 }
995
996 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
997
998 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
999
1000 if (orderByComparator != null) {
1001 String[] orderByFields = orderByComparator.getOrderByFields();
1002
1003 if (orderByFields.length > 0) {
1004 query.append(WHERE_AND);
1005 }
1006
1007 for (int i = 0; i < orderByFields.length; i++) {
1008 query.append(_ORDER_BY_ENTITY_ALIAS);
1009 query.append(orderByFields[i]);
1010
1011 if ((i + 1) < orderByFields.length) {
1012 if (orderByComparator.isAscending() ^ previous) {
1013 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1014 }
1015 else {
1016 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1017 }
1018 }
1019 else {
1020 if (orderByComparator.isAscending() ^ previous) {
1021 query.append(WHERE_GREATER_THAN);
1022 }
1023 else {
1024 query.append(WHERE_LESSER_THAN);
1025 }
1026 }
1027 }
1028
1029 query.append(ORDER_BY_CLAUSE);
1030
1031 for (int i = 0; i < orderByFields.length; i++) {
1032 query.append(_ORDER_BY_ENTITY_ALIAS);
1033 query.append(orderByFields[i]);
1034
1035 if ((i + 1) < orderByFields.length) {
1036 if (orderByComparator.isAscending() ^ previous) {
1037 query.append(ORDER_BY_ASC_HAS_NEXT);
1038 }
1039 else {
1040 query.append(ORDER_BY_DESC_HAS_NEXT);
1041 }
1042 }
1043 else {
1044 if (orderByComparator.isAscending() ^ previous) {
1045 query.append(ORDER_BY_ASC);
1046 }
1047 else {
1048 query.append(ORDER_BY_DESC);
1049 }
1050 }
1051 }
1052 }
1053
1054 String sql = query.toString();
1055
1056 Query q = session.createQuery(sql);
1057
1058 q.setFirstResult(0);
1059 q.setMaxResults(2);
1060
1061 QueryPos qPos = QueryPos.getInstance(q);
1062
1063 qPos.add(groupId);
1064
1065 if (orderByComparator != null) {
1066 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
1067
1068 for (Object value : values) {
1069 qPos.add(value);
1070 }
1071 }
1072
1073 List<UserGroupRole> list = q.list();
1074
1075 if (list.size() == 2) {
1076 return list.get(1);
1077 }
1078 else {
1079 return null;
1080 }
1081 }
1082
1083
1090 public List<UserGroupRole> findByRoleId(long roleId)
1091 throws SystemException {
1092 return findByRoleId(roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1093 }
1094
1095
1108 public List<UserGroupRole> findByRoleId(long roleId, int start, int end)
1109 throws SystemException {
1110 return findByRoleId(roleId, start, end, null);
1111 }
1112
1113
1127 public List<UserGroupRole> findByRoleId(long roleId, int start, int end,
1128 OrderByComparator orderByComparator) throws SystemException {
1129 Object[] finderArgs = new Object[] {
1130 roleId,
1131
1132 String.valueOf(start), String.valueOf(end),
1133 String.valueOf(orderByComparator)
1134 };
1135
1136 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ROLEID,
1137 finderArgs, this);
1138
1139 if (list == null) {
1140 Session session = null;
1141
1142 try {
1143 session = openSession();
1144
1145 StringBundler query = null;
1146
1147 if (orderByComparator != null) {
1148 query = new StringBundler(3 +
1149 (orderByComparator.getOrderByFields().length * 3));
1150 }
1151 else {
1152 query = new StringBundler(2);
1153 }
1154
1155 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1156
1157 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1158
1159 if (orderByComparator != null) {
1160 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1161 orderByComparator);
1162 }
1163
1164 String sql = query.toString();
1165
1166 Query q = session.createQuery(sql);
1167
1168 QueryPos qPos = QueryPos.getInstance(q);
1169
1170 qPos.add(roleId);
1171
1172 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
1173 start, end);
1174 }
1175 catch (Exception e) {
1176 throw processException(e);
1177 }
1178 finally {
1179 if (list == null) {
1180 list = new ArrayList<UserGroupRole>();
1181 }
1182
1183 cacheResult(list);
1184
1185 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ROLEID,
1186 finderArgs, list);
1187
1188 closeSession(session);
1189 }
1190 }
1191
1192 return list;
1193 }
1194
1195
1208 public UserGroupRole findByRoleId_First(long roleId,
1209 OrderByComparator orderByComparator)
1210 throws NoSuchUserGroupRoleException, SystemException {
1211 List<UserGroupRole> list = findByRoleId(roleId, 0, 1, orderByComparator);
1212
1213 if (list.isEmpty()) {
1214 StringBundler msg = new StringBundler(4);
1215
1216 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1217
1218 msg.append("roleId=");
1219 msg.append(roleId);
1220
1221 msg.append(StringPool.CLOSE_CURLY_BRACE);
1222
1223 throw new NoSuchUserGroupRoleException(msg.toString());
1224 }
1225 else {
1226 return list.get(0);
1227 }
1228 }
1229
1230
1243 public UserGroupRole findByRoleId_Last(long roleId,
1244 OrderByComparator orderByComparator)
1245 throws NoSuchUserGroupRoleException, SystemException {
1246 int count = countByRoleId(roleId);
1247
1248 List<UserGroupRole> list = findByRoleId(roleId, count - 1, count,
1249 orderByComparator);
1250
1251 if (list.isEmpty()) {
1252 StringBundler msg = new StringBundler(4);
1253
1254 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1255
1256 msg.append("roleId=");
1257 msg.append(roleId);
1258
1259 msg.append(StringPool.CLOSE_CURLY_BRACE);
1260
1261 throw new NoSuchUserGroupRoleException(msg.toString());
1262 }
1263 else {
1264 return list.get(0);
1265 }
1266 }
1267
1268
1282 public UserGroupRole[] findByRoleId_PrevAndNext(
1283 UserGroupRolePK userGroupRolePK, long roleId,
1284 OrderByComparator orderByComparator)
1285 throws NoSuchUserGroupRoleException, SystemException {
1286 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
1287
1288 Session session = null;
1289
1290 try {
1291 session = openSession();
1292
1293 UserGroupRole[] array = new UserGroupRoleImpl[3];
1294
1295 array[0] = getByRoleId_PrevAndNext(session, userGroupRole, roleId,
1296 orderByComparator, true);
1297
1298 array[1] = userGroupRole;
1299
1300 array[2] = getByRoleId_PrevAndNext(session, userGroupRole, roleId,
1301 orderByComparator, false);
1302
1303 return array;
1304 }
1305 catch (Exception e) {
1306 throw processException(e);
1307 }
1308 finally {
1309 closeSession(session);
1310 }
1311 }
1312
1313 protected UserGroupRole getByRoleId_PrevAndNext(Session session,
1314 UserGroupRole userGroupRole, long roleId,
1315 OrderByComparator orderByComparator, boolean previous) {
1316 StringBundler query = null;
1317
1318 if (orderByComparator != null) {
1319 query = new StringBundler(6 +
1320 (orderByComparator.getOrderByFields().length * 6));
1321 }
1322 else {
1323 query = new StringBundler(3);
1324 }
1325
1326 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1327
1328 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1329
1330 if (orderByComparator != null) {
1331 String[] orderByFields = orderByComparator.getOrderByFields();
1332
1333 if (orderByFields.length > 0) {
1334 query.append(WHERE_AND);
1335 }
1336
1337 for (int i = 0; i < orderByFields.length; i++) {
1338 query.append(_ORDER_BY_ENTITY_ALIAS);
1339 query.append(orderByFields[i]);
1340
1341 if ((i + 1) < orderByFields.length) {
1342 if (orderByComparator.isAscending() ^ previous) {
1343 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1344 }
1345 else {
1346 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1347 }
1348 }
1349 else {
1350 if (orderByComparator.isAscending() ^ previous) {
1351 query.append(WHERE_GREATER_THAN);
1352 }
1353 else {
1354 query.append(WHERE_LESSER_THAN);
1355 }
1356 }
1357 }
1358
1359 query.append(ORDER_BY_CLAUSE);
1360
1361 for (int i = 0; i < orderByFields.length; i++) {
1362 query.append(_ORDER_BY_ENTITY_ALIAS);
1363 query.append(orderByFields[i]);
1364
1365 if ((i + 1) < orderByFields.length) {
1366 if (orderByComparator.isAscending() ^ previous) {
1367 query.append(ORDER_BY_ASC_HAS_NEXT);
1368 }
1369 else {
1370 query.append(ORDER_BY_DESC_HAS_NEXT);
1371 }
1372 }
1373 else {
1374 if (orderByComparator.isAscending() ^ previous) {
1375 query.append(ORDER_BY_ASC);
1376 }
1377 else {
1378 query.append(ORDER_BY_DESC);
1379 }
1380 }
1381 }
1382 }
1383
1384 String sql = query.toString();
1385
1386 Query q = session.createQuery(sql);
1387
1388 q.setFirstResult(0);
1389 q.setMaxResults(2);
1390
1391 QueryPos qPos = QueryPos.getInstance(q);
1392
1393 qPos.add(roleId);
1394
1395 if (orderByComparator != null) {
1396 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
1397
1398 for (Object value : values) {
1399 qPos.add(value);
1400 }
1401 }
1402
1403 List<UserGroupRole> list = q.list();
1404
1405 if (list.size() == 2) {
1406 return list.get(1);
1407 }
1408 else {
1409 return null;
1410 }
1411 }
1412
1413
1421 public List<UserGroupRole> findByU_G(long userId, long groupId)
1422 throws SystemException {
1423 return findByU_G(userId, groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1424 null);
1425 }
1426
1427
1441 public List<UserGroupRole> findByU_G(long userId, long groupId, int start,
1442 int end) throws SystemException {
1443 return findByU_G(userId, groupId, start, end, null);
1444 }
1445
1446
1461 public List<UserGroupRole> findByU_G(long userId, long groupId, int start,
1462 int end, OrderByComparator orderByComparator) throws SystemException {
1463 Object[] finderArgs = new Object[] {
1464 userId, groupId,
1465
1466 String.valueOf(start), String.valueOf(end),
1467 String.valueOf(orderByComparator)
1468 };
1469
1470 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_G,
1471 finderArgs, this);
1472
1473 if (list == null) {
1474 Session session = null;
1475
1476 try {
1477 session = openSession();
1478
1479 StringBundler query = null;
1480
1481 if (orderByComparator != null) {
1482 query = new StringBundler(4 +
1483 (orderByComparator.getOrderByFields().length * 3));
1484 }
1485 else {
1486 query = new StringBundler(3);
1487 }
1488
1489 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1490
1491 query.append(_FINDER_COLUMN_U_G_USERID_2);
1492
1493 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1494
1495 if (orderByComparator != null) {
1496 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1497 orderByComparator);
1498 }
1499
1500 String sql = query.toString();
1501
1502 Query q = session.createQuery(sql);
1503
1504 QueryPos qPos = QueryPos.getInstance(q);
1505
1506 qPos.add(userId);
1507
1508 qPos.add(groupId);
1509
1510 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
1511 start, end);
1512 }
1513 catch (Exception e) {
1514 throw processException(e);
1515 }
1516 finally {
1517 if (list == null) {
1518 list = new ArrayList<UserGroupRole>();
1519 }
1520
1521 cacheResult(list);
1522
1523 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_G, finderArgs,
1524 list);
1525
1526 closeSession(session);
1527 }
1528 }
1529
1530 return list;
1531 }
1532
1533
1547 public UserGroupRole findByU_G_First(long userId, long groupId,
1548 OrderByComparator orderByComparator)
1549 throws NoSuchUserGroupRoleException, SystemException {
1550 List<UserGroupRole> list = findByU_G(userId, groupId, 0, 1,
1551 orderByComparator);
1552
1553 if (list.isEmpty()) {
1554 StringBundler msg = new StringBundler(6);
1555
1556 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1557
1558 msg.append("userId=");
1559 msg.append(userId);
1560
1561 msg.append(", groupId=");
1562 msg.append(groupId);
1563
1564 msg.append(StringPool.CLOSE_CURLY_BRACE);
1565
1566 throw new NoSuchUserGroupRoleException(msg.toString());
1567 }
1568 else {
1569 return list.get(0);
1570 }
1571 }
1572
1573
1587 public UserGroupRole findByU_G_Last(long userId, long groupId,
1588 OrderByComparator orderByComparator)
1589 throws NoSuchUserGroupRoleException, SystemException {
1590 int count = countByU_G(userId, groupId);
1591
1592 List<UserGroupRole> list = findByU_G(userId, groupId, count - 1, count,
1593 orderByComparator);
1594
1595 if (list.isEmpty()) {
1596 StringBundler msg = new StringBundler(6);
1597
1598 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1599
1600 msg.append("userId=");
1601 msg.append(userId);
1602
1603 msg.append(", groupId=");
1604 msg.append(groupId);
1605
1606 msg.append(StringPool.CLOSE_CURLY_BRACE);
1607
1608 throw new NoSuchUserGroupRoleException(msg.toString());
1609 }
1610 else {
1611 return list.get(0);
1612 }
1613 }
1614
1615
1630 public UserGroupRole[] findByU_G_PrevAndNext(
1631 UserGroupRolePK userGroupRolePK, long userId, long groupId,
1632 OrderByComparator orderByComparator)
1633 throws NoSuchUserGroupRoleException, SystemException {
1634 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
1635
1636 Session session = null;
1637
1638 try {
1639 session = openSession();
1640
1641 UserGroupRole[] array = new UserGroupRoleImpl[3];
1642
1643 array[0] = getByU_G_PrevAndNext(session, userGroupRole, userId,
1644 groupId, orderByComparator, true);
1645
1646 array[1] = userGroupRole;
1647
1648 array[2] = getByU_G_PrevAndNext(session, userGroupRole, userId,
1649 groupId, orderByComparator, false);
1650
1651 return array;
1652 }
1653 catch (Exception e) {
1654 throw processException(e);
1655 }
1656 finally {
1657 closeSession(session);
1658 }
1659 }
1660
1661 protected UserGroupRole getByU_G_PrevAndNext(Session session,
1662 UserGroupRole userGroupRole, long userId, long groupId,
1663 OrderByComparator orderByComparator, boolean previous) {
1664 StringBundler query = null;
1665
1666 if (orderByComparator != null) {
1667 query = new StringBundler(6 +
1668 (orderByComparator.getOrderByFields().length * 6));
1669 }
1670 else {
1671 query = new StringBundler(3);
1672 }
1673
1674 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1675
1676 query.append(_FINDER_COLUMN_U_G_USERID_2);
1677
1678 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1679
1680 if (orderByComparator != null) {
1681 String[] orderByFields = orderByComparator.getOrderByFields();
1682
1683 if (orderByFields.length > 0) {
1684 query.append(WHERE_AND);
1685 }
1686
1687 for (int i = 0; i < orderByFields.length; i++) {
1688 query.append(_ORDER_BY_ENTITY_ALIAS);
1689 query.append(orderByFields[i]);
1690
1691 if ((i + 1) < orderByFields.length) {
1692 if (orderByComparator.isAscending() ^ previous) {
1693 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1694 }
1695 else {
1696 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1697 }
1698 }
1699 else {
1700 if (orderByComparator.isAscending() ^ previous) {
1701 query.append(WHERE_GREATER_THAN);
1702 }
1703 else {
1704 query.append(WHERE_LESSER_THAN);
1705 }
1706 }
1707 }
1708
1709 query.append(ORDER_BY_CLAUSE);
1710
1711 for (int i = 0; i < orderByFields.length; i++) {
1712 query.append(_ORDER_BY_ENTITY_ALIAS);
1713 query.append(orderByFields[i]);
1714
1715 if ((i + 1) < orderByFields.length) {
1716 if (orderByComparator.isAscending() ^ previous) {
1717 query.append(ORDER_BY_ASC_HAS_NEXT);
1718 }
1719 else {
1720 query.append(ORDER_BY_DESC_HAS_NEXT);
1721 }
1722 }
1723 else {
1724 if (orderByComparator.isAscending() ^ previous) {
1725 query.append(ORDER_BY_ASC);
1726 }
1727 else {
1728 query.append(ORDER_BY_DESC);
1729 }
1730 }
1731 }
1732 }
1733
1734 String sql = query.toString();
1735
1736 Query q = session.createQuery(sql);
1737
1738 q.setFirstResult(0);
1739 q.setMaxResults(2);
1740
1741 QueryPos qPos = QueryPos.getInstance(q);
1742
1743 qPos.add(userId);
1744
1745 qPos.add(groupId);
1746
1747 if (orderByComparator != null) {
1748 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
1749
1750 for (Object value : values) {
1751 qPos.add(value);
1752 }
1753 }
1754
1755 List<UserGroupRole> list = q.list();
1756
1757 if (list.size() == 2) {
1758 return list.get(1);
1759 }
1760 else {
1761 return null;
1762 }
1763 }
1764
1765
1773 public List<UserGroupRole> findByG_R(long groupId, long roleId)
1774 throws SystemException {
1775 return findByG_R(groupId, roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1776 null);
1777 }
1778
1779
1793 public List<UserGroupRole> findByG_R(long groupId, long roleId, int start,
1794 int end) throws SystemException {
1795 return findByG_R(groupId, roleId, start, end, null);
1796 }
1797
1798
1813 public List<UserGroupRole> findByG_R(long groupId, long roleId, int start,
1814 int end, OrderByComparator orderByComparator) throws SystemException {
1815 Object[] finderArgs = new Object[] {
1816 groupId, roleId,
1817
1818 String.valueOf(start), String.valueOf(end),
1819 String.valueOf(orderByComparator)
1820 };
1821
1822 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_R,
1823 finderArgs, this);
1824
1825 if (list == null) {
1826 Session session = null;
1827
1828 try {
1829 session = openSession();
1830
1831 StringBundler query = null;
1832
1833 if (orderByComparator != null) {
1834 query = new StringBundler(4 +
1835 (orderByComparator.getOrderByFields().length * 3));
1836 }
1837 else {
1838 query = new StringBundler(3);
1839 }
1840
1841 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1842
1843 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1844
1845 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
1846
1847 if (orderByComparator != null) {
1848 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1849 orderByComparator);
1850 }
1851
1852 String sql = query.toString();
1853
1854 Query q = session.createQuery(sql);
1855
1856 QueryPos qPos = QueryPos.getInstance(q);
1857
1858 qPos.add(groupId);
1859
1860 qPos.add(roleId);
1861
1862 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
1863 start, end);
1864 }
1865 catch (Exception e) {
1866 throw processException(e);
1867 }
1868 finally {
1869 if (list == null) {
1870 list = new ArrayList<UserGroupRole>();
1871 }
1872
1873 cacheResult(list);
1874
1875 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_R, finderArgs,
1876 list);
1877
1878 closeSession(session);
1879 }
1880 }
1881
1882 return list;
1883 }
1884
1885
1899 public UserGroupRole findByG_R_First(long groupId, long roleId,
1900 OrderByComparator orderByComparator)
1901 throws NoSuchUserGroupRoleException, SystemException {
1902 List<UserGroupRole> list = findByG_R(groupId, roleId, 0, 1,
1903 orderByComparator);
1904
1905 if (list.isEmpty()) {
1906 StringBundler msg = new StringBundler(6);
1907
1908 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1909
1910 msg.append("groupId=");
1911 msg.append(groupId);
1912
1913 msg.append(", roleId=");
1914 msg.append(roleId);
1915
1916 msg.append(StringPool.CLOSE_CURLY_BRACE);
1917
1918 throw new NoSuchUserGroupRoleException(msg.toString());
1919 }
1920 else {
1921 return list.get(0);
1922 }
1923 }
1924
1925
1939 public UserGroupRole findByG_R_Last(long groupId, long roleId,
1940 OrderByComparator orderByComparator)
1941 throws NoSuchUserGroupRoleException, SystemException {
1942 int count = countByG_R(groupId, roleId);
1943
1944 List<UserGroupRole> list = findByG_R(groupId, roleId, count - 1, count,
1945 orderByComparator);
1946
1947 if (list.isEmpty()) {
1948 StringBundler msg = new StringBundler(6);
1949
1950 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1951
1952 msg.append("groupId=");
1953 msg.append(groupId);
1954
1955 msg.append(", roleId=");
1956 msg.append(roleId);
1957
1958 msg.append(StringPool.CLOSE_CURLY_BRACE);
1959
1960 throw new NoSuchUserGroupRoleException(msg.toString());
1961 }
1962 else {
1963 return list.get(0);
1964 }
1965 }
1966
1967
1982 public UserGroupRole[] findByG_R_PrevAndNext(
1983 UserGroupRolePK userGroupRolePK, long groupId, long roleId,
1984 OrderByComparator orderByComparator)
1985 throws NoSuchUserGroupRoleException, SystemException {
1986 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
1987
1988 Session session = null;
1989
1990 try {
1991 session = openSession();
1992
1993 UserGroupRole[] array = new UserGroupRoleImpl[3];
1994
1995 array[0] = getByG_R_PrevAndNext(session, userGroupRole, groupId,
1996 roleId, orderByComparator, true);
1997
1998 array[1] = userGroupRole;
1999
2000 array[2] = getByG_R_PrevAndNext(session, userGroupRole, groupId,
2001 roleId, orderByComparator, false);
2002
2003 return array;
2004 }
2005 catch (Exception e) {
2006 throw processException(e);
2007 }
2008 finally {
2009 closeSession(session);
2010 }
2011 }
2012
2013 protected UserGroupRole getByG_R_PrevAndNext(Session session,
2014 UserGroupRole userGroupRole, long groupId, long roleId,
2015 OrderByComparator orderByComparator, boolean previous) {
2016 StringBundler query = null;
2017
2018 if (orderByComparator != null) {
2019 query = new StringBundler(6 +
2020 (orderByComparator.getOrderByFields().length * 6));
2021 }
2022 else {
2023 query = new StringBundler(3);
2024 }
2025
2026 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
2027
2028 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2029
2030 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2031
2032 if (orderByComparator != null) {
2033 String[] orderByFields = orderByComparator.getOrderByFields();
2034
2035 if (orderByFields.length > 0) {
2036 query.append(WHERE_AND);
2037 }
2038
2039 for (int i = 0; i < orderByFields.length; i++) {
2040 query.append(_ORDER_BY_ENTITY_ALIAS);
2041 query.append(orderByFields[i]);
2042
2043 if ((i + 1) < orderByFields.length) {
2044 if (orderByComparator.isAscending() ^ previous) {
2045 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2046 }
2047 else {
2048 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2049 }
2050 }
2051 else {
2052 if (orderByComparator.isAscending() ^ previous) {
2053 query.append(WHERE_GREATER_THAN);
2054 }
2055 else {
2056 query.append(WHERE_LESSER_THAN);
2057 }
2058 }
2059 }
2060
2061 query.append(ORDER_BY_CLAUSE);
2062
2063 for (int i = 0; i < orderByFields.length; i++) {
2064 query.append(_ORDER_BY_ENTITY_ALIAS);
2065 query.append(orderByFields[i]);
2066
2067 if ((i + 1) < orderByFields.length) {
2068 if (orderByComparator.isAscending() ^ previous) {
2069 query.append(ORDER_BY_ASC_HAS_NEXT);
2070 }
2071 else {
2072 query.append(ORDER_BY_DESC_HAS_NEXT);
2073 }
2074 }
2075 else {
2076 if (orderByComparator.isAscending() ^ previous) {
2077 query.append(ORDER_BY_ASC);
2078 }
2079 else {
2080 query.append(ORDER_BY_DESC);
2081 }
2082 }
2083 }
2084 }
2085
2086 String sql = query.toString();
2087
2088 Query q = session.createQuery(sql);
2089
2090 q.setFirstResult(0);
2091 q.setMaxResults(2);
2092
2093 QueryPos qPos = QueryPos.getInstance(q);
2094
2095 qPos.add(groupId);
2096
2097 qPos.add(roleId);
2098
2099 if (orderByComparator != null) {
2100 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
2101
2102 for (Object value : values) {
2103 qPos.add(value);
2104 }
2105 }
2106
2107 List<UserGroupRole> list = q.list();
2108
2109 if (list.size() == 2) {
2110 return list.get(1);
2111 }
2112 else {
2113 return null;
2114 }
2115 }
2116
2117
2123 public List<UserGroupRole> findAll() throws SystemException {
2124 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2125 }
2126
2127
2139 public List<UserGroupRole> findAll(int start, int end)
2140 throws SystemException {
2141 return findAll(start, end, null);
2142 }
2143
2144
2157 public List<UserGroupRole> findAll(int start, int end,
2158 OrderByComparator orderByComparator) throws SystemException {
2159 Object[] finderArgs = new Object[] {
2160 String.valueOf(start), String.valueOf(end),
2161 String.valueOf(orderByComparator)
2162 };
2163
2164 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2165 finderArgs, this);
2166
2167 if (list == null) {
2168 Session session = null;
2169
2170 try {
2171 session = openSession();
2172
2173 StringBundler query = null;
2174 String sql = null;
2175
2176 if (orderByComparator != null) {
2177 query = new StringBundler(2 +
2178 (orderByComparator.getOrderByFields().length * 3));
2179
2180 query.append(_SQL_SELECT_USERGROUPROLE);
2181
2182 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2183 orderByComparator);
2184
2185 sql = query.toString();
2186 }
2187 else {
2188 sql = _SQL_SELECT_USERGROUPROLE;
2189 }
2190
2191 Query q = session.createQuery(sql);
2192
2193 if (orderByComparator == null) {
2194 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
2195 start, end, false);
2196
2197 Collections.sort(list);
2198 }
2199 else {
2200 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
2201 start, end);
2202 }
2203 }
2204 catch (Exception e) {
2205 throw processException(e);
2206 }
2207 finally {
2208 if (list == null) {
2209 list = new ArrayList<UserGroupRole>();
2210 }
2211
2212 cacheResult(list);
2213
2214 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2215
2216 closeSession(session);
2217 }
2218 }
2219
2220 return list;
2221 }
2222
2223
2229 public void removeByUserId(long userId) throws SystemException {
2230 for (UserGroupRole userGroupRole : findByUserId(userId)) {
2231 remove(userGroupRole);
2232 }
2233 }
2234
2235
2241 public void removeByGroupId(long groupId) throws SystemException {
2242 for (UserGroupRole userGroupRole : findByGroupId(groupId)) {
2243 remove(userGroupRole);
2244 }
2245 }
2246
2247
2253 public void removeByRoleId(long roleId) throws SystemException {
2254 for (UserGroupRole userGroupRole : findByRoleId(roleId)) {
2255 remove(userGroupRole);
2256 }
2257 }
2258
2259
2266 public void removeByU_G(long userId, long groupId)
2267 throws SystemException {
2268 for (UserGroupRole userGroupRole : findByU_G(userId, groupId)) {
2269 remove(userGroupRole);
2270 }
2271 }
2272
2273
2280 public void removeByG_R(long groupId, long roleId)
2281 throws SystemException {
2282 for (UserGroupRole userGroupRole : findByG_R(groupId, roleId)) {
2283 remove(userGroupRole);
2284 }
2285 }
2286
2287
2292 public void removeAll() throws SystemException {
2293 for (UserGroupRole userGroupRole : findAll()) {
2294 remove(userGroupRole);
2295 }
2296 }
2297
2298
2305 public int countByUserId(long userId) throws SystemException {
2306 Object[] finderArgs = new Object[] { userId };
2307
2308 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2309 finderArgs, this);
2310
2311 if (count == null) {
2312 Session session = null;
2313
2314 try {
2315 session = openSession();
2316
2317 StringBundler query = new StringBundler(2);
2318
2319 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2320
2321 query.append(_FINDER_COLUMN_USERID_USERID_2);
2322
2323 String sql = query.toString();
2324
2325 Query q = session.createQuery(sql);
2326
2327 QueryPos qPos = QueryPos.getInstance(q);
2328
2329 qPos.add(userId);
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_BY_USERID,
2342 finderArgs, count);
2343
2344 closeSession(session);
2345 }
2346 }
2347
2348 return count.intValue();
2349 }
2350
2351
2358 public int countByGroupId(long groupId) throws SystemException {
2359 Object[] finderArgs = new Object[] { groupId };
2360
2361 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2362 finderArgs, this);
2363
2364 if (count == null) {
2365 Session session = null;
2366
2367 try {
2368 session = openSession();
2369
2370 StringBundler query = new StringBundler(2);
2371
2372 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2373
2374 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2375
2376 String sql = query.toString();
2377
2378 Query q = session.createQuery(sql);
2379
2380 QueryPos qPos = QueryPos.getInstance(q);
2381
2382 qPos.add(groupId);
2383
2384 count = (Long)q.uniqueResult();
2385 }
2386 catch (Exception e) {
2387 throw processException(e);
2388 }
2389 finally {
2390 if (count == null) {
2391 count = Long.valueOf(0);
2392 }
2393
2394 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2395 finderArgs, count);
2396
2397 closeSession(session);
2398 }
2399 }
2400
2401 return count.intValue();
2402 }
2403
2404
2411 public int countByRoleId(long roleId) throws SystemException {
2412 Object[] finderArgs = new Object[] { roleId };
2413
2414 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ROLEID,
2415 finderArgs, this);
2416
2417 if (count == null) {
2418 Session session = null;
2419
2420 try {
2421 session = openSession();
2422
2423 StringBundler query = new StringBundler(2);
2424
2425 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2426
2427 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
2428
2429 String sql = query.toString();
2430
2431 Query q = session.createQuery(sql);
2432
2433 QueryPos qPos = QueryPos.getInstance(q);
2434
2435 qPos.add(roleId);
2436
2437 count = (Long)q.uniqueResult();
2438 }
2439 catch (Exception e) {
2440 throw processException(e);
2441 }
2442 finally {
2443 if (count == null) {
2444 count = Long.valueOf(0);
2445 }
2446
2447 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ROLEID,
2448 finderArgs, count);
2449
2450 closeSession(session);
2451 }
2452 }
2453
2454 return count.intValue();
2455 }
2456
2457
2465 public int countByU_G(long userId, long groupId) throws SystemException {
2466 Object[] finderArgs = new Object[] { userId, groupId };
2467
2468 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_G,
2469 finderArgs, this);
2470
2471 if (count == null) {
2472 Session session = null;
2473
2474 try {
2475 session = openSession();
2476
2477 StringBundler query = new StringBundler(3);
2478
2479 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2480
2481 query.append(_FINDER_COLUMN_U_G_USERID_2);
2482
2483 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
2484
2485 String sql = query.toString();
2486
2487 Query q = session.createQuery(sql);
2488
2489 QueryPos qPos = QueryPos.getInstance(q);
2490
2491 qPos.add(userId);
2492
2493 qPos.add(groupId);
2494
2495 count = (Long)q.uniqueResult();
2496 }
2497 catch (Exception e) {
2498 throw processException(e);
2499 }
2500 finally {
2501 if (count == null) {
2502 count = Long.valueOf(0);
2503 }
2504
2505 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_G, finderArgs,
2506 count);
2507
2508 closeSession(session);
2509 }
2510 }
2511
2512 return count.intValue();
2513 }
2514
2515
2523 public int countByG_R(long groupId, long roleId) throws SystemException {
2524 Object[] finderArgs = new Object[] { groupId, roleId };
2525
2526 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
2527 finderArgs, this);
2528
2529 if (count == null) {
2530 Session session = null;
2531
2532 try {
2533 session = openSession();
2534
2535 StringBundler query = new StringBundler(3);
2536
2537 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2538
2539 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2540
2541 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2542
2543 String sql = query.toString();
2544
2545 Query q = session.createQuery(sql);
2546
2547 QueryPos qPos = QueryPos.getInstance(q);
2548
2549 qPos.add(groupId);
2550
2551 qPos.add(roleId);
2552
2553 count = (Long)q.uniqueResult();
2554 }
2555 catch (Exception e) {
2556 throw processException(e);
2557 }
2558 finally {
2559 if (count == null) {
2560 count = Long.valueOf(0);
2561 }
2562
2563 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_R, finderArgs,
2564 count);
2565
2566 closeSession(session);
2567 }
2568 }
2569
2570 return count.intValue();
2571 }
2572
2573
2579 public int countAll() throws SystemException {
2580 Object[] finderArgs = new Object[0];
2581
2582 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2583 finderArgs, this);
2584
2585 if (count == null) {
2586 Session session = null;
2587
2588 try {
2589 session = openSession();
2590
2591 Query q = session.createQuery(_SQL_COUNT_USERGROUPROLE);
2592
2593 count = (Long)q.uniqueResult();
2594 }
2595 catch (Exception e) {
2596 throw processException(e);
2597 }
2598 finally {
2599 if (count == null) {
2600 count = Long.valueOf(0);
2601 }
2602
2603 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2604 count);
2605
2606 closeSession(session);
2607 }
2608 }
2609
2610 return count.intValue();
2611 }
2612
2613
2616 public void afterPropertiesSet() {
2617 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2618 com.liferay.portal.util.PropsUtil.get(
2619 "value.object.listener.com.liferay.portal.model.UserGroupRole")));
2620
2621 if (listenerClassNames.length > 0) {
2622 try {
2623 List<ModelListener<UserGroupRole>> listenersList = new ArrayList<ModelListener<UserGroupRole>>();
2624
2625 for (String listenerClassName : listenerClassNames) {
2626 listenersList.add((ModelListener<UserGroupRole>)InstanceFactory.newInstance(
2627 listenerClassName));
2628 }
2629
2630 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2631 }
2632 catch (Exception e) {
2633 _log.error(e);
2634 }
2635 }
2636 }
2637
2638 public void destroy() {
2639 EntityCacheUtil.removeCache(UserGroupRoleImpl.class.getName());
2640 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2641 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
2642 }
2643
2644 @BeanReference(type = AccountPersistence.class)
2645 protected AccountPersistence accountPersistence;
2646 @BeanReference(type = AddressPersistence.class)
2647 protected AddressPersistence addressPersistence;
2648 @BeanReference(type = BrowserTrackerPersistence.class)
2649 protected BrowserTrackerPersistence browserTrackerPersistence;
2650 @BeanReference(type = ClassNamePersistence.class)
2651 protected ClassNamePersistence classNamePersistence;
2652 @BeanReference(type = ClusterGroupPersistence.class)
2653 protected ClusterGroupPersistence clusterGroupPersistence;
2654 @BeanReference(type = CompanyPersistence.class)
2655 protected CompanyPersistence companyPersistence;
2656 @BeanReference(type = ContactPersistence.class)
2657 protected ContactPersistence contactPersistence;
2658 @BeanReference(type = CountryPersistence.class)
2659 protected CountryPersistence countryPersistence;
2660 @BeanReference(type = EmailAddressPersistence.class)
2661 protected EmailAddressPersistence emailAddressPersistence;
2662 @BeanReference(type = GroupPersistence.class)
2663 protected GroupPersistence groupPersistence;
2664 @BeanReference(type = ImagePersistence.class)
2665 protected ImagePersistence imagePersistence;
2666 @BeanReference(type = LayoutPersistence.class)
2667 protected LayoutPersistence layoutPersistence;
2668 @BeanReference(type = LayoutPrototypePersistence.class)
2669 protected LayoutPrototypePersistence layoutPrototypePersistence;
2670 @BeanReference(type = LayoutSetPersistence.class)
2671 protected LayoutSetPersistence layoutSetPersistence;
2672 @BeanReference(type = LayoutSetPrototypePersistence.class)
2673 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2674 @BeanReference(type = ListTypePersistence.class)
2675 protected ListTypePersistence listTypePersistence;
2676 @BeanReference(type = LockPersistence.class)
2677 protected LockPersistence lockPersistence;
2678 @BeanReference(type = MembershipRequestPersistence.class)
2679 protected MembershipRequestPersistence membershipRequestPersistence;
2680 @BeanReference(type = OrganizationPersistence.class)
2681 protected OrganizationPersistence organizationPersistence;
2682 @BeanReference(type = OrgGroupPermissionPersistence.class)
2683 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2684 @BeanReference(type = OrgGroupRolePersistence.class)
2685 protected OrgGroupRolePersistence orgGroupRolePersistence;
2686 @BeanReference(type = OrgLaborPersistence.class)
2687 protected OrgLaborPersistence orgLaborPersistence;
2688 @BeanReference(type = PasswordPolicyPersistence.class)
2689 protected PasswordPolicyPersistence passwordPolicyPersistence;
2690 @BeanReference(type = PasswordPolicyRelPersistence.class)
2691 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2692 @BeanReference(type = PasswordTrackerPersistence.class)
2693 protected PasswordTrackerPersistence passwordTrackerPersistence;
2694 @BeanReference(type = PermissionPersistence.class)
2695 protected PermissionPersistence permissionPersistence;
2696 @BeanReference(type = PhonePersistence.class)
2697 protected PhonePersistence phonePersistence;
2698 @BeanReference(type = PluginSettingPersistence.class)
2699 protected PluginSettingPersistence pluginSettingPersistence;
2700 @BeanReference(type = PortletPersistence.class)
2701 protected PortletPersistence portletPersistence;
2702 @BeanReference(type = PortletItemPersistence.class)
2703 protected PortletItemPersistence portletItemPersistence;
2704 @BeanReference(type = PortletPreferencesPersistence.class)
2705 protected PortletPreferencesPersistence portletPreferencesPersistence;
2706 @BeanReference(type = RegionPersistence.class)
2707 protected RegionPersistence regionPersistence;
2708 @BeanReference(type = ReleasePersistence.class)
2709 protected ReleasePersistence releasePersistence;
2710 @BeanReference(type = ResourcePersistence.class)
2711 protected ResourcePersistence resourcePersistence;
2712 @BeanReference(type = ResourceActionPersistence.class)
2713 protected ResourceActionPersistence resourceActionPersistence;
2714 @BeanReference(type = ResourceCodePersistence.class)
2715 protected ResourceCodePersistence resourceCodePersistence;
2716 @BeanReference(type = ResourcePermissionPersistence.class)
2717 protected ResourcePermissionPersistence resourcePermissionPersistence;
2718 @BeanReference(type = RolePersistence.class)
2719 protected RolePersistence rolePersistence;
2720 @BeanReference(type = ServiceComponentPersistence.class)
2721 protected ServiceComponentPersistence serviceComponentPersistence;
2722 @BeanReference(type = ShardPersistence.class)
2723 protected ShardPersistence shardPersistence;
2724 @BeanReference(type = SubscriptionPersistence.class)
2725 protected SubscriptionPersistence subscriptionPersistence;
2726 @BeanReference(type = TicketPersistence.class)
2727 protected TicketPersistence ticketPersistence;
2728 @BeanReference(type = TeamPersistence.class)
2729 protected TeamPersistence teamPersistence;
2730 @BeanReference(type = UserPersistence.class)
2731 protected UserPersistence userPersistence;
2732 @BeanReference(type = UserGroupPersistence.class)
2733 protected UserGroupPersistence userGroupPersistence;
2734 @BeanReference(type = UserGroupGroupRolePersistence.class)
2735 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2736 @BeanReference(type = UserGroupRolePersistence.class)
2737 protected UserGroupRolePersistence userGroupRolePersistence;
2738 @BeanReference(type = UserIdMapperPersistence.class)
2739 protected UserIdMapperPersistence userIdMapperPersistence;
2740 @BeanReference(type = UserTrackerPersistence.class)
2741 protected UserTrackerPersistence userTrackerPersistence;
2742 @BeanReference(type = UserTrackerPathPersistence.class)
2743 protected UserTrackerPathPersistence userTrackerPathPersistence;
2744 @BeanReference(type = WebDAVPropsPersistence.class)
2745 protected WebDAVPropsPersistence webDAVPropsPersistence;
2746 @BeanReference(type = WebsitePersistence.class)
2747 protected WebsitePersistence websitePersistence;
2748 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2749 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2750 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2751 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2752 private static final String _SQL_SELECT_USERGROUPROLE = "SELECT userGroupRole FROM UserGroupRole userGroupRole";
2753 private static final String _SQL_SELECT_USERGROUPROLE_WHERE = "SELECT userGroupRole FROM UserGroupRole userGroupRole WHERE ";
2754 private static final String _SQL_COUNT_USERGROUPROLE = "SELECT COUNT(userGroupRole) FROM UserGroupRole userGroupRole";
2755 private static final String _SQL_COUNT_USERGROUPROLE_WHERE = "SELECT COUNT(userGroupRole) FROM UserGroupRole userGroupRole WHERE ";
2756 private static final String _FINDER_COLUMN_USERID_USERID_2 = "userGroupRole.id.userId = ?";
2757 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "userGroupRole.id.groupId = ?";
2758 private static final String _FINDER_COLUMN_ROLEID_ROLEID_2 = "userGroupRole.id.roleId = ?";
2759 private static final String _FINDER_COLUMN_U_G_USERID_2 = "userGroupRole.id.userId = ? AND ";
2760 private static final String _FINDER_COLUMN_U_G_GROUPID_2 = "userGroupRole.id.groupId = ?";
2761 private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "userGroupRole.id.groupId = ? AND ";
2762 private static final String _FINDER_COLUMN_G_R_ROLEID_2 = "userGroupRole.id.roleId = ?";
2763 private static final String _ORDER_BY_ENTITY_ALIAS = "userGroupRole.";
2764 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserGroupRole exists with the primary key ";
2765 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserGroupRole exists with the key {";
2766 private static Log _log = LogFactoryUtil.getLog(UserGroupRolePersistenceImpl.class);
2767 }