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 if (userGroupRole.isCachedModel() || BatchSessionUtil.isEnabled()) {
274 Object staleObject = session.get(UserGroupRoleImpl.class,
275 userGroupRole.getPrimaryKeyObj());
276
277 if (staleObject != null) {
278 session.evict(staleObject);
279 }
280 }
281
282 session.delete(userGroupRole);
283
284 session.flush();
285 }
286 catch (Exception e) {
287 throw processException(e);
288 }
289 finally {
290 closeSession(session);
291 }
292
293 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
294
295 EntityCacheUtil.removeResult(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
296 UserGroupRoleImpl.class, userGroupRole.getPrimaryKey());
297
298 return userGroupRole;
299 }
300
301 public UserGroupRole updateImpl(
302 com.liferay.portal.model.UserGroupRole userGroupRole, boolean merge)
303 throws SystemException {
304 userGroupRole = toUnwrappedModel(userGroupRole);
305
306 Session session = null;
307
308 try {
309 session = openSession();
310
311 BatchSessionUtil.update(session, userGroupRole, merge);
312
313 userGroupRole.setNew(false);
314 }
315 catch (Exception e) {
316 throw processException(e);
317 }
318 finally {
319 closeSession(session);
320 }
321
322 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
323
324 EntityCacheUtil.putResult(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
325 UserGroupRoleImpl.class, userGroupRole.getPrimaryKey(),
326 userGroupRole);
327
328 return userGroupRole;
329 }
330
331 protected UserGroupRole toUnwrappedModel(UserGroupRole userGroupRole) {
332 if (userGroupRole instanceof UserGroupRoleImpl) {
333 return userGroupRole;
334 }
335
336 UserGroupRoleImpl userGroupRoleImpl = new UserGroupRoleImpl();
337
338 userGroupRoleImpl.setNew(userGroupRole.isNew());
339 userGroupRoleImpl.setPrimaryKey(userGroupRole.getPrimaryKey());
340
341 userGroupRoleImpl.setUserId(userGroupRole.getUserId());
342 userGroupRoleImpl.setGroupId(userGroupRole.getGroupId());
343 userGroupRoleImpl.setRoleId(userGroupRole.getRoleId());
344
345 return userGroupRoleImpl;
346 }
347
348
356 public UserGroupRole findByPrimaryKey(Serializable primaryKey)
357 throws NoSuchModelException, SystemException {
358 return findByPrimaryKey((UserGroupRolePK)primaryKey);
359 }
360
361
369 public UserGroupRole findByPrimaryKey(UserGroupRolePK userGroupRolePK)
370 throws NoSuchUserGroupRoleException, SystemException {
371 UserGroupRole userGroupRole = fetchByPrimaryKey(userGroupRolePK);
372
373 if (userGroupRole == null) {
374 if (_log.isWarnEnabled()) {
375 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userGroupRolePK);
376 }
377
378 throw new NoSuchUserGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
379 userGroupRolePK);
380 }
381
382 return userGroupRole;
383 }
384
385
392 public UserGroupRole fetchByPrimaryKey(Serializable primaryKey)
393 throws SystemException {
394 return fetchByPrimaryKey((UserGroupRolePK)primaryKey);
395 }
396
397
404 public UserGroupRole fetchByPrimaryKey(UserGroupRolePK userGroupRolePK)
405 throws SystemException {
406 UserGroupRole userGroupRole = (UserGroupRole)EntityCacheUtil.getResult(UserGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
407 UserGroupRoleImpl.class, userGroupRolePK, this);
408
409 if (userGroupRole == null) {
410 Session session = null;
411
412 try {
413 session = openSession();
414
415 userGroupRole = (UserGroupRole)session.get(UserGroupRoleImpl.class,
416 userGroupRolePK);
417 }
418 catch (Exception e) {
419 throw processException(e);
420 }
421 finally {
422 if (userGroupRole != null) {
423 cacheResult(userGroupRole);
424 }
425
426 closeSession(session);
427 }
428 }
429
430 return userGroupRole;
431 }
432
433
440 public List<UserGroupRole> findByUserId(long userId)
441 throws SystemException {
442 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
443 }
444
445
458 public List<UserGroupRole> findByUserId(long userId, int start, int end)
459 throws SystemException {
460 return findByUserId(userId, start, end, null);
461 }
462
463
477 public List<UserGroupRole> findByUserId(long userId, int start, int end,
478 OrderByComparator orderByComparator) throws SystemException {
479 Object[] finderArgs = new Object[] {
480 userId,
481
482 String.valueOf(start), String.valueOf(end),
483 String.valueOf(orderByComparator)
484 };
485
486 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
487 finderArgs, this);
488
489 if (list == null) {
490 Session session = null;
491
492 try {
493 session = openSession();
494
495 StringBundler query = null;
496
497 if (orderByComparator != null) {
498 query = new StringBundler(3 +
499 (orderByComparator.getOrderByFields().length * 3));
500 }
501 else {
502 query = new StringBundler(2);
503 }
504
505 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
506
507 query.append(_FINDER_COLUMN_USERID_USERID_2);
508
509 if (orderByComparator != null) {
510 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
511 orderByComparator);
512 }
513
514 String sql = query.toString();
515
516 Query q = session.createQuery(sql);
517
518 QueryPos qPos = QueryPos.getInstance(q);
519
520 qPos.add(userId);
521
522 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
523 start, end);
524 }
525 catch (Exception e) {
526 throw processException(e);
527 }
528 finally {
529 if (list == null) {
530 list = new ArrayList<UserGroupRole>();
531 }
532
533 cacheResult(list);
534
535 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
536 finderArgs, list);
537
538 closeSession(session);
539 }
540 }
541
542 return list;
543 }
544
545
558 public UserGroupRole findByUserId_First(long userId,
559 OrderByComparator orderByComparator)
560 throws NoSuchUserGroupRoleException, SystemException {
561 List<UserGroupRole> list = findByUserId(userId, 0, 1, orderByComparator);
562
563 if (list.isEmpty()) {
564 StringBundler msg = new StringBundler(4);
565
566 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
567
568 msg.append("userId=");
569 msg.append(userId);
570
571 msg.append(StringPool.CLOSE_CURLY_BRACE);
572
573 throw new NoSuchUserGroupRoleException(msg.toString());
574 }
575 else {
576 return list.get(0);
577 }
578 }
579
580
593 public UserGroupRole findByUserId_Last(long userId,
594 OrderByComparator orderByComparator)
595 throws NoSuchUserGroupRoleException, SystemException {
596 int count = countByUserId(userId);
597
598 List<UserGroupRole> list = findByUserId(userId, count - 1, count,
599 orderByComparator);
600
601 if (list.isEmpty()) {
602 StringBundler msg = new StringBundler(4);
603
604 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
605
606 msg.append("userId=");
607 msg.append(userId);
608
609 msg.append(StringPool.CLOSE_CURLY_BRACE);
610
611 throw new NoSuchUserGroupRoleException(msg.toString());
612 }
613 else {
614 return list.get(0);
615 }
616 }
617
618
632 public UserGroupRole[] findByUserId_PrevAndNext(
633 UserGroupRolePK userGroupRolePK, long userId,
634 OrderByComparator orderByComparator)
635 throws NoSuchUserGroupRoleException, SystemException {
636 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
637
638 Session session = null;
639
640 try {
641 session = openSession();
642
643 UserGroupRole[] array = new UserGroupRoleImpl[3];
644
645 array[0] = getByUserId_PrevAndNext(session, userGroupRole, userId,
646 orderByComparator, true);
647
648 array[1] = userGroupRole;
649
650 array[2] = getByUserId_PrevAndNext(session, userGroupRole, userId,
651 orderByComparator, false);
652
653 return array;
654 }
655 catch (Exception e) {
656 throw processException(e);
657 }
658 finally {
659 closeSession(session);
660 }
661 }
662
663 protected UserGroupRole getByUserId_PrevAndNext(Session session,
664 UserGroupRole userGroupRole, long userId,
665 OrderByComparator orderByComparator, boolean previous) {
666 StringBundler query = null;
667
668 if (orderByComparator != null) {
669 query = new StringBundler(6 +
670 (orderByComparator.getOrderByFields().length * 6));
671 }
672 else {
673 query = new StringBundler(3);
674 }
675
676 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
677
678 query.append(_FINDER_COLUMN_USERID_USERID_2);
679
680 if (orderByComparator != null) {
681 String[] orderByFields = orderByComparator.getOrderByFields();
682
683 if (orderByFields.length > 0) {
684 query.append(WHERE_AND);
685 }
686
687 for (int i = 0; i < orderByFields.length; i++) {
688 query.append(_ORDER_BY_ENTITY_ALIAS);
689 query.append(orderByFields[i]);
690
691 if ((i + 1) < orderByFields.length) {
692 if (orderByComparator.isAscending() ^ previous) {
693 query.append(WHERE_GREATER_THAN_HAS_NEXT);
694 }
695 else {
696 query.append(WHERE_LESSER_THAN_HAS_NEXT);
697 }
698 }
699 else {
700 if (orderByComparator.isAscending() ^ previous) {
701 query.append(WHERE_GREATER_THAN);
702 }
703 else {
704 query.append(WHERE_LESSER_THAN);
705 }
706 }
707 }
708
709 query.append(ORDER_BY_CLAUSE);
710
711 for (int i = 0; i < orderByFields.length; i++) {
712 query.append(_ORDER_BY_ENTITY_ALIAS);
713 query.append(orderByFields[i]);
714
715 if ((i + 1) < orderByFields.length) {
716 if (orderByComparator.isAscending() ^ previous) {
717 query.append(ORDER_BY_ASC_HAS_NEXT);
718 }
719 else {
720 query.append(ORDER_BY_DESC_HAS_NEXT);
721 }
722 }
723 else {
724 if (orderByComparator.isAscending() ^ previous) {
725 query.append(ORDER_BY_ASC);
726 }
727 else {
728 query.append(ORDER_BY_DESC);
729 }
730 }
731 }
732 }
733
734 String sql = query.toString();
735
736 Query q = session.createQuery(sql);
737
738 q.setFirstResult(0);
739 q.setMaxResults(2);
740
741 QueryPos qPos = QueryPos.getInstance(q);
742
743 qPos.add(userId);
744
745 if (orderByComparator != null) {
746 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
747
748 for (Object value : values) {
749 qPos.add(value);
750 }
751 }
752
753 List<UserGroupRole> list = q.list();
754
755 if (list.size() == 2) {
756 return list.get(1);
757 }
758 else {
759 return null;
760 }
761 }
762
763
770 public List<UserGroupRole> findByGroupId(long groupId)
771 throws SystemException {
772 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
773 }
774
775
788 public List<UserGroupRole> findByGroupId(long groupId, int start, int end)
789 throws SystemException {
790 return findByGroupId(groupId, start, end, null);
791 }
792
793
807 public List<UserGroupRole> findByGroupId(long groupId, int start, int end,
808 OrderByComparator orderByComparator) throws SystemException {
809 Object[] finderArgs = new Object[] {
810 groupId,
811
812 String.valueOf(start), String.valueOf(end),
813 String.valueOf(orderByComparator)
814 };
815
816 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
817 finderArgs, this);
818
819 if (list == null) {
820 Session session = null;
821
822 try {
823 session = openSession();
824
825 StringBundler query = null;
826
827 if (orderByComparator != null) {
828 query = new StringBundler(3 +
829 (orderByComparator.getOrderByFields().length * 3));
830 }
831 else {
832 query = new StringBundler(2);
833 }
834
835 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
836
837 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
838
839 if (orderByComparator != null) {
840 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
841 orderByComparator);
842 }
843
844 String sql = query.toString();
845
846 Query q = session.createQuery(sql);
847
848 QueryPos qPos = QueryPos.getInstance(q);
849
850 qPos.add(groupId);
851
852 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
853 start, end);
854 }
855 catch (Exception e) {
856 throw processException(e);
857 }
858 finally {
859 if (list == null) {
860 list = new ArrayList<UserGroupRole>();
861 }
862
863 cacheResult(list);
864
865 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
866 finderArgs, list);
867
868 closeSession(session);
869 }
870 }
871
872 return list;
873 }
874
875
888 public UserGroupRole findByGroupId_First(long groupId,
889 OrderByComparator orderByComparator)
890 throws NoSuchUserGroupRoleException, SystemException {
891 List<UserGroupRole> list = findByGroupId(groupId, 0, 1,
892 orderByComparator);
893
894 if (list.isEmpty()) {
895 StringBundler msg = new StringBundler(4);
896
897 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
898
899 msg.append("groupId=");
900 msg.append(groupId);
901
902 msg.append(StringPool.CLOSE_CURLY_BRACE);
903
904 throw new NoSuchUserGroupRoleException(msg.toString());
905 }
906 else {
907 return list.get(0);
908 }
909 }
910
911
924 public UserGroupRole findByGroupId_Last(long groupId,
925 OrderByComparator orderByComparator)
926 throws NoSuchUserGroupRoleException, SystemException {
927 int count = countByGroupId(groupId);
928
929 List<UserGroupRole> list = findByGroupId(groupId, count - 1, count,
930 orderByComparator);
931
932 if (list.isEmpty()) {
933 StringBundler msg = new StringBundler(4);
934
935 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
936
937 msg.append("groupId=");
938 msg.append(groupId);
939
940 msg.append(StringPool.CLOSE_CURLY_BRACE);
941
942 throw new NoSuchUserGroupRoleException(msg.toString());
943 }
944 else {
945 return list.get(0);
946 }
947 }
948
949
963 public UserGroupRole[] findByGroupId_PrevAndNext(
964 UserGroupRolePK userGroupRolePK, long groupId,
965 OrderByComparator orderByComparator)
966 throws NoSuchUserGroupRoleException, SystemException {
967 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
968
969 Session session = null;
970
971 try {
972 session = openSession();
973
974 UserGroupRole[] array = new UserGroupRoleImpl[3];
975
976 array[0] = getByGroupId_PrevAndNext(session, userGroupRole,
977 groupId, orderByComparator, true);
978
979 array[1] = userGroupRole;
980
981 array[2] = getByGroupId_PrevAndNext(session, userGroupRole,
982 groupId, orderByComparator, false);
983
984 return array;
985 }
986 catch (Exception e) {
987 throw processException(e);
988 }
989 finally {
990 closeSession(session);
991 }
992 }
993
994 protected UserGroupRole getByGroupId_PrevAndNext(Session session,
995 UserGroupRole userGroupRole, long groupId,
996 OrderByComparator orderByComparator, boolean previous) {
997 StringBundler query = null;
998
999 if (orderByComparator != null) {
1000 query = new StringBundler(6 +
1001 (orderByComparator.getOrderByFields().length * 6));
1002 }
1003 else {
1004 query = new StringBundler(3);
1005 }
1006
1007 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1008
1009 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1010
1011 if (orderByComparator != null) {
1012 String[] orderByFields = orderByComparator.getOrderByFields();
1013
1014 if (orderByFields.length > 0) {
1015 query.append(WHERE_AND);
1016 }
1017
1018 for (int i = 0; i < orderByFields.length; i++) {
1019 query.append(_ORDER_BY_ENTITY_ALIAS);
1020 query.append(orderByFields[i]);
1021
1022 if ((i + 1) < orderByFields.length) {
1023 if (orderByComparator.isAscending() ^ previous) {
1024 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1025 }
1026 else {
1027 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1028 }
1029 }
1030 else {
1031 if (orderByComparator.isAscending() ^ previous) {
1032 query.append(WHERE_GREATER_THAN);
1033 }
1034 else {
1035 query.append(WHERE_LESSER_THAN);
1036 }
1037 }
1038 }
1039
1040 query.append(ORDER_BY_CLAUSE);
1041
1042 for (int i = 0; i < orderByFields.length; i++) {
1043 query.append(_ORDER_BY_ENTITY_ALIAS);
1044 query.append(orderByFields[i]);
1045
1046 if ((i + 1) < orderByFields.length) {
1047 if (orderByComparator.isAscending() ^ previous) {
1048 query.append(ORDER_BY_ASC_HAS_NEXT);
1049 }
1050 else {
1051 query.append(ORDER_BY_DESC_HAS_NEXT);
1052 }
1053 }
1054 else {
1055 if (orderByComparator.isAscending() ^ previous) {
1056 query.append(ORDER_BY_ASC);
1057 }
1058 else {
1059 query.append(ORDER_BY_DESC);
1060 }
1061 }
1062 }
1063 }
1064
1065 String sql = query.toString();
1066
1067 Query q = session.createQuery(sql);
1068
1069 q.setFirstResult(0);
1070 q.setMaxResults(2);
1071
1072 QueryPos qPos = QueryPos.getInstance(q);
1073
1074 qPos.add(groupId);
1075
1076 if (orderByComparator != null) {
1077 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
1078
1079 for (Object value : values) {
1080 qPos.add(value);
1081 }
1082 }
1083
1084 List<UserGroupRole> list = q.list();
1085
1086 if (list.size() == 2) {
1087 return list.get(1);
1088 }
1089 else {
1090 return null;
1091 }
1092 }
1093
1094
1101 public List<UserGroupRole> findByRoleId(long roleId)
1102 throws SystemException {
1103 return findByRoleId(roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1104 }
1105
1106
1119 public List<UserGroupRole> findByRoleId(long roleId, int start, int end)
1120 throws SystemException {
1121 return findByRoleId(roleId, start, end, null);
1122 }
1123
1124
1138 public List<UserGroupRole> findByRoleId(long roleId, int start, int end,
1139 OrderByComparator orderByComparator) throws SystemException {
1140 Object[] finderArgs = new Object[] {
1141 roleId,
1142
1143 String.valueOf(start), String.valueOf(end),
1144 String.valueOf(orderByComparator)
1145 };
1146
1147 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ROLEID,
1148 finderArgs, this);
1149
1150 if (list == null) {
1151 Session session = null;
1152
1153 try {
1154 session = openSession();
1155
1156 StringBundler query = null;
1157
1158 if (orderByComparator != null) {
1159 query = new StringBundler(3 +
1160 (orderByComparator.getOrderByFields().length * 3));
1161 }
1162 else {
1163 query = new StringBundler(2);
1164 }
1165
1166 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1167
1168 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1169
1170 if (orderByComparator != null) {
1171 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1172 orderByComparator);
1173 }
1174
1175 String sql = query.toString();
1176
1177 Query q = session.createQuery(sql);
1178
1179 QueryPos qPos = QueryPos.getInstance(q);
1180
1181 qPos.add(roleId);
1182
1183 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
1184 start, end);
1185 }
1186 catch (Exception e) {
1187 throw processException(e);
1188 }
1189 finally {
1190 if (list == null) {
1191 list = new ArrayList<UserGroupRole>();
1192 }
1193
1194 cacheResult(list);
1195
1196 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ROLEID,
1197 finderArgs, list);
1198
1199 closeSession(session);
1200 }
1201 }
1202
1203 return list;
1204 }
1205
1206
1219 public UserGroupRole findByRoleId_First(long roleId,
1220 OrderByComparator orderByComparator)
1221 throws NoSuchUserGroupRoleException, SystemException {
1222 List<UserGroupRole> list = findByRoleId(roleId, 0, 1, orderByComparator);
1223
1224 if (list.isEmpty()) {
1225 StringBundler msg = new StringBundler(4);
1226
1227 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1228
1229 msg.append("roleId=");
1230 msg.append(roleId);
1231
1232 msg.append(StringPool.CLOSE_CURLY_BRACE);
1233
1234 throw new NoSuchUserGroupRoleException(msg.toString());
1235 }
1236 else {
1237 return list.get(0);
1238 }
1239 }
1240
1241
1254 public UserGroupRole findByRoleId_Last(long roleId,
1255 OrderByComparator orderByComparator)
1256 throws NoSuchUserGroupRoleException, SystemException {
1257 int count = countByRoleId(roleId);
1258
1259 List<UserGroupRole> list = findByRoleId(roleId, count - 1, count,
1260 orderByComparator);
1261
1262 if (list.isEmpty()) {
1263 StringBundler msg = new StringBundler(4);
1264
1265 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1266
1267 msg.append("roleId=");
1268 msg.append(roleId);
1269
1270 msg.append(StringPool.CLOSE_CURLY_BRACE);
1271
1272 throw new NoSuchUserGroupRoleException(msg.toString());
1273 }
1274 else {
1275 return list.get(0);
1276 }
1277 }
1278
1279
1293 public UserGroupRole[] findByRoleId_PrevAndNext(
1294 UserGroupRolePK userGroupRolePK, long roleId,
1295 OrderByComparator orderByComparator)
1296 throws NoSuchUserGroupRoleException, SystemException {
1297 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
1298
1299 Session session = null;
1300
1301 try {
1302 session = openSession();
1303
1304 UserGroupRole[] array = new UserGroupRoleImpl[3];
1305
1306 array[0] = getByRoleId_PrevAndNext(session, userGroupRole, roleId,
1307 orderByComparator, true);
1308
1309 array[1] = userGroupRole;
1310
1311 array[2] = getByRoleId_PrevAndNext(session, userGroupRole, roleId,
1312 orderByComparator, false);
1313
1314 return array;
1315 }
1316 catch (Exception e) {
1317 throw processException(e);
1318 }
1319 finally {
1320 closeSession(session);
1321 }
1322 }
1323
1324 protected UserGroupRole getByRoleId_PrevAndNext(Session session,
1325 UserGroupRole userGroupRole, long roleId,
1326 OrderByComparator orderByComparator, boolean previous) {
1327 StringBundler query = null;
1328
1329 if (orderByComparator != null) {
1330 query = new StringBundler(6 +
1331 (orderByComparator.getOrderByFields().length * 6));
1332 }
1333 else {
1334 query = new StringBundler(3);
1335 }
1336
1337 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1338
1339 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1340
1341 if (orderByComparator != null) {
1342 String[] orderByFields = orderByComparator.getOrderByFields();
1343
1344 if (orderByFields.length > 0) {
1345 query.append(WHERE_AND);
1346 }
1347
1348 for (int i = 0; i < orderByFields.length; i++) {
1349 query.append(_ORDER_BY_ENTITY_ALIAS);
1350 query.append(orderByFields[i]);
1351
1352 if ((i + 1) < orderByFields.length) {
1353 if (orderByComparator.isAscending() ^ previous) {
1354 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1355 }
1356 else {
1357 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1358 }
1359 }
1360 else {
1361 if (orderByComparator.isAscending() ^ previous) {
1362 query.append(WHERE_GREATER_THAN);
1363 }
1364 else {
1365 query.append(WHERE_LESSER_THAN);
1366 }
1367 }
1368 }
1369
1370 query.append(ORDER_BY_CLAUSE);
1371
1372 for (int i = 0; i < orderByFields.length; i++) {
1373 query.append(_ORDER_BY_ENTITY_ALIAS);
1374 query.append(orderByFields[i]);
1375
1376 if ((i + 1) < orderByFields.length) {
1377 if (orderByComparator.isAscending() ^ previous) {
1378 query.append(ORDER_BY_ASC_HAS_NEXT);
1379 }
1380 else {
1381 query.append(ORDER_BY_DESC_HAS_NEXT);
1382 }
1383 }
1384 else {
1385 if (orderByComparator.isAscending() ^ previous) {
1386 query.append(ORDER_BY_ASC);
1387 }
1388 else {
1389 query.append(ORDER_BY_DESC);
1390 }
1391 }
1392 }
1393 }
1394
1395 String sql = query.toString();
1396
1397 Query q = session.createQuery(sql);
1398
1399 q.setFirstResult(0);
1400 q.setMaxResults(2);
1401
1402 QueryPos qPos = QueryPos.getInstance(q);
1403
1404 qPos.add(roleId);
1405
1406 if (orderByComparator != null) {
1407 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
1408
1409 for (Object value : values) {
1410 qPos.add(value);
1411 }
1412 }
1413
1414 List<UserGroupRole> list = q.list();
1415
1416 if (list.size() == 2) {
1417 return list.get(1);
1418 }
1419 else {
1420 return null;
1421 }
1422 }
1423
1424
1432 public List<UserGroupRole> findByU_G(long userId, long groupId)
1433 throws SystemException {
1434 return findByU_G(userId, groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1435 null);
1436 }
1437
1438
1452 public List<UserGroupRole> findByU_G(long userId, long groupId, int start,
1453 int end) throws SystemException {
1454 return findByU_G(userId, groupId, start, end, null);
1455 }
1456
1457
1472 public List<UserGroupRole> findByU_G(long userId, long groupId, int start,
1473 int end, OrderByComparator orderByComparator) throws SystemException {
1474 Object[] finderArgs = new Object[] {
1475 userId, groupId,
1476
1477 String.valueOf(start), String.valueOf(end),
1478 String.valueOf(orderByComparator)
1479 };
1480
1481 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_G,
1482 finderArgs, this);
1483
1484 if (list == null) {
1485 Session session = null;
1486
1487 try {
1488 session = openSession();
1489
1490 StringBundler query = null;
1491
1492 if (orderByComparator != null) {
1493 query = new StringBundler(4 +
1494 (orderByComparator.getOrderByFields().length * 3));
1495 }
1496 else {
1497 query = new StringBundler(3);
1498 }
1499
1500 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1501
1502 query.append(_FINDER_COLUMN_U_G_USERID_2);
1503
1504 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1505
1506 if (orderByComparator != null) {
1507 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1508 orderByComparator);
1509 }
1510
1511 String sql = query.toString();
1512
1513 Query q = session.createQuery(sql);
1514
1515 QueryPos qPos = QueryPos.getInstance(q);
1516
1517 qPos.add(userId);
1518
1519 qPos.add(groupId);
1520
1521 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
1522 start, end);
1523 }
1524 catch (Exception e) {
1525 throw processException(e);
1526 }
1527 finally {
1528 if (list == null) {
1529 list = new ArrayList<UserGroupRole>();
1530 }
1531
1532 cacheResult(list);
1533
1534 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_G, finderArgs,
1535 list);
1536
1537 closeSession(session);
1538 }
1539 }
1540
1541 return list;
1542 }
1543
1544
1558 public UserGroupRole findByU_G_First(long userId, long groupId,
1559 OrderByComparator orderByComparator)
1560 throws NoSuchUserGroupRoleException, SystemException {
1561 List<UserGroupRole> list = findByU_G(userId, groupId, 0, 1,
1562 orderByComparator);
1563
1564 if (list.isEmpty()) {
1565 StringBundler msg = new StringBundler(6);
1566
1567 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1568
1569 msg.append("userId=");
1570 msg.append(userId);
1571
1572 msg.append(", groupId=");
1573 msg.append(groupId);
1574
1575 msg.append(StringPool.CLOSE_CURLY_BRACE);
1576
1577 throw new NoSuchUserGroupRoleException(msg.toString());
1578 }
1579 else {
1580 return list.get(0);
1581 }
1582 }
1583
1584
1598 public UserGroupRole findByU_G_Last(long userId, long groupId,
1599 OrderByComparator orderByComparator)
1600 throws NoSuchUserGroupRoleException, SystemException {
1601 int count = countByU_G(userId, groupId);
1602
1603 List<UserGroupRole> list = findByU_G(userId, groupId, count - 1, count,
1604 orderByComparator);
1605
1606 if (list.isEmpty()) {
1607 StringBundler msg = new StringBundler(6);
1608
1609 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1610
1611 msg.append("userId=");
1612 msg.append(userId);
1613
1614 msg.append(", groupId=");
1615 msg.append(groupId);
1616
1617 msg.append(StringPool.CLOSE_CURLY_BRACE);
1618
1619 throw new NoSuchUserGroupRoleException(msg.toString());
1620 }
1621 else {
1622 return list.get(0);
1623 }
1624 }
1625
1626
1641 public UserGroupRole[] findByU_G_PrevAndNext(
1642 UserGroupRolePK userGroupRolePK, long userId, long groupId,
1643 OrderByComparator orderByComparator)
1644 throws NoSuchUserGroupRoleException, SystemException {
1645 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
1646
1647 Session session = null;
1648
1649 try {
1650 session = openSession();
1651
1652 UserGroupRole[] array = new UserGroupRoleImpl[3];
1653
1654 array[0] = getByU_G_PrevAndNext(session, userGroupRole, userId,
1655 groupId, orderByComparator, true);
1656
1657 array[1] = userGroupRole;
1658
1659 array[2] = getByU_G_PrevAndNext(session, userGroupRole, userId,
1660 groupId, orderByComparator, false);
1661
1662 return array;
1663 }
1664 catch (Exception e) {
1665 throw processException(e);
1666 }
1667 finally {
1668 closeSession(session);
1669 }
1670 }
1671
1672 protected UserGroupRole getByU_G_PrevAndNext(Session session,
1673 UserGroupRole userGroupRole, long userId, long groupId,
1674 OrderByComparator orderByComparator, boolean previous) {
1675 StringBundler query = null;
1676
1677 if (orderByComparator != null) {
1678 query = new StringBundler(6 +
1679 (orderByComparator.getOrderByFields().length * 6));
1680 }
1681 else {
1682 query = new StringBundler(3);
1683 }
1684
1685 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1686
1687 query.append(_FINDER_COLUMN_U_G_USERID_2);
1688
1689 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1690
1691 if (orderByComparator != null) {
1692 String[] orderByFields = orderByComparator.getOrderByFields();
1693
1694 if (orderByFields.length > 0) {
1695 query.append(WHERE_AND);
1696 }
1697
1698 for (int i = 0; i < orderByFields.length; i++) {
1699 query.append(_ORDER_BY_ENTITY_ALIAS);
1700 query.append(orderByFields[i]);
1701
1702 if ((i + 1) < orderByFields.length) {
1703 if (orderByComparator.isAscending() ^ previous) {
1704 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1705 }
1706 else {
1707 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1708 }
1709 }
1710 else {
1711 if (orderByComparator.isAscending() ^ previous) {
1712 query.append(WHERE_GREATER_THAN);
1713 }
1714 else {
1715 query.append(WHERE_LESSER_THAN);
1716 }
1717 }
1718 }
1719
1720 query.append(ORDER_BY_CLAUSE);
1721
1722 for (int i = 0; i < orderByFields.length; i++) {
1723 query.append(_ORDER_BY_ENTITY_ALIAS);
1724 query.append(orderByFields[i]);
1725
1726 if ((i + 1) < orderByFields.length) {
1727 if (orderByComparator.isAscending() ^ previous) {
1728 query.append(ORDER_BY_ASC_HAS_NEXT);
1729 }
1730 else {
1731 query.append(ORDER_BY_DESC_HAS_NEXT);
1732 }
1733 }
1734 else {
1735 if (orderByComparator.isAscending() ^ previous) {
1736 query.append(ORDER_BY_ASC);
1737 }
1738 else {
1739 query.append(ORDER_BY_DESC);
1740 }
1741 }
1742 }
1743 }
1744
1745 String sql = query.toString();
1746
1747 Query q = session.createQuery(sql);
1748
1749 q.setFirstResult(0);
1750 q.setMaxResults(2);
1751
1752 QueryPos qPos = QueryPos.getInstance(q);
1753
1754 qPos.add(userId);
1755
1756 qPos.add(groupId);
1757
1758 if (orderByComparator != null) {
1759 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
1760
1761 for (Object value : values) {
1762 qPos.add(value);
1763 }
1764 }
1765
1766 List<UserGroupRole> list = q.list();
1767
1768 if (list.size() == 2) {
1769 return list.get(1);
1770 }
1771 else {
1772 return null;
1773 }
1774 }
1775
1776
1784 public List<UserGroupRole> findByG_R(long groupId, long roleId)
1785 throws SystemException {
1786 return findByG_R(groupId, roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1787 null);
1788 }
1789
1790
1804 public List<UserGroupRole> findByG_R(long groupId, long roleId, int start,
1805 int end) throws SystemException {
1806 return findByG_R(groupId, roleId, start, end, null);
1807 }
1808
1809
1824 public List<UserGroupRole> findByG_R(long groupId, long roleId, int start,
1825 int end, OrderByComparator orderByComparator) throws SystemException {
1826 Object[] finderArgs = new Object[] {
1827 groupId, roleId,
1828
1829 String.valueOf(start), String.valueOf(end),
1830 String.valueOf(orderByComparator)
1831 };
1832
1833 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_R,
1834 finderArgs, this);
1835
1836 if (list == null) {
1837 Session session = null;
1838
1839 try {
1840 session = openSession();
1841
1842 StringBundler query = null;
1843
1844 if (orderByComparator != null) {
1845 query = new StringBundler(4 +
1846 (orderByComparator.getOrderByFields().length * 3));
1847 }
1848 else {
1849 query = new StringBundler(3);
1850 }
1851
1852 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
1853
1854 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1855
1856 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
1857
1858 if (orderByComparator != null) {
1859 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1860 orderByComparator);
1861 }
1862
1863 String sql = query.toString();
1864
1865 Query q = session.createQuery(sql);
1866
1867 QueryPos qPos = QueryPos.getInstance(q);
1868
1869 qPos.add(groupId);
1870
1871 qPos.add(roleId);
1872
1873 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
1874 start, end);
1875 }
1876 catch (Exception e) {
1877 throw processException(e);
1878 }
1879 finally {
1880 if (list == null) {
1881 list = new ArrayList<UserGroupRole>();
1882 }
1883
1884 cacheResult(list);
1885
1886 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_R, finderArgs,
1887 list);
1888
1889 closeSession(session);
1890 }
1891 }
1892
1893 return list;
1894 }
1895
1896
1910 public UserGroupRole findByG_R_First(long groupId, long roleId,
1911 OrderByComparator orderByComparator)
1912 throws NoSuchUserGroupRoleException, SystemException {
1913 List<UserGroupRole> list = findByG_R(groupId, roleId, 0, 1,
1914 orderByComparator);
1915
1916 if (list.isEmpty()) {
1917 StringBundler msg = new StringBundler(6);
1918
1919 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1920
1921 msg.append("groupId=");
1922 msg.append(groupId);
1923
1924 msg.append(", roleId=");
1925 msg.append(roleId);
1926
1927 msg.append(StringPool.CLOSE_CURLY_BRACE);
1928
1929 throw new NoSuchUserGroupRoleException(msg.toString());
1930 }
1931 else {
1932 return list.get(0);
1933 }
1934 }
1935
1936
1950 public UserGroupRole findByG_R_Last(long groupId, long roleId,
1951 OrderByComparator orderByComparator)
1952 throws NoSuchUserGroupRoleException, SystemException {
1953 int count = countByG_R(groupId, roleId);
1954
1955 List<UserGroupRole> list = findByG_R(groupId, roleId, count - 1, count,
1956 orderByComparator);
1957
1958 if (list.isEmpty()) {
1959 StringBundler msg = new StringBundler(6);
1960
1961 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1962
1963 msg.append("groupId=");
1964 msg.append(groupId);
1965
1966 msg.append(", roleId=");
1967 msg.append(roleId);
1968
1969 msg.append(StringPool.CLOSE_CURLY_BRACE);
1970
1971 throw new NoSuchUserGroupRoleException(msg.toString());
1972 }
1973 else {
1974 return list.get(0);
1975 }
1976 }
1977
1978
1993 public UserGroupRole[] findByG_R_PrevAndNext(
1994 UserGroupRolePK userGroupRolePK, long groupId, long roleId,
1995 OrderByComparator orderByComparator)
1996 throws NoSuchUserGroupRoleException, SystemException {
1997 UserGroupRole userGroupRole = findByPrimaryKey(userGroupRolePK);
1998
1999 Session session = null;
2000
2001 try {
2002 session = openSession();
2003
2004 UserGroupRole[] array = new UserGroupRoleImpl[3];
2005
2006 array[0] = getByG_R_PrevAndNext(session, userGroupRole, groupId,
2007 roleId, orderByComparator, true);
2008
2009 array[1] = userGroupRole;
2010
2011 array[2] = getByG_R_PrevAndNext(session, userGroupRole, groupId,
2012 roleId, orderByComparator, false);
2013
2014 return array;
2015 }
2016 catch (Exception e) {
2017 throw processException(e);
2018 }
2019 finally {
2020 closeSession(session);
2021 }
2022 }
2023
2024 protected UserGroupRole getByG_R_PrevAndNext(Session session,
2025 UserGroupRole userGroupRole, long groupId, long roleId,
2026 OrderByComparator orderByComparator, boolean previous) {
2027 StringBundler query = null;
2028
2029 if (orderByComparator != null) {
2030 query = new StringBundler(6 +
2031 (orderByComparator.getOrderByFields().length * 6));
2032 }
2033 else {
2034 query = new StringBundler(3);
2035 }
2036
2037 query.append(_SQL_SELECT_USERGROUPROLE_WHERE);
2038
2039 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2040
2041 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2042
2043 if (orderByComparator != null) {
2044 String[] orderByFields = orderByComparator.getOrderByFields();
2045
2046 if (orderByFields.length > 0) {
2047 query.append(WHERE_AND);
2048 }
2049
2050 for (int i = 0; i < orderByFields.length; i++) {
2051 query.append(_ORDER_BY_ENTITY_ALIAS);
2052 query.append(orderByFields[i]);
2053
2054 if ((i + 1) < orderByFields.length) {
2055 if (orderByComparator.isAscending() ^ previous) {
2056 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2057 }
2058 else {
2059 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2060 }
2061 }
2062 else {
2063 if (orderByComparator.isAscending() ^ previous) {
2064 query.append(WHERE_GREATER_THAN);
2065 }
2066 else {
2067 query.append(WHERE_LESSER_THAN);
2068 }
2069 }
2070 }
2071
2072 query.append(ORDER_BY_CLAUSE);
2073
2074 for (int i = 0; i < orderByFields.length; i++) {
2075 query.append(_ORDER_BY_ENTITY_ALIAS);
2076 query.append(orderByFields[i]);
2077
2078 if ((i + 1) < orderByFields.length) {
2079 if (orderByComparator.isAscending() ^ previous) {
2080 query.append(ORDER_BY_ASC_HAS_NEXT);
2081 }
2082 else {
2083 query.append(ORDER_BY_DESC_HAS_NEXT);
2084 }
2085 }
2086 else {
2087 if (orderByComparator.isAscending() ^ previous) {
2088 query.append(ORDER_BY_ASC);
2089 }
2090 else {
2091 query.append(ORDER_BY_DESC);
2092 }
2093 }
2094 }
2095 }
2096
2097 String sql = query.toString();
2098
2099 Query q = session.createQuery(sql);
2100
2101 q.setFirstResult(0);
2102 q.setMaxResults(2);
2103
2104 QueryPos qPos = QueryPos.getInstance(q);
2105
2106 qPos.add(groupId);
2107
2108 qPos.add(roleId);
2109
2110 if (orderByComparator != null) {
2111 Object[] values = orderByComparator.getOrderByValues(userGroupRole);
2112
2113 for (Object value : values) {
2114 qPos.add(value);
2115 }
2116 }
2117
2118 List<UserGroupRole> list = q.list();
2119
2120 if (list.size() == 2) {
2121 return list.get(1);
2122 }
2123 else {
2124 return null;
2125 }
2126 }
2127
2128
2134 public List<UserGroupRole> findAll() throws SystemException {
2135 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2136 }
2137
2138
2150 public List<UserGroupRole> findAll(int start, int end)
2151 throws SystemException {
2152 return findAll(start, end, null);
2153 }
2154
2155
2168 public List<UserGroupRole> findAll(int start, int end,
2169 OrderByComparator orderByComparator) throws SystemException {
2170 Object[] finderArgs = new Object[] {
2171 String.valueOf(start), String.valueOf(end),
2172 String.valueOf(orderByComparator)
2173 };
2174
2175 List<UserGroupRole> list = (List<UserGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2176 finderArgs, this);
2177
2178 if (list == null) {
2179 Session session = null;
2180
2181 try {
2182 session = openSession();
2183
2184 StringBundler query = null;
2185 String sql = null;
2186
2187 if (orderByComparator != null) {
2188 query = new StringBundler(2 +
2189 (orderByComparator.getOrderByFields().length * 3));
2190
2191 query.append(_SQL_SELECT_USERGROUPROLE);
2192
2193 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2194 orderByComparator);
2195
2196 sql = query.toString();
2197 }
2198 else {
2199 sql = _SQL_SELECT_USERGROUPROLE;
2200 }
2201
2202 Query q = session.createQuery(sql);
2203
2204 if (orderByComparator == null) {
2205 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
2206 start, end, false);
2207
2208 Collections.sort(list);
2209 }
2210 else {
2211 list = (List<UserGroupRole>)QueryUtil.list(q, getDialect(),
2212 start, end);
2213 }
2214 }
2215 catch (Exception e) {
2216 throw processException(e);
2217 }
2218 finally {
2219 if (list == null) {
2220 list = new ArrayList<UserGroupRole>();
2221 }
2222
2223 cacheResult(list);
2224
2225 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2226
2227 closeSession(session);
2228 }
2229 }
2230
2231 return list;
2232 }
2233
2234
2240 public void removeByUserId(long userId) throws SystemException {
2241 for (UserGroupRole userGroupRole : findByUserId(userId)) {
2242 remove(userGroupRole);
2243 }
2244 }
2245
2246
2252 public void removeByGroupId(long groupId) throws SystemException {
2253 for (UserGroupRole userGroupRole : findByGroupId(groupId)) {
2254 remove(userGroupRole);
2255 }
2256 }
2257
2258
2264 public void removeByRoleId(long roleId) throws SystemException {
2265 for (UserGroupRole userGroupRole : findByRoleId(roleId)) {
2266 remove(userGroupRole);
2267 }
2268 }
2269
2270
2277 public void removeByU_G(long userId, long groupId)
2278 throws SystemException {
2279 for (UserGroupRole userGroupRole : findByU_G(userId, groupId)) {
2280 remove(userGroupRole);
2281 }
2282 }
2283
2284
2291 public void removeByG_R(long groupId, long roleId)
2292 throws SystemException {
2293 for (UserGroupRole userGroupRole : findByG_R(groupId, roleId)) {
2294 remove(userGroupRole);
2295 }
2296 }
2297
2298
2303 public void removeAll() throws SystemException {
2304 for (UserGroupRole userGroupRole : findAll()) {
2305 remove(userGroupRole);
2306 }
2307 }
2308
2309
2316 public int countByUserId(long userId) throws SystemException {
2317 Object[] finderArgs = new Object[] { userId };
2318
2319 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2320 finderArgs, this);
2321
2322 if (count == null) {
2323 Session session = null;
2324
2325 try {
2326 session = openSession();
2327
2328 StringBundler query = new StringBundler(2);
2329
2330 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2331
2332 query.append(_FINDER_COLUMN_USERID_USERID_2);
2333
2334 String sql = query.toString();
2335
2336 Query q = session.createQuery(sql);
2337
2338 QueryPos qPos = QueryPos.getInstance(q);
2339
2340 qPos.add(userId);
2341
2342 count = (Long)q.uniqueResult();
2343 }
2344 catch (Exception e) {
2345 throw processException(e);
2346 }
2347 finally {
2348 if (count == null) {
2349 count = Long.valueOf(0);
2350 }
2351
2352 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2353 finderArgs, count);
2354
2355 closeSession(session);
2356 }
2357 }
2358
2359 return count.intValue();
2360 }
2361
2362
2369 public int countByGroupId(long groupId) throws SystemException {
2370 Object[] finderArgs = new Object[] { groupId };
2371
2372 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2373 finderArgs, this);
2374
2375 if (count == null) {
2376 Session session = null;
2377
2378 try {
2379 session = openSession();
2380
2381 StringBundler query = new StringBundler(2);
2382
2383 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2384
2385 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2386
2387 String sql = query.toString();
2388
2389 Query q = session.createQuery(sql);
2390
2391 QueryPos qPos = QueryPos.getInstance(q);
2392
2393 qPos.add(groupId);
2394
2395 count = (Long)q.uniqueResult();
2396 }
2397 catch (Exception e) {
2398 throw processException(e);
2399 }
2400 finally {
2401 if (count == null) {
2402 count = Long.valueOf(0);
2403 }
2404
2405 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2406 finderArgs, count);
2407
2408 closeSession(session);
2409 }
2410 }
2411
2412 return count.intValue();
2413 }
2414
2415
2422 public int countByRoleId(long roleId) throws SystemException {
2423 Object[] finderArgs = new Object[] { roleId };
2424
2425 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ROLEID,
2426 finderArgs, this);
2427
2428 if (count == null) {
2429 Session session = null;
2430
2431 try {
2432 session = openSession();
2433
2434 StringBundler query = new StringBundler(2);
2435
2436 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2437
2438 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
2439
2440 String sql = query.toString();
2441
2442 Query q = session.createQuery(sql);
2443
2444 QueryPos qPos = QueryPos.getInstance(q);
2445
2446 qPos.add(roleId);
2447
2448 count = (Long)q.uniqueResult();
2449 }
2450 catch (Exception e) {
2451 throw processException(e);
2452 }
2453 finally {
2454 if (count == null) {
2455 count = Long.valueOf(0);
2456 }
2457
2458 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ROLEID,
2459 finderArgs, count);
2460
2461 closeSession(session);
2462 }
2463 }
2464
2465 return count.intValue();
2466 }
2467
2468
2476 public int countByU_G(long userId, long groupId) throws SystemException {
2477 Object[] finderArgs = new Object[] { userId, groupId };
2478
2479 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_G,
2480 finderArgs, this);
2481
2482 if (count == null) {
2483 Session session = null;
2484
2485 try {
2486 session = openSession();
2487
2488 StringBundler query = new StringBundler(3);
2489
2490 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2491
2492 query.append(_FINDER_COLUMN_U_G_USERID_2);
2493
2494 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
2495
2496 String sql = query.toString();
2497
2498 Query q = session.createQuery(sql);
2499
2500 QueryPos qPos = QueryPos.getInstance(q);
2501
2502 qPos.add(userId);
2503
2504 qPos.add(groupId);
2505
2506 count = (Long)q.uniqueResult();
2507 }
2508 catch (Exception e) {
2509 throw processException(e);
2510 }
2511 finally {
2512 if (count == null) {
2513 count = Long.valueOf(0);
2514 }
2515
2516 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_G, finderArgs,
2517 count);
2518
2519 closeSession(session);
2520 }
2521 }
2522
2523 return count.intValue();
2524 }
2525
2526
2534 public int countByG_R(long groupId, long roleId) throws SystemException {
2535 Object[] finderArgs = new Object[] { groupId, roleId };
2536
2537 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
2538 finderArgs, this);
2539
2540 if (count == null) {
2541 Session session = null;
2542
2543 try {
2544 session = openSession();
2545
2546 StringBundler query = new StringBundler(3);
2547
2548 query.append(_SQL_COUNT_USERGROUPROLE_WHERE);
2549
2550 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2551
2552 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2553
2554 String sql = query.toString();
2555
2556 Query q = session.createQuery(sql);
2557
2558 QueryPos qPos = QueryPos.getInstance(q);
2559
2560 qPos.add(groupId);
2561
2562 qPos.add(roleId);
2563
2564 count = (Long)q.uniqueResult();
2565 }
2566 catch (Exception e) {
2567 throw processException(e);
2568 }
2569 finally {
2570 if (count == null) {
2571 count = Long.valueOf(0);
2572 }
2573
2574 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_R, finderArgs,
2575 count);
2576
2577 closeSession(session);
2578 }
2579 }
2580
2581 return count.intValue();
2582 }
2583
2584
2590 public int countAll() throws SystemException {
2591 Object[] finderArgs = new Object[0];
2592
2593 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2594 finderArgs, this);
2595
2596 if (count == null) {
2597 Session session = null;
2598
2599 try {
2600 session = openSession();
2601
2602 Query q = session.createQuery(_SQL_COUNT_USERGROUPROLE);
2603
2604 count = (Long)q.uniqueResult();
2605 }
2606 catch (Exception e) {
2607 throw processException(e);
2608 }
2609 finally {
2610 if (count == null) {
2611 count = Long.valueOf(0);
2612 }
2613
2614 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2615 count);
2616
2617 closeSession(session);
2618 }
2619 }
2620
2621 return count.intValue();
2622 }
2623
2624
2627 public void afterPropertiesSet() {
2628 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2629 com.liferay.portal.util.PropsUtil.get(
2630 "value.object.listener.com.liferay.portal.model.UserGroupRole")));
2631
2632 if (listenerClassNames.length > 0) {
2633 try {
2634 List<ModelListener<UserGroupRole>> listenersList = new ArrayList<ModelListener<UserGroupRole>>();
2635
2636 for (String listenerClassName : listenerClassNames) {
2637 listenersList.add((ModelListener<UserGroupRole>)InstanceFactory.newInstance(
2638 listenerClassName));
2639 }
2640
2641 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2642 }
2643 catch (Exception e) {
2644 _log.error(e);
2645 }
2646 }
2647 }
2648
2649 @BeanReference(type = AccountPersistence.class)
2650 protected AccountPersistence accountPersistence;
2651 @BeanReference(type = AddressPersistence.class)
2652 protected AddressPersistence addressPersistence;
2653 @BeanReference(type = BrowserTrackerPersistence.class)
2654 protected BrowserTrackerPersistence browserTrackerPersistence;
2655 @BeanReference(type = ClassNamePersistence.class)
2656 protected ClassNamePersistence classNamePersistence;
2657 @BeanReference(type = ClusterGroupPersistence.class)
2658 protected ClusterGroupPersistence clusterGroupPersistence;
2659 @BeanReference(type = CompanyPersistence.class)
2660 protected CompanyPersistence companyPersistence;
2661 @BeanReference(type = ContactPersistence.class)
2662 protected ContactPersistence contactPersistence;
2663 @BeanReference(type = CountryPersistence.class)
2664 protected CountryPersistence countryPersistence;
2665 @BeanReference(type = EmailAddressPersistence.class)
2666 protected EmailAddressPersistence emailAddressPersistence;
2667 @BeanReference(type = GroupPersistence.class)
2668 protected GroupPersistence groupPersistence;
2669 @BeanReference(type = ImagePersistence.class)
2670 protected ImagePersistence imagePersistence;
2671 @BeanReference(type = LayoutPersistence.class)
2672 protected LayoutPersistence layoutPersistence;
2673 @BeanReference(type = LayoutPrototypePersistence.class)
2674 protected LayoutPrototypePersistence layoutPrototypePersistence;
2675 @BeanReference(type = LayoutSetPersistence.class)
2676 protected LayoutSetPersistence layoutSetPersistence;
2677 @BeanReference(type = LayoutSetPrototypePersistence.class)
2678 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2679 @BeanReference(type = ListTypePersistence.class)
2680 protected ListTypePersistence listTypePersistence;
2681 @BeanReference(type = LockPersistence.class)
2682 protected LockPersistence lockPersistence;
2683 @BeanReference(type = MembershipRequestPersistence.class)
2684 protected MembershipRequestPersistence membershipRequestPersistence;
2685 @BeanReference(type = OrganizationPersistence.class)
2686 protected OrganizationPersistence organizationPersistence;
2687 @BeanReference(type = OrgGroupPermissionPersistence.class)
2688 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2689 @BeanReference(type = OrgGroupRolePersistence.class)
2690 protected OrgGroupRolePersistence orgGroupRolePersistence;
2691 @BeanReference(type = OrgLaborPersistence.class)
2692 protected OrgLaborPersistence orgLaborPersistence;
2693 @BeanReference(type = PasswordPolicyPersistence.class)
2694 protected PasswordPolicyPersistence passwordPolicyPersistence;
2695 @BeanReference(type = PasswordPolicyRelPersistence.class)
2696 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2697 @BeanReference(type = PasswordTrackerPersistence.class)
2698 protected PasswordTrackerPersistence passwordTrackerPersistence;
2699 @BeanReference(type = PermissionPersistence.class)
2700 protected PermissionPersistence permissionPersistence;
2701 @BeanReference(type = PhonePersistence.class)
2702 protected PhonePersistence phonePersistence;
2703 @BeanReference(type = PluginSettingPersistence.class)
2704 protected PluginSettingPersistence pluginSettingPersistence;
2705 @BeanReference(type = PortletPersistence.class)
2706 protected PortletPersistence portletPersistence;
2707 @BeanReference(type = PortletItemPersistence.class)
2708 protected PortletItemPersistence portletItemPersistence;
2709 @BeanReference(type = PortletPreferencesPersistence.class)
2710 protected PortletPreferencesPersistence portletPreferencesPersistence;
2711 @BeanReference(type = RegionPersistence.class)
2712 protected RegionPersistence regionPersistence;
2713 @BeanReference(type = ReleasePersistence.class)
2714 protected ReleasePersistence releasePersistence;
2715 @BeanReference(type = ResourcePersistence.class)
2716 protected ResourcePersistence resourcePersistence;
2717 @BeanReference(type = ResourceActionPersistence.class)
2718 protected ResourceActionPersistence resourceActionPersistence;
2719 @BeanReference(type = ResourceCodePersistence.class)
2720 protected ResourceCodePersistence resourceCodePersistence;
2721 @BeanReference(type = ResourcePermissionPersistence.class)
2722 protected ResourcePermissionPersistence resourcePermissionPersistence;
2723 @BeanReference(type = RolePersistence.class)
2724 protected RolePersistence rolePersistence;
2725 @BeanReference(type = ServiceComponentPersistence.class)
2726 protected ServiceComponentPersistence serviceComponentPersistence;
2727 @BeanReference(type = ShardPersistence.class)
2728 protected ShardPersistence shardPersistence;
2729 @BeanReference(type = SubscriptionPersistence.class)
2730 protected SubscriptionPersistence subscriptionPersistence;
2731 @BeanReference(type = TicketPersistence.class)
2732 protected TicketPersistence ticketPersistence;
2733 @BeanReference(type = TeamPersistence.class)
2734 protected TeamPersistence teamPersistence;
2735 @BeanReference(type = UserPersistence.class)
2736 protected UserPersistence userPersistence;
2737 @BeanReference(type = UserGroupPersistence.class)
2738 protected UserGroupPersistence userGroupPersistence;
2739 @BeanReference(type = UserGroupGroupRolePersistence.class)
2740 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2741 @BeanReference(type = UserGroupRolePersistence.class)
2742 protected UserGroupRolePersistence userGroupRolePersistence;
2743 @BeanReference(type = UserIdMapperPersistence.class)
2744 protected UserIdMapperPersistence userIdMapperPersistence;
2745 @BeanReference(type = UserTrackerPersistence.class)
2746 protected UserTrackerPersistence userTrackerPersistence;
2747 @BeanReference(type = UserTrackerPathPersistence.class)
2748 protected UserTrackerPathPersistence userTrackerPathPersistence;
2749 @BeanReference(type = WebDAVPropsPersistence.class)
2750 protected WebDAVPropsPersistence webDAVPropsPersistence;
2751 @BeanReference(type = WebsitePersistence.class)
2752 protected WebsitePersistence websitePersistence;
2753 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2754 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2755 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2756 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2757 private static final String _SQL_SELECT_USERGROUPROLE = "SELECT userGroupRole FROM UserGroupRole userGroupRole";
2758 private static final String _SQL_SELECT_USERGROUPROLE_WHERE = "SELECT userGroupRole FROM UserGroupRole userGroupRole WHERE ";
2759 private static final String _SQL_COUNT_USERGROUPROLE = "SELECT COUNT(userGroupRole) FROM UserGroupRole userGroupRole";
2760 private static final String _SQL_COUNT_USERGROUPROLE_WHERE = "SELECT COUNT(userGroupRole) FROM UserGroupRole userGroupRole WHERE ";
2761 private static final String _FINDER_COLUMN_USERID_USERID_2 = "userGroupRole.id.userId = ?";
2762 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "userGroupRole.id.groupId = ?";
2763 private static final String _FINDER_COLUMN_ROLEID_ROLEID_2 = "userGroupRole.id.roleId = ?";
2764 private static final String _FINDER_COLUMN_U_G_USERID_2 = "userGroupRole.id.userId = ? AND ";
2765 private static final String _FINDER_COLUMN_U_G_GROUPID_2 = "userGroupRole.id.groupId = ?";
2766 private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "userGroupRole.id.groupId = ? AND ";
2767 private static final String _FINDER_COLUMN_G_R_ROLEID_2 = "userGroupRole.id.roleId = ?";
2768 private static final String _ORDER_BY_ENTITY_ALIAS = "userGroupRole.";
2769 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserGroupRole exists with the primary key ";
2770 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserGroupRole exists with the key {";
2771 private static Log _log = LogFactoryUtil.getLog(UserGroupRolePersistenceImpl.class);
2772 }