001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchUserGroupGroupRoleException;
018 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
019 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
020 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderPath;
022 import com.liferay.portal.kernel.dao.orm.Query;
023 import com.liferay.portal.kernel.dao.orm.QueryPos;
024 import com.liferay.portal.kernel.dao.orm.QueryUtil;
025 import com.liferay.portal.kernel.dao.orm.Session;
026 import com.liferay.portal.kernel.exception.SystemException;
027 import com.liferay.portal.kernel.log.Log;
028 import com.liferay.portal.kernel.log.LogFactoryUtil;
029 import com.liferay.portal.kernel.util.GetterUtil;
030 import com.liferay.portal.kernel.util.InstanceFactory;
031 import com.liferay.portal.kernel.util.OrderByComparator;
032 import com.liferay.portal.kernel.util.StringBundler;
033 import com.liferay.portal.kernel.util.StringPool;
034 import com.liferay.portal.kernel.util.StringUtil;
035 import com.liferay.portal.kernel.util.UnmodifiableList;
036 import com.liferay.portal.model.CacheModel;
037 import com.liferay.portal.model.ModelListener;
038 import com.liferay.portal.model.UserGroupGroupRole;
039 import com.liferay.portal.model.impl.UserGroupGroupRoleImpl;
040 import com.liferay.portal.model.impl.UserGroupGroupRoleModelImpl;
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
061 public class UserGroupGroupRolePersistenceImpl extends BasePersistenceImpl<UserGroupGroupRole>
062 implements UserGroupGroupRolePersistence {
063
068 public static final String FINDER_CLASS_NAME_ENTITY = UserGroupGroupRoleImpl.class.getName();
069 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
070 ".List1";
071 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072 ".List2";
073 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
074 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
075 UserGroupGroupRoleImpl.class,
076 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
077 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
078 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
079 UserGroupGroupRoleImpl.class,
080 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
081 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
082 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
083 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
084 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERGROUPID =
085 new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
086 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
087 UserGroupGroupRoleImpl.class,
088 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserGroupId",
089 new String[] {
090 Long.class.getName(),
091
092 Integer.class.getName(), Integer.class.getName(),
093 OrderByComparator.class.getName()
094 });
095 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID =
096 new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
097 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
098 UserGroupGroupRoleImpl.class,
099 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserGroupId",
100 new String[] { Long.class.getName() },
101 UserGroupGroupRoleModelImpl.USERGROUPID_COLUMN_BITMASK);
102 public static final FinderPath FINDER_PATH_COUNT_BY_USERGROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
103 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
104 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserGroupId",
105 new String[] { Long.class.getName() });
106
107
114 @Override
115 public List<UserGroupGroupRole> findByUserGroupId(long userGroupId)
116 throws SystemException {
117 return findByUserGroupId(userGroupId, QueryUtil.ALL_POS,
118 QueryUtil.ALL_POS, null);
119 }
120
121
134 @Override
135 public List<UserGroupGroupRole> findByUserGroupId(long userGroupId,
136 int start, int end) throws SystemException {
137 return findByUserGroupId(userGroupId, start, end, null);
138 }
139
140
154 @Override
155 public List<UserGroupGroupRole> findByUserGroupId(long userGroupId,
156 int start, int end, OrderByComparator orderByComparator)
157 throws SystemException {
158 boolean pagination = true;
159 FinderPath finderPath = null;
160 Object[] finderArgs = null;
161
162 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
163 (orderByComparator == null)) {
164 pagination = false;
165 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID;
166 finderArgs = new Object[] { userGroupId };
167 }
168 else {
169 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERGROUPID;
170 finderArgs = new Object[] { userGroupId, start, end, orderByComparator };
171 }
172
173 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
174 finderArgs, this);
175
176 if ((list != null) && !list.isEmpty()) {
177 for (UserGroupGroupRole userGroupGroupRole : list) {
178 if ((userGroupId != userGroupGroupRole.getUserGroupId())) {
179 list = null;
180
181 break;
182 }
183 }
184 }
185
186 if (list == null) {
187 StringBundler query = null;
188
189 if (orderByComparator != null) {
190 query = new StringBundler(3 +
191 (orderByComparator.getOrderByFields().length * 3));
192 }
193 else {
194 query = new StringBundler(3);
195 }
196
197 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
198
199 query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
200
201 if (orderByComparator != null) {
202 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
203 orderByComparator);
204 }
205 else
206 if (pagination) {
207 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
208 }
209
210 String sql = query.toString();
211
212 Session session = null;
213
214 try {
215 session = openSession();
216
217 Query q = session.createQuery(sql);
218
219 QueryPos qPos = QueryPos.getInstance(q);
220
221 qPos.add(userGroupId);
222
223 if (!pagination) {
224 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
225 getDialect(), start, end, false);
226
227 Collections.sort(list);
228
229 list = new UnmodifiableList<UserGroupGroupRole>(list);
230 }
231 else {
232 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
233 getDialect(), start, end);
234 }
235
236 cacheResult(list);
237
238 FinderCacheUtil.putResult(finderPath, finderArgs, list);
239 }
240 catch (Exception e) {
241 FinderCacheUtil.removeResult(finderPath, finderArgs);
242
243 throw processException(e);
244 }
245 finally {
246 closeSession(session);
247 }
248 }
249
250 return list;
251 }
252
253
262 @Override
263 public UserGroupGroupRole findByUserGroupId_First(long userGroupId,
264 OrderByComparator orderByComparator)
265 throws NoSuchUserGroupGroupRoleException, SystemException {
266 UserGroupGroupRole userGroupGroupRole = fetchByUserGroupId_First(userGroupId,
267 orderByComparator);
268
269 if (userGroupGroupRole != null) {
270 return userGroupGroupRole;
271 }
272
273 StringBundler msg = new StringBundler(4);
274
275 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
276
277 msg.append("userGroupId=");
278 msg.append(userGroupId);
279
280 msg.append(StringPool.CLOSE_CURLY_BRACE);
281
282 throw new NoSuchUserGroupGroupRoleException(msg.toString());
283 }
284
285
293 @Override
294 public UserGroupGroupRole fetchByUserGroupId_First(long userGroupId,
295 OrderByComparator orderByComparator) throws SystemException {
296 List<UserGroupGroupRole> list = findByUserGroupId(userGroupId, 0, 1,
297 orderByComparator);
298
299 if (!list.isEmpty()) {
300 return list.get(0);
301 }
302
303 return null;
304 }
305
306
315 @Override
316 public UserGroupGroupRole findByUserGroupId_Last(long userGroupId,
317 OrderByComparator orderByComparator)
318 throws NoSuchUserGroupGroupRoleException, SystemException {
319 UserGroupGroupRole userGroupGroupRole = fetchByUserGroupId_Last(userGroupId,
320 orderByComparator);
321
322 if (userGroupGroupRole != null) {
323 return userGroupGroupRole;
324 }
325
326 StringBundler msg = new StringBundler(4);
327
328 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
329
330 msg.append("userGroupId=");
331 msg.append(userGroupId);
332
333 msg.append(StringPool.CLOSE_CURLY_BRACE);
334
335 throw new NoSuchUserGroupGroupRoleException(msg.toString());
336 }
337
338
346 @Override
347 public UserGroupGroupRole fetchByUserGroupId_Last(long userGroupId,
348 OrderByComparator orderByComparator) throws SystemException {
349 int count = countByUserGroupId(userGroupId);
350
351 if (count == 0) {
352 return null;
353 }
354
355 List<UserGroupGroupRole> list = findByUserGroupId(userGroupId,
356 count - 1, count, orderByComparator);
357
358 if (!list.isEmpty()) {
359 return list.get(0);
360 }
361
362 return null;
363 }
364
365
375 @Override
376 public UserGroupGroupRole[] findByUserGroupId_PrevAndNext(
377 UserGroupGroupRolePK userGroupGroupRolePK, long userGroupId,
378 OrderByComparator orderByComparator)
379 throws NoSuchUserGroupGroupRoleException, SystemException {
380 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
381
382 Session session = null;
383
384 try {
385 session = openSession();
386
387 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
388
389 array[0] = getByUserGroupId_PrevAndNext(session,
390 userGroupGroupRole, userGroupId, orderByComparator, true);
391
392 array[1] = userGroupGroupRole;
393
394 array[2] = getByUserGroupId_PrevAndNext(session,
395 userGroupGroupRole, userGroupId, orderByComparator, false);
396
397 return array;
398 }
399 catch (Exception e) {
400 throw processException(e);
401 }
402 finally {
403 closeSession(session);
404 }
405 }
406
407 protected UserGroupGroupRole getByUserGroupId_PrevAndNext(Session session,
408 UserGroupGroupRole userGroupGroupRole, long userGroupId,
409 OrderByComparator orderByComparator, boolean previous) {
410 StringBundler query = null;
411
412 if (orderByComparator != null) {
413 query = new StringBundler(6 +
414 (orderByComparator.getOrderByFields().length * 6));
415 }
416 else {
417 query = new StringBundler(3);
418 }
419
420 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
421
422 query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
423
424 if (orderByComparator != null) {
425 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
426
427 if (orderByConditionFields.length > 0) {
428 query.append(WHERE_AND);
429 }
430
431 for (int i = 0; i < orderByConditionFields.length; i++) {
432 query.append(_ORDER_BY_ENTITY_ALIAS);
433 query.append(orderByConditionFields[i]);
434
435 if ((i + 1) < orderByConditionFields.length) {
436 if (orderByComparator.isAscending() ^ previous) {
437 query.append(WHERE_GREATER_THAN_HAS_NEXT);
438 }
439 else {
440 query.append(WHERE_LESSER_THAN_HAS_NEXT);
441 }
442 }
443 else {
444 if (orderByComparator.isAscending() ^ previous) {
445 query.append(WHERE_GREATER_THAN);
446 }
447 else {
448 query.append(WHERE_LESSER_THAN);
449 }
450 }
451 }
452
453 query.append(ORDER_BY_CLAUSE);
454
455 String[] orderByFields = orderByComparator.getOrderByFields();
456
457 for (int i = 0; i < orderByFields.length; i++) {
458 query.append(_ORDER_BY_ENTITY_ALIAS);
459 query.append(orderByFields[i]);
460
461 if ((i + 1) < orderByFields.length) {
462 if (orderByComparator.isAscending() ^ previous) {
463 query.append(ORDER_BY_ASC_HAS_NEXT);
464 }
465 else {
466 query.append(ORDER_BY_DESC_HAS_NEXT);
467 }
468 }
469 else {
470 if (orderByComparator.isAscending() ^ previous) {
471 query.append(ORDER_BY_ASC);
472 }
473 else {
474 query.append(ORDER_BY_DESC);
475 }
476 }
477 }
478 }
479 else {
480 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
481 }
482
483 String sql = query.toString();
484
485 Query q = session.createQuery(sql);
486
487 q.setFirstResult(0);
488 q.setMaxResults(2);
489
490 QueryPos qPos = QueryPos.getInstance(q);
491
492 qPos.add(userGroupId);
493
494 if (orderByComparator != null) {
495 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
496
497 for (Object value : values) {
498 qPos.add(value);
499 }
500 }
501
502 List<UserGroupGroupRole> list = q.list();
503
504 if (list.size() == 2) {
505 return list.get(1);
506 }
507 else {
508 return null;
509 }
510 }
511
512
518 @Override
519 public void removeByUserGroupId(long userGroupId) throws SystemException {
520 for (UserGroupGroupRole userGroupGroupRole : findByUserGroupId(
521 userGroupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
522 remove(userGroupGroupRole);
523 }
524 }
525
526
533 @Override
534 public int countByUserGroupId(long userGroupId) throws SystemException {
535 FinderPath finderPath = FINDER_PATH_COUNT_BY_USERGROUPID;
536
537 Object[] finderArgs = new Object[] { userGroupId };
538
539 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
540 this);
541
542 if (count == null) {
543 StringBundler query = new StringBundler(2);
544
545 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
546
547 query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
548
549 String sql = query.toString();
550
551 Session session = null;
552
553 try {
554 session = openSession();
555
556 Query q = session.createQuery(sql);
557
558 QueryPos qPos = QueryPos.getInstance(q);
559
560 qPos.add(userGroupId);
561
562 count = (Long)q.uniqueResult();
563
564 FinderCacheUtil.putResult(finderPath, finderArgs, count);
565 }
566 catch (Exception e) {
567 FinderCacheUtil.removeResult(finderPath, finderArgs);
568
569 throw processException(e);
570 }
571 finally {
572 closeSession(session);
573 }
574 }
575
576 return count.intValue();
577 }
578
579 private static final String _FINDER_COLUMN_USERGROUPID_USERGROUPID_2 = "userGroupGroupRole.id.userGroupId = ?";
580 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
581 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
582 UserGroupGroupRoleImpl.class,
583 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
584 new String[] {
585 Long.class.getName(),
586
587 Integer.class.getName(), Integer.class.getName(),
588 OrderByComparator.class.getName()
589 });
590 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
591 new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
592 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
593 UserGroupGroupRoleImpl.class,
594 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
595 new String[] { Long.class.getName() },
596 UserGroupGroupRoleModelImpl.GROUPID_COLUMN_BITMASK);
597 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
598 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
599 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
600 new String[] { Long.class.getName() });
601
602
609 @Override
610 public List<UserGroupGroupRole> findByGroupId(long groupId)
611 throws SystemException {
612 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
613 }
614
615
628 @Override
629 public List<UserGroupGroupRole> findByGroupId(long groupId, int start,
630 int end) throws SystemException {
631 return findByGroupId(groupId, start, end, null);
632 }
633
634
648 @Override
649 public List<UserGroupGroupRole> findByGroupId(long groupId, int start,
650 int end, OrderByComparator orderByComparator) throws SystemException {
651 boolean pagination = true;
652 FinderPath finderPath = null;
653 Object[] finderArgs = null;
654
655 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
656 (orderByComparator == null)) {
657 pagination = false;
658 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
659 finderArgs = new Object[] { groupId };
660 }
661 else {
662 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
663 finderArgs = new Object[] { groupId, start, end, orderByComparator };
664 }
665
666 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
667 finderArgs, this);
668
669 if ((list != null) && !list.isEmpty()) {
670 for (UserGroupGroupRole userGroupGroupRole : list) {
671 if ((groupId != userGroupGroupRole.getGroupId())) {
672 list = null;
673
674 break;
675 }
676 }
677 }
678
679 if (list == null) {
680 StringBundler query = null;
681
682 if (orderByComparator != null) {
683 query = new StringBundler(3 +
684 (orderByComparator.getOrderByFields().length * 3));
685 }
686 else {
687 query = new StringBundler(3);
688 }
689
690 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
691
692 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
693
694 if (orderByComparator != null) {
695 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
696 orderByComparator);
697 }
698 else
699 if (pagination) {
700 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
701 }
702
703 String sql = query.toString();
704
705 Session session = null;
706
707 try {
708 session = openSession();
709
710 Query q = session.createQuery(sql);
711
712 QueryPos qPos = QueryPos.getInstance(q);
713
714 qPos.add(groupId);
715
716 if (!pagination) {
717 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
718 getDialect(), start, end, false);
719
720 Collections.sort(list);
721
722 list = new UnmodifiableList<UserGroupGroupRole>(list);
723 }
724 else {
725 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
726 getDialect(), start, end);
727 }
728
729 cacheResult(list);
730
731 FinderCacheUtil.putResult(finderPath, finderArgs, list);
732 }
733 catch (Exception e) {
734 FinderCacheUtil.removeResult(finderPath, finderArgs);
735
736 throw processException(e);
737 }
738 finally {
739 closeSession(session);
740 }
741 }
742
743 return list;
744 }
745
746
755 @Override
756 public UserGroupGroupRole findByGroupId_First(long groupId,
757 OrderByComparator orderByComparator)
758 throws NoSuchUserGroupGroupRoleException, SystemException {
759 UserGroupGroupRole userGroupGroupRole = fetchByGroupId_First(groupId,
760 orderByComparator);
761
762 if (userGroupGroupRole != null) {
763 return userGroupGroupRole;
764 }
765
766 StringBundler msg = new StringBundler(4);
767
768 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
769
770 msg.append("groupId=");
771 msg.append(groupId);
772
773 msg.append(StringPool.CLOSE_CURLY_BRACE);
774
775 throw new NoSuchUserGroupGroupRoleException(msg.toString());
776 }
777
778
786 @Override
787 public UserGroupGroupRole fetchByGroupId_First(long groupId,
788 OrderByComparator orderByComparator) throws SystemException {
789 List<UserGroupGroupRole> list = findByGroupId(groupId, 0, 1,
790 orderByComparator);
791
792 if (!list.isEmpty()) {
793 return list.get(0);
794 }
795
796 return null;
797 }
798
799
808 @Override
809 public UserGroupGroupRole findByGroupId_Last(long groupId,
810 OrderByComparator orderByComparator)
811 throws NoSuchUserGroupGroupRoleException, SystemException {
812 UserGroupGroupRole userGroupGroupRole = fetchByGroupId_Last(groupId,
813 orderByComparator);
814
815 if (userGroupGroupRole != null) {
816 return userGroupGroupRole;
817 }
818
819 StringBundler msg = new StringBundler(4);
820
821 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
822
823 msg.append("groupId=");
824 msg.append(groupId);
825
826 msg.append(StringPool.CLOSE_CURLY_BRACE);
827
828 throw new NoSuchUserGroupGroupRoleException(msg.toString());
829 }
830
831
839 @Override
840 public UserGroupGroupRole fetchByGroupId_Last(long groupId,
841 OrderByComparator orderByComparator) throws SystemException {
842 int count = countByGroupId(groupId);
843
844 if (count == 0) {
845 return null;
846 }
847
848 List<UserGroupGroupRole> list = findByGroupId(groupId, count - 1,
849 count, orderByComparator);
850
851 if (!list.isEmpty()) {
852 return list.get(0);
853 }
854
855 return null;
856 }
857
858
868 @Override
869 public UserGroupGroupRole[] findByGroupId_PrevAndNext(
870 UserGroupGroupRolePK userGroupGroupRolePK, long groupId,
871 OrderByComparator orderByComparator)
872 throws NoSuchUserGroupGroupRoleException, SystemException {
873 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
874
875 Session session = null;
876
877 try {
878 session = openSession();
879
880 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
881
882 array[0] = getByGroupId_PrevAndNext(session, userGroupGroupRole,
883 groupId, orderByComparator, true);
884
885 array[1] = userGroupGroupRole;
886
887 array[2] = getByGroupId_PrevAndNext(session, userGroupGroupRole,
888 groupId, orderByComparator, false);
889
890 return array;
891 }
892 catch (Exception e) {
893 throw processException(e);
894 }
895 finally {
896 closeSession(session);
897 }
898 }
899
900 protected UserGroupGroupRole getByGroupId_PrevAndNext(Session session,
901 UserGroupGroupRole userGroupGroupRole, long groupId,
902 OrderByComparator orderByComparator, boolean previous) {
903 StringBundler query = null;
904
905 if (orderByComparator != null) {
906 query = new StringBundler(6 +
907 (orderByComparator.getOrderByFields().length * 6));
908 }
909 else {
910 query = new StringBundler(3);
911 }
912
913 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
914
915 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
916
917 if (orderByComparator != null) {
918 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
919
920 if (orderByConditionFields.length > 0) {
921 query.append(WHERE_AND);
922 }
923
924 for (int i = 0; i < orderByConditionFields.length; i++) {
925 query.append(_ORDER_BY_ENTITY_ALIAS);
926 query.append(orderByConditionFields[i]);
927
928 if ((i + 1) < orderByConditionFields.length) {
929 if (orderByComparator.isAscending() ^ previous) {
930 query.append(WHERE_GREATER_THAN_HAS_NEXT);
931 }
932 else {
933 query.append(WHERE_LESSER_THAN_HAS_NEXT);
934 }
935 }
936 else {
937 if (orderByComparator.isAscending() ^ previous) {
938 query.append(WHERE_GREATER_THAN);
939 }
940 else {
941 query.append(WHERE_LESSER_THAN);
942 }
943 }
944 }
945
946 query.append(ORDER_BY_CLAUSE);
947
948 String[] orderByFields = orderByComparator.getOrderByFields();
949
950 for (int i = 0; i < orderByFields.length; i++) {
951 query.append(_ORDER_BY_ENTITY_ALIAS);
952 query.append(orderByFields[i]);
953
954 if ((i + 1) < orderByFields.length) {
955 if (orderByComparator.isAscending() ^ previous) {
956 query.append(ORDER_BY_ASC_HAS_NEXT);
957 }
958 else {
959 query.append(ORDER_BY_DESC_HAS_NEXT);
960 }
961 }
962 else {
963 if (orderByComparator.isAscending() ^ previous) {
964 query.append(ORDER_BY_ASC);
965 }
966 else {
967 query.append(ORDER_BY_DESC);
968 }
969 }
970 }
971 }
972 else {
973 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
974 }
975
976 String sql = query.toString();
977
978 Query q = session.createQuery(sql);
979
980 q.setFirstResult(0);
981 q.setMaxResults(2);
982
983 QueryPos qPos = QueryPos.getInstance(q);
984
985 qPos.add(groupId);
986
987 if (orderByComparator != null) {
988 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
989
990 for (Object value : values) {
991 qPos.add(value);
992 }
993 }
994
995 List<UserGroupGroupRole> list = q.list();
996
997 if (list.size() == 2) {
998 return list.get(1);
999 }
1000 else {
1001 return null;
1002 }
1003 }
1004
1005
1011 @Override
1012 public void removeByGroupId(long groupId) throws SystemException {
1013 for (UserGroupGroupRole userGroupGroupRole : findByGroupId(groupId,
1014 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1015 remove(userGroupGroupRole);
1016 }
1017 }
1018
1019
1026 @Override
1027 public int countByGroupId(long groupId) throws SystemException {
1028 FinderPath finderPath = FINDER_PATH_COUNT_BY_GROUPID;
1029
1030 Object[] finderArgs = new Object[] { groupId };
1031
1032 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1033 this);
1034
1035 if (count == null) {
1036 StringBundler query = new StringBundler(2);
1037
1038 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
1039
1040 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1041
1042 String sql = query.toString();
1043
1044 Session session = null;
1045
1046 try {
1047 session = openSession();
1048
1049 Query q = session.createQuery(sql);
1050
1051 QueryPos qPos = QueryPos.getInstance(q);
1052
1053 qPos.add(groupId);
1054
1055 count = (Long)q.uniqueResult();
1056
1057 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1058 }
1059 catch (Exception e) {
1060 FinderCacheUtil.removeResult(finderPath, finderArgs);
1061
1062 throw processException(e);
1063 }
1064 finally {
1065 closeSession(session);
1066 }
1067 }
1068
1069 return count.intValue();
1070 }
1071
1072 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "userGroupGroupRole.id.groupId = ?";
1073 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ROLEID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1074 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
1075 UserGroupGroupRoleImpl.class,
1076 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByRoleId",
1077 new String[] {
1078 Long.class.getName(),
1079
1080 Integer.class.getName(), Integer.class.getName(),
1081 OrderByComparator.class.getName()
1082 });
1083 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID =
1084 new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1085 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
1086 UserGroupGroupRoleImpl.class,
1087 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByRoleId",
1088 new String[] { Long.class.getName() },
1089 UserGroupGroupRoleModelImpl.ROLEID_COLUMN_BITMASK);
1090 public static final FinderPath FINDER_PATH_COUNT_BY_ROLEID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1091 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
1092 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRoleId",
1093 new String[] { Long.class.getName() });
1094
1095
1102 @Override
1103 public List<UserGroupGroupRole> findByRoleId(long roleId)
1104 throws SystemException {
1105 return findByRoleId(roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1106 }
1107
1108
1121 @Override
1122 public List<UserGroupGroupRole> findByRoleId(long roleId, int start, int end)
1123 throws SystemException {
1124 return findByRoleId(roleId, start, end, null);
1125 }
1126
1127
1141 @Override
1142 public List<UserGroupGroupRole> findByRoleId(long roleId, int start,
1143 int end, OrderByComparator orderByComparator) throws SystemException {
1144 boolean pagination = true;
1145 FinderPath finderPath = null;
1146 Object[] finderArgs = null;
1147
1148 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1149 (orderByComparator == null)) {
1150 pagination = false;
1151 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID;
1152 finderArgs = new Object[] { roleId };
1153 }
1154 else {
1155 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ROLEID;
1156 finderArgs = new Object[] { roleId, start, end, orderByComparator };
1157 }
1158
1159 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
1160 finderArgs, this);
1161
1162 if ((list != null) && !list.isEmpty()) {
1163 for (UserGroupGroupRole userGroupGroupRole : list) {
1164 if ((roleId != userGroupGroupRole.getRoleId())) {
1165 list = null;
1166
1167 break;
1168 }
1169 }
1170 }
1171
1172 if (list == null) {
1173 StringBundler query = null;
1174
1175 if (orderByComparator != null) {
1176 query = new StringBundler(3 +
1177 (orderByComparator.getOrderByFields().length * 3));
1178 }
1179 else {
1180 query = new StringBundler(3);
1181 }
1182
1183 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1184
1185 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1186
1187 if (orderByComparator != null) {
1188 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1189 orderByComparator);
1190 }
1191 else
1192 if (pagination) {
1193 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
1194 }
1195
1196 String sql = query.toString();
1197
1198 Session session = null;
1199
1200 try {
1201 session = openSession();
1202
1203 Query q = session.createQuery(sql);
1204
1205 QueryPos qPos = QueryPos.getInstance(q);
1206
1207 qPos.add(roleId);
1208
1209 if (!pagination) {
1210 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1211 getDialect(), start, end, false);
1212
1213 Collections.sort(list);
1214
1215 list = new UnmodifiableList<UserGroupGroupRole>(list);
1216 }
1217 else {
1218 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1219 getDialect(), start, end);
1220 }
1221
1222 cacheResult(list);
1223
1224 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1225 }
1226 catch (Exception e) {
1227 FinderCacheUtil.removeResult(finderPath, finderArgs);
1228
1229 throw processException(e);
1230 }
1231 finally {
1232 closeSession(session);
1233 }
1234 }
1235
1236 return list;
1237 }
1238
1239
1248 @Override
1249 public UserGroupGroupRole findByRoleId_First(long roleId,
1250 OrderByComparator orderByComparator)
1251 throws NoSuchUserGroupGroupRoleException, SystemException {
1252 UserGroupGroupRole userGroupGroupRole = fetchByRoleId_First(roleId,
1253 orderByComparator);
1254
1255 if (userGroupGroupRole != null) {
1256 return userGroupGroupRole;
1257 }
1258
1259 StringBundler msg = new StringBundler(4);
1260
1261 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1262
1263 msg.append("roleId=");
1264 msg.append(roleId);
1265
1266 msg.append(StringPool.CLOSE_CURLY_BRACE);
1267
1268 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1269 }
1270
1271
1279 @Override
1280 public UserGroupGroupRole fetchByRoleId_First(long roleId,
1281 OrderByComparator orderByComparator) throws SystemException {
1282 List<UserGroupGroupRole> list = findByRoleId(roleId, 0, 1,
1283 orderByComparator);
1284
1285 if (!list.isEmpty()) {
1286 return list.get(0);
1287 }
1288
1289 return null;
1290 }
1291
1292
1301 @Override
1302 public UserGroupGroupRole findByRoleId_Last(long roleId,
1303 OrderByComparator orderByComparator)
1304 throws NoSuchUserGroupGroupRoleException, SystemException {
1305 UserGroupGroupRole userGroupGroupRole = fetchByRoleId_Last(roleId,
1306 orderByComparator);
1307
1308 if (userGroupGroupRole != null) {
1309 return userGroupGroupRole;
1310 }
1311
1312 StringBundler msg = new StringBundler(4);
1313
1314 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1315
1316 msg.append("roleId=");
1317 msg.append(roleId);
1318
1319 msg.append(StringPool.CLOSE_CURLY_BRACE);
1320
1321 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1322 }
1323
1324
1332 @Override
1333 public UserGroupGroupRole fetchByRoleId_Last(long roleId,
1334 OrderByComparator orderByComparator) throws SystemException {
1335 int count = countByRoleId(roleId);
1336
1337 if (count == 0) {
1338 return null;
1339 }
1340
1341 List<UserGroupGroupRole> list = findByRoleId(roleId, count - 1, count,
1342 orderByComparator);
1343
1344 if (!list.isEmpty()) {
1345 return list.get(0);
1346 }
1347
1348 return null;
1349 }
1350
1351
1361 @Override
1362 public UserGroupGroupRole[] findByRoleId_PrevAndNext(
1363 UserGroupGroupRolePK userGroupGroupRolePK, long roleId,
1364 OrderByComparator orderByComparator)
1365 throws NoSuchUserGroupGroupRoleException, SystemException {
1366 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
1367
1368 Session session = null;
1369
1370 try {
1371 session = openSession();
1372
1373 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
1374
1375 array[0] = getByRoleId_PrevAndNext(session, userGroupGroupRole,
1376 roleId, orderByComparator, true);
1377
1378 array[1] = userGroupGroupRole;
1379
1380 array[2] = getByRoleId_PrevAndNext(session, userGroupGroupRole,
1381 roleId, orderByComparator, false);
1382
1383 return array;
1384 }
1385 catch (Exception e) {
1386 throw processException(e);
1387 }
1388 finally {
1389 closeSession(session);
1390 }
1391 }
1392
1393 protected UserGroupGroupRole getByRoleId_PrevAndNext(Session session,
1394 UserGroupGroupRole userGroupGroupRole, long roleId,
1395 OrderByComparator orderByComparator, boolean previous) {
1396 StringBundler query = null;
1397
1398 if (orderByComparator != null) {
1399 query = new StringBundler(6 +
1400 (orderByComparator.getOrderByFields().length * 6));
1401 }
1402 else {
1403 query = new StringBundler(3);
1404 }
1405
1406 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1407
1408 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1409
1410 if (orderByComparator != null) {
1411 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1412
1413 if (orderByConditionFields.length > 0) {
1414 query.append(WHERE_AND);
1415 }
1416
1417 for (int i = 0; i < orderByConditionFields.length; i++) {
1418 query.append(_ORDER_BY_ENTITY_ALIAS);
1419 query.append(orderByConditionFields[i]);
1420
1421 if ((i + 1) < orderByConditionFields.length) {
1422 if (orderByComparator.isAscending() ^ previous) {
1423 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1424 }
1425 else {
1426 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1427 }
1428 }
1429 else {
1430 if (orderByComparator.isAscending() ^ previous) {
1431 query.append(WHERE_GREATER_THAN);
1432 }
1433 else {
1434 query.append(WHERE_LESSER_THAN);
1435 }
1436 }
1437 }
1438
1439 query.append(ORDER_BY_CLAUSE);
1440
1441 String[] orderByFields = orderByComparator.getOrderByFields();
1442
1443 for (int i = 0; i < orderByFields.length; i++) {
1444 query.append(_ORDER_BY_ENTITY_ALIAS);
1445 query.append(orderByFields[i]);
1446
1447 if ((i + 1) < orderByFields.length) {
1448 if (orderByComparator.isAscending() ^ previous) {
1449 query.append(ORDER_BY_ASC_HAS_NEXT);
1450 }
1451 else {
1452 query.append(ORDER_BY_DESC_HAS_NEXT);
1453 }
1454 }
1455 else {
1456 if (orderByComparator.isAscending() ^ previous) {
1457 query.append(ORDER_BY_ASC);
1458 }
1459 else {
1460 query.append(ORDER_BY_DESC);
1461 }
1462 }
1463 }
1464 }
1465 else {
1466 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
1467 }
1468
1469 String sql = query.toString();
1470
1471 Query q = session.createQuery(sql);
1472
1473 q.setFirstResult(0);
1474 q.setMaxResults(2);
1475
1476 QueryPos qPos = QueryPos.getInstance(q);
1477
1478 qPos.add(roleId);
1479
1480 if (orderByComparator != null) {
1481 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
1482
1483 for (Object value : values) {
1484 qPos.add(value);
1485 }
1486 }
1487
1488 List<UserGroupGroupRole> list = q.list();
1489
1490 if (list.size() == 2) {
1491 return list.get(1);
1492 }
1493 else {
1494 return null;
1495 }
1496 }
1497
1498
1504 @Override
1505 public void removeByRoleId(long roleId) throws SystemException {
1506 for (UserGroupGroupRole userGroupGroupRole : findByRoleId(roleId,
1507 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1508 remove(userGroupGroupRole);
1509 }
1510 }
1511
1512
1519 @Override
1520 public int countByRoleId(long roleId) throws SystemException {
1521 FinderPath finderPath = FINDER_PATH_COUNT_BY_ROLEID;
1522
1523 Object[] finderArgs = new Object[] { roleId };
1524
1525 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1526 this);
1527
1528 if (count == null) {
1529 StringBundler query = new StringBundler(2);
1530
1531 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
1532
1533 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1534
1535 String sql = query.toString();
1536
1537 Session session = null;
1538
1539 try {
1540 session = openSession();
1541
1542 Query q = session.createQuery(sql);
1543
1544 QueryPos qPos = QueryPos.getInstance(q);
1545
1546 qPos.add(roleId);
1547
1548 count = (Long)q.uniqueResult();
1549
1550 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1551 }
1552 catch (Exception e) {
1553 FinderCacheUtil.removeResult(finderPath, finderArgs);
1554
1555 throw processException(e);
1556 }
1557 finally {
1558 closeSession(session);
1559 }
1560 }
1561
1562 return count.intValue();
1563 }
1564
1565 private static final String _FINDER_COLUMN_ROLEID_ROLEID_2 = "userGroupGroupRole.id.roleId = ?";
1566 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1567 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
1568 UserGroupGroupRoleImpl.class,
1569 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByU_G",
1570 new String[] {
1571 Long.class.getName(), Long.class.getName(),
1572
1573 Integer.class.getName(), Integer.class.getName(),
1574 OrderByComparator.class.getName()
1575 });
1576 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1577 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
1578 UserGroupGroupRoleImpl.class,
1579 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByU_G",
1580 new String[] { Long.class.getName(), Long.class.getName() },
1581 UserGroupGroupRoleModelImpl.USERGROUPID_COLUMN_BITMASK |
1582 UserGroupGroupRoleModelImpl.GROUPID_COLUMN_BITMASK);
1583 public static final FinderPath FINDER_PATH_COUNT_BY_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1584 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
1585 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByU_G",
1586 new String[] { Long.class.getName(), Long.class.getName() });
1587
1588
1596 @Override
1597 public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId)
1598 throws SystemException {
1599 return findByU_G(userGroupId, groupId, QueryUtil.ALL_POS,
1600 QueryUtil.ALL_POS, null);
1601 }
1602
1603
1617 @Override
1618 public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId,
1619 int start, int end) throws SystemException {
1620 return findByU_G(userGroupId, groupId, start, end, null);
1621 }
1622
1623
1638 @Override
1639 public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId,
1640 int start, int end, OrderByComparator orderByComparator)
1641 throws SystemException {
1642 boolean pagination = true;
1643 FinderPath finderPath = null;
1644 Object[] finderArgs = null;
1645
1646 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1647 (orderByComparator == null)) {
1648 pagination = false;
1649 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G;
1650 finderArgs = new Object[] { userGroupId, groupId };
1651 }
1652 else {
1653 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_U_G;
1654 finderArgs = new Object[] {
1655 userGroupId, groupId,
1656
1657 start, end, orderByComparator
1658 };
1659 }
1660
1661 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
1662 finderArgs, this);
1663
1664 if ((list != null) && !list.isEmpty()) {
1665 for (UserGroupGroupRole userGroupGroupRole : list) {
1666 if ((userGroupId != userGroupGroupRole.getUserGroupId()) ||
1667 (groupId != userGroupGroupRole.getGroupId())) {
1668 list = null;
1669
1670 break;
1671 }
1672 }
1673 }
1674
1675 if (list == null) {
1676 StringBundler query = null;
1677
1678 if (orderByComparator != null) {
1679 query = new StringBundler(4 +
1680 (orderByComparator.getOrderByFields().length * 3));
1681 }
1682 else {
1683 query = new StringBundler(4);
1684 }
1685
1686 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1687
1688 query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
1689
1690 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1691
1692 if (orderByComparator != null) {
1693 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1694 orderByComparator);
1695 }
1696 else
1697 if (pagination) {
1698 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
1699 }
1700
1701 String sql = query.toString();
1702
1703 Session session = null;
1704
1705 try {
1706 session = openSession();
1707
1708 Query q = session.createQuery(sql);
1709
1710 QueryPos qPos = QueryPos.getInstance(q);
1711
1712 qPos.add(userGroupId);
1713
1714 qPos.add(groupId);
1715
1716 if (!pagination) {
1717 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1718 getDialect(), start, end, false);
1719
1720 Collections.sort(list);
1721
1722 list = new UnmodifiableList<UserGroupGroupRole>(list);
1723 }
1724 else {
1725 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1726 getDialect(), start, end);
1727 }
1728
1729 cacheResult(list);
1730
1731 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1732 }
1733 catch (Exception e) {
1734 FinderCacheUtil.removeResult(finderPath, finderArgs);
1735
1736 throw processException(e);
1737 }
1738 finally {
1739 closeSession(session);
1740 }
1741 }
1742
1743 return list;
1744 }
1745
1746
1756 @Override
1757 public UserGroupGroupRole findByU_G_First(long userGroupId, long groupId,
1758 OrderByComparator orderByComparator)
1759 throws NoSuchUserGroupGroupRoleException, SystemException {
1760 UserGroupGroupRole userGroupGroupRole = fetchByU_G_First(userGroupId,
1761 groupId, orderByComparator);
1762
1763 if (userGroupGroupRole != null) {
1764 return userGroupGroupRole;
1765 }
1766
1767 StringBundler msg = new StringBundler(6);
1768
1769 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1770
1771 msg.append("userGroupId=");
1772 msg.append(userGroupId);
1773
1774 msg.append(", groupId=");
1775 msg.append(groupId);
1776
1777 msg.append(StringPool.CLOSE_CURLY_BRACE);
1778
1779 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1780 }
1781
1782
1791 @Override
1792 public UserGroupGroupRole fetchByU_G_First(long userGroupId, long groupId,
1793 OrderByComparator orderByComparator) throws SystemException {
1794 List<UserGroupGroupRole> list = findByU_G(userGroupId, groupId, 0, 1,
1795 orderByComparator);
1796
1797 if (!list.isEmpty()) {
1798 return list.get(0);
1799 }
1800
1801 return null;
1802 }
1803
1804
1814 @Override
1815 public UserGroupGroupRole findByU_G_Last(long userGroupId, long groupId,
1816 OrderByComparator orderByComparator)
1817 throws NoSuchUserGroupGroupRoleException, SystemException {
1818 UserGroupGroupRole userGroupGroupRole = fetchByU_G_Last(userGroupId,
1819 groupId, orderByComparator);
1820
1821 if (userGroupGroupRole != null) {
1822 return userGroupGroupRole;
1823 }
1824
1825 StringBundler msg = new StringBundler(6);
1826
1827 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1828
1829 msg.append("userGroupId=");
1830 msg.append(userGroupId);
1831
1832 msg.append(", groupId=");
1833 msg.append(groupId);
1834
1835 msg.append(StringPool.CLOSE_CURLY_BRACE);
1836
1837 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1838 }
1839
1840
1849 @Override
1850 public UserGroupGroupRole fetchByU_G_Last(long userGroupId, long groupId,
1851 OrderByComparator orderByComparator) throws SystemException {
1852 int count = countByU_G(userGroupId, groupId);
1853
1854 if (count == 0) {
1855 return null;
1856 }
1857
1858 List<UserGroupGroupRole> list = findByU_G(userGroupId, groupId,
1859 count - 1, count, orderByComparator);
1860
1861 if (!list.isEmpty()) {
1862 return list.get(0);
1863 }
1864
1865 return null;
1866 }
1867
1868
1879 @Override
1880 public UserGroupGroupRole[] findByU_G_PrevAndNext(
1881 UserGroupGroupRolePK userGroupGroupRolePK, long userGroupId,
1882 long groupId, OrderByComparator orderByComparator)
1883 throws NoSuchUserGroupGroupRoleException, SystemException {
1884 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
1885
1886 Session session = null;
1887
1888 try {
1889 session = openSession();
1890
1891 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
1892
1893 array[0] = getByU_G_PrevAndNext(session, userGroupGroupRole,
1894 userGroupId, groupId, orderByComparator, true);
1895
1896 array[1] = userGroupGroupRole;
1897
1898 array[2] = getByU_G_PrevAndNext(session, userGroupGroupRole,
1899 userGroupId, groupId, orderByComparator, false);
1900
1901 return array;
1902 }
1903 catch (Exception e) {
1904 throw processException(e);
1905 }
1906 finally {
1907 closeSession(session);
1908 }
1909 }
1910
1911 protected UserGroupGroupRole getByU_G_PrevAndNext(Session session,
1912 UserGroupGroupRole userGroupGroupRole, long userGroupId, long groupId,
1913 OrderByComparator orderByComparator, boolean previous) {
1914 StringBundler query = null;
1915
1916 if (orderByComparator != null) {
1917 query = new StringBundler(6 +
1918 (orderByComparator.getOrderByFields().length * 6));
1919 }
1920 else {
1921 query = new StringBundler(3);
1922 }
1923
1924 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1925
1926 query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
1927
1928 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1929
1930 if (orderByComparator != null) {
1931 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1932
1933 if (orderByConditionFields.length > 0) {
1934 query.append(WHERE_AND);
1935 }
1936
1937 for (int i = 0; i < orderByConditionFields.length; i++) {
1938 query.append(_ORDER_BY_ENTITY_ALIAS);
1939 query.append(orderByConditionFields[i]);
1940
1941 if ((i + 1) < orderByConditionFields.length) {
1942 if (orderByComparator.isAscending() ^ previous) {
1943 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1944 }
1945 else {
1946 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1947 }
1948 }
1949 else {
1950 if (orderByComparator.isAscending() ^ previous) {
1951 query.append(WHERE_GREATER_THAN);
1952 }
1953 else {
1954 query.append(WHERE_LESSER_THAN);
1955 }
1956 }
1957 }
1958
1959 query.append(ORDER_BY_CLAUSE);
1960
1961 String[] orderByFields = orderByComparator.getOrderByFields();
1962
1963 for (int i = 0; i < orderByFields.length; i++) {
1964 query.append(_ORDER_BY_ENTITY_ALIAS);
1965 query.append(orderByFields[i]);
1966
1967 if ((i + 1) < orderByFields.length) {
1968 if (orderByComparator.isAscending() ^ previous) {
1969 query.append(ORDER_BY_ASC_HAS_NEXT);
1970 }
1971 else {
1972 query.append(ORDER_BY_DESC_HAS_NEXT);
1973 }
1974 }
1975 else {
1976 if (orderByComparator.isAscending() ^ previous) {
1977 query.append(ORDER_BY_ASC);
1978 }
1979 else {
1980 query.append(ORDER_BY_DESC);
1981 }
1982 }
1983 }
1984 }
1985 else {
1986 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
1987 }
1988
1989 String sql = query.toString();
1990
1991 Query q = session.createQuery(sql);
1992
1993 q.setFirstResult(0);
1994 q.setMaxResults(2);
1995
1996 QueryPos qPos = QueryPos.getInstance(q);
1997
1998 qPos.add(userGroupId);
1999
2000 qPos.add(groupId);
2001
2002 if (orderByComparator != null) {
2003 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
2004
2005 for (Object value : values) {
2006 qPos.add(value);
2007 }
2008 }
2009
2010 List<UserGroupGroupRole> list = q.list();
2011
2012 if (list.size() == 2) {
2013 return list.get(1);
2014 }
2015 else {
2016 return null;
2017 }
2018 }
2019
2020
2027 @Override
2028 public void removeByU_G(long userGroupId, long groupId)
2029 throws SystemException {
2030 for (UserGroupGroupRole userGroupGroupRole : findByU_G(userGroupId,
2031 groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
2032 remove(userGroupGroupRole);
2033 }
2034 }
2035
2036
2044 @Override
2045 public int countByU_G(long userGroupId, long groupId)
2046 throws SystemException {
2047 FinderPath finderPath = FINDER_PATH_COUNT_BY_U_G;
2048
2049 Object[] finderArgs = new Object[] { userGroupId, groupId };
2050
2051 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
2052 this);
2053
2054 if (count == null) {
2055 StringBundler query = new StringBundler(3);
2056
2057 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
2058
2059 query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
2060
2061 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
2062
2063 String sql = query.toString();
2064
2065 Session session = null;
2066
2067 try {
2068 session = openSession();
2069
2070 Query q = session.createQuery(sql);
2071
2072 QueryPos qPos = QueryPos.getInstance(q);
2073
2074 qPos.add(userGroupId);
2075
2076 qPos.add(groupId);
2077
2078 count = (Long)q.uniqueResult();
2079
2080 FinderCacheUtil.putResult(finderPath, finderArgs, count);
2081 }
2082 catch (Exception e) {
2083 FinderCacheUtil.removeResult(finderPath, finderArgs);
2084
2085 throw processException(e);
2086 }
2087 finally {
2088 closeSession(session);
2089 }
2090 }
2091
2092 return count.intValue();
2093 }
2094
2095 private static final String _FINDER_COLUMN_U_G_USERGROUPID_2 = "userGroupGroupRole.id.userGroupId = ? AND ";
2096 private static final String _FINDER_COLUMN_U_G_GROUPID_2 = "userGroupGroupRole.id.groupId = ?";
2097 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
2098 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
2099 UserGroupGroupRoleImpl.class,
2100 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_R",
2101 new String[] {
2102 Long.class.getName(), Long.class.getName(),
2103
2104 Integer.class.getName(), Integer.class.getName(),
2105 OrderByComparator.class.getName()
2106 });
2107 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
2108 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
2109 UserGroupGroupRoleImpl.class,
2110 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_R",
2111 new String[] { Long.class.getName(), Long.class.getName() },
2112 UserGroupGroupRoleModelImpl.GROUPID_COLUMN_BITMASK |
2113 UserGroupGroupRoleModelImpl.ROLEID_COLUMN_BITMASK);
2114 public static final FinderPath FINDER_PATH_COUNT_BY_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
2115 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
2116 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_R",
2117 new String[] { Long.class.getName(), Long.class.getName() });
2118
2119
2127 @Override
2128 public List<UserGroupGroupRole> findByG_R(long groupId, long roleId)
2129 throws SystemException {
2130 return findByG_R(groupId, roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2131 null);
2132 }
2133
2134
2148 @Override
2149 public List<UserGroupGroupRole> findByG_R(long groupId, long roleId,
2150 int start, int end) throws SystemException {
2151 return findByG_R(groupId, roleId, start, end, null);
2152 }
2153
2154
2169 @Override
2170 public List<UserGroupGroupRole> findByG_R(long groupId, long roleId,
2171 int start, int end, OrderByComparator orderByComparator)
2172 throws SystemException {
2173 boolean pagination = true;
2174 FinderPath finderPath = null;
2175 Object[] finderArgs = null;
2176
2177 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2178 (orderByComparator == null)) {
2179 pagination = false;
2180 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R;
2181 finderArgs = new Object[] { groupId, roleId };
2182 }
2183 else {
2184 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_R;
2185 finderArgs = new Object[] {
2186 groupId, roleId,
2187
2188 start, end, orderByComparator
2189 };
2190 }
2191
2192 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
2193 finderArgs, this);
2194
2195 if ((list != null) && !list.isEmpty()) {
2196 for (UserGroupGroupRole userGroupGroupRole : list) {
2197 if ((groupId != userGroupGroupRole.getGroupId()) ||
2198 (roleId != userGroupGroupRole.getRoleId())) {
2199 list = null;
2200
2201 break;
2202 }
2203 }
2204 }
2205
2206 if (list == null) {
2207 StringBundler query = null;
2208
2209 if (orderByComparator != null) {
2210 query = new StringBundler(4 +
2211 (orderByComparator.getOrderByFields().length * 3));
2212 }
2213 else {
2214 query = new StringBundler(4);
2215 }
2216
2217 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
2218
2219 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2220
2221 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2222
2223 if (orderByComparator != null) {
2224 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2225 orderByComparator);
2226 }
2227 else
2228 if (pagination) {
2229 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
2230 }
2231
2232 String sql = query.toString();
2233
2234 Session session = null;
2235
2236 try {
2237 session = openSession();
2238
2239 Query q = session.createQuery(sql);
2240
2241 QueryPos qPos = QueryPos.getInstance(q);
2242
2243 qPos.add(groupId);
2244
2245 qPos.add(roleId);
2246
2247 if (!pagination) {
2248 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
2249 getDialect(), start, end, false);
2250
2251 Collections.sort(list);
2252
2253 list = new UnmodifiableList<UserGroupGroupRole>(list);
2254 }
2255 else {
2256 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
2257 getDialect(), start, end);
2258 }
2259
2260 cacheResult(list);
2261
2262 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2263 }
2264 catch (Exception e) {
2265 FinderCacheUtil.removeResult(finderPath, finderArgs);
2266
2267 throw processException(e);
2268 }
2269 finally {
2270 closeSession(session);
2271 }
2272 }
2273
2274 return list;
2275 }
2276
2277
2287 @Override
2288 public UserGroupGroupRole findByG_R_First(long groupId, long roleId,
2289 OrderByComparator orderByComparator)
2290 throws NoSuchUserGroupGroupRoleException, SystemException {
2291 UserGroupGroupRole userGroupGroupRole = fetchByG_R_First(groupId,
2292 roleId, orderByComparator);
2293
2294 if (userGroupGroupRole != null) {
2295 return userGroupGroupRole;
2296 }
2297
2298 StringBundler msg = new StringBundler(6);
2299
2300 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2301
2302 msg.append("groupId=");
2303 msg.append(groupId);
2304
2305 msg.append(", roleId=");
2306 msg.append(roleId);
2307
2308 msg.append(StringPool.CLOSE_CURLY_BRACE);
2309
2310 throw new NoSuchUserGroupGroupRoleException(msg.toString());
2311 }
2312
2313
2322 @Override
2323 public UserGroupGroupRole fetchByG_R_First(long groupId, long roleId,
2324 OrderByComparator orderByComparator) throws SystemException {
2325 List<UserGroupGroupRole> list = findByG_R(groupId, roleId, 0, 1,
2326 orderByComparator);
2327
2328 if (!list.isEmpty()) {
2329 return list.get(0);
2330 }
2331
2332 return null;
2333 }
2334
2335
2345 @Override
2346 public UserGroupGroupRole findByG_R_Last(long groupId, long roleId,
2347 OrderByComparator orderByComparator)
2348 throws NoSuchUserGroupGroupRoleException, SystemException {
2349 UserGroupGroupRole userGroupGroupRole = fetchByG_R_Last(groupId,
2350 roleId, orderByComparator);
2351
2352 if (userGroupGroupRole != null) {
2353 return userGroupGroupRole;
2354 }
2355
2356 StringBundler msg = new StringBundler(6);
2357
2358 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2359
2360 msg.append("groupId=");
2361 msg.append(groupId);
2362
2363 msg.append(", roleId=");
2364 msg.append(roleId);
2365
2366 msg.append(StringPool.CLOSE_CURLY_BRACE);
2367
2368 throw new NoSuchUserGroupGroupRoleException(msg.toString());
2369 }
2370
2371
2380 @Override
2381 public UserGroupGroupRole fetchByG_R_Last(long groupId, long roleId,
2382 OrderByComparator orderByComparator) throws SystemException {
2383 int count = countByG_R(groupId, roleId);
2384
2385 if (count == 0) {
2386 return null;
2387 }
2388
2389 List<UserGroupGroupRole> list = findByG_R(groupId, roleId, count - 1,
2390 count, orderByComparator);
2391
2392 if (!list.isEmpty()) {
2393 return list.get(0);
2394 }
2395
2396 return null;
2397 }
2398
2399
2410 @Override
2411 public UserGroupGroupRole[] findByG_R_PrevAndNext(
2412 UserGroupGroupRolePK userGroupGroupRolePK, long groupId, long roleId,
2413 OrderByComparator orderByComparator)
2414 throws NoSuchUserGroupGroupRoleException, SystemException {
2415 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
2416
2417 Session session = null;
2418
2419 try {
2420 session = openSession();
2421
2422 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
2423
2424 array[0] = getByG_R_PrevAndNext(session, userGroupGroupRole,
2425 groupId, roleId, orderByComparator, true);
2426
2427 array[1] = userGroupGroupRole;
2428
2429 array[2] = getByG_R_PrevAndNext(session, userGroupGroupRole,
2430 groupId, roleId, orderByComparator, false);
2431
2432 return array;
2433 }
2434 catch (Exception e) {
2435 throw processException(e);
2436 }
2437 finally {
2438 closeSession(session);
2439 }
2440 }
2441
2442 protected UserGroupGroupRole getByG_R_PrevAndNext(Session session,
2443 UserGroupGroupRole userGroupGroupRole, long groupId, long roleId,
2444 OrderByComparator orderByComparator, boolean previous) {
2445 StringBundler query = null;
2446
2447 if (orderByComparator != null) {
2448 query = new StringBundler(6 +
2449 (orderByComparator.getOrderByFields().length * 6));
2450 }
2451 else {
2452 query = new StringBundler(3);
2453 }
2454
2455 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
2456
2457 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2458
2459 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2460
2461 if (orderByComparator != null) {
2462 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2463
2464 if (orderByConditionFields.length > 0) {
2465 query.append(WHERE_AND);
2466 }
2467
2468 for (int i = 0; i < orderByConditionFields.length; i++) {
2469 query.append(_ORDER_BY_ENTITY_ALIAS);
2470 query.append(orderByConditionFields[i]);
2471
2472 if ((i + 1) < orderByConditionFields.length) {
2473 if (orderByComparator.isAscending() ^ previous) {
2474 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2475 }
2476 else {
2477 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2478 }
2479 }
2480 else {
2481 if (orderByComparator.isAscending() ^ previous) {
2482 query.append(WHERE_GREATER_THAN);
2483 }
2484 else {
2485 query.append(WHERE_LESSER_THAN);
2486 }
2487 }
2488 }
2489
2490 query.append(ORDER_BY_CLAUSE);
2491
2492 String[] orderByFields = orderByComparator.getOrderByFields();
2493
2494 for (int i = 0; i < orderByFields.length; i++) {
2495 query.append(_ORDER_BY_ENTITY_ALIAS);
2496 query.append(orderByFields[i]);
2497
2498 if ((i + 1) < orderByFields.length) {
2499 if (orderByComparator.isAscending() ^ previous) {
2500 query.append(ORDER_BY_ASC_HAS_NEXT);
2501 }
2502 else {
2503 query.append(ORDER_BY_DESC_HAS_NEXT);
2504 }
2505 }
2506 else {
2507 if (orderByComparator.isAscending() ^ previous) {
2508 query.append(ORDER_BY_ASC);
2509 }
2510 else {
2511 query.append(ORDER_BY_DESC);
2512 }
2513 }
2514 }
2515 }
2516 else {
2517 query.append(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
2518 }
2519
2520 String sql = query.toString();
2521
2522 Query q = session.createQuery(sql);
2523
2524 q.setFirstResult(0);
2525 q.setMaxResults(2);
2526
2527 QueryPos qPos = QueryPos.getInstance(q);
2528
2529 qPos.add(groupId);
2530
2531 qPos.add(roleId);
2532
2533 if (orderByComparator != null) {
2534 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
2535
2536 for (Object value : values) {
2537 qPos.add(value);
2538 }
2539 }
2540
2541 List<UserGroupGroupRole> list = q.list();
2542
2543 if (list.size() == 2) {
2544 return list.get(1);
2545 }
2546 else {
2547 return null;
2548 }
2549 }
2550
2551
2558 @Override
2559 public void removeByG_R(long groupId, long roleId)
2560 throws SystemException {
2561 for (UserGroupGroupRole userGroupGroupRole : findByG_R(groupId, roleId,
2562 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
2563 remove(userGroupGroupRole);
2564 }
2565 }
2566
2567
2575 @Override
2576 public int countByG_R(long groupId, long roleId) throws SystemException {
2577 FinderPath finderPath = FINDER_PATH_COUNT_BY_G_R;
2578
2579 Object[] finderArgs = new Object[] { groupId, roleId };
2580
2581 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
2582 this);
2583
2584 if (count == null) {
2585 StringBundler query = new StringBundler(3);
2586
2587 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
2588
2589 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2590
2591 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2592
2593 String sql = query.toString();
2594
2595 Session session = null;
2596
2597 try {
2598 session = openSession();
2599
2600 Query q = session.createQuery(sql);
2601
2602 QueryPos qPos = QueryPos.getInstance(q);
2603
2604 qPos.add(groupId);
2605
2606 qPos.add(roleId);
2607
2608 count = (Long)q.uniqueResult();
2609
2610 FinderCacheUtil.putResult(finderPath, finderArgs, count);
2611 }
2612 catch (Exception e) {
2613 FinderCacheUtil.removeResult(finderPath, finderArgs);
2614
2615 throw processException(e);
2616 }
2617 finally {
2618 closeSession(session);
2619 }
2620 }
2621
2622 return count.intValue();
2623 }
2624
2625 private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "userGroupGroupRole.id.groupId = ? AND ";
2626 private static final String _FINDER_COLUMN_G_R_ROLEID_2 = "userGroupGroupRole.id.roleId = ?";
2627
2628 public UserGroupGroupRolePersistenceImpl() {
2629 setModelClass(UserGroupGroupRole.class);
2630 }
2631
2632
2637 @Override
2638 public void cacheResult(UserGroupGroupRole userGroupGroupRole) {
2639 EntityCacheUtil.putResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
2640 UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey(),
2641 userGroupGroupRole);
2642
2643 userGroupGroupRole.resetOriginalValues();
2644 }
2645
2646
2651 @Override
2652 public void cacheResult(List<UserGroupGroupRole> userGroupGroupRoles) {
2653 for (UserGroupGroupRole userGroupGroupRole : userGroupGroupRoles) {
2654 if (EntityCacheUtil.getResult(
2655 UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
2656 UserGroupGroupRoleImpl.class,
2657 userGroupGroupRole.getPrimaryKey()) == null) {
2658 cacheResult(userGroupGroupRole);
2659 }
2660 else {
2661 userGroupGroupRole.resetOriginalValues();
2662 }
2663 }
2664 }
2665
2666
2673 @Override
2674 public void clearCache() {
2675 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
2676 CacheRegistryUtil.clear(UserGroupGroupRoleImpl.class.getName());
2677 }
2678
2679 EntityCacheUtil.clearCache(UserGroupGroupRoleImpl.class.getName());
2680
2681 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
2682 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2683 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2684 }
2685
2686
2693 @Override
2694 public void clearCache(UserGroupGroupRole userGroupGroupRole) {
2695 EntityCacheUtil.removeResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
2696 UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey());
2697
2698 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2699 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2700 }
2701
2702 @Override
2703 public void clearCache(List<UserGroupGroupRole> userGroupGroupRoles) {
2704 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2705 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2706
2707 for (UserGroupGroupRole userGroupGroupRole : userGroupGroupRoles) {
2708 EntityCacheUtil.removeResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
2709 UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey());
2710 }
2711 }
2712
2713
2719 @Override
2720 public UserGroupGroupRole create(UserGroupGroupRolePK userGroupGroupRolePK) {
2721 UserGroupGroupRole userGroupGroupRole = new UserGroupGroupRoleImpl();
2722
2723 userGroupGroupRole.setNew(true);
2724 userGroupGroupRole.setPrimaryKey(userGroupGroupRolePK);
2725
2726 return userGroupGroupRole;
2727 }
2728
2729
2737 @Override
2738 public UserGroupGroupRole remove(UserGroupGroupRolePK userGroupGroupRolePK)
2739 throws NoSuchUserGroupGroupRoleException, SystemException {
2740 return remove((Serializable)userGroupGroupRolePK);
2741 }
2742
2743
2751 @Override
2752 public UserGroupGroupRole remove(Serializable primaryKey)
2753 throws NoSuchUserGroupGroupRoleException, SystemException {
2754 Session session = null;
2755
2756 try {
2757 session = openSession();
2758
2759 UserGroupGroupRole userGroupGroupRole = (UserGroupGroupRole)session.get(UserGroupGroupRoleImpl.class,
2760 primaryKey);
2761
2762 if (userGroupGroupRole == null) {
2763 if (_log.isWarnEnabled()) {
2764 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2765 }
2766
2767 throw new NoSuchUserGroupGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2768 primaryKey);
2769 }
2770
2771 return remove(userGroupGroupRole);
2772 }
2773 catch (NoSuchUserGroupGroupRoleException nsee) {
2774 throw nsee;
2775 }
2776 catch (Exception e) {
2777 throw processException(e);
2778 }
2779 finally {
2780 closeSession(session);
2781 }
2782 }
2783
2784 @Override
2785 protected UserGroupGroupRole removeImpl(
2786 UserGroupGroupRole userGroupGroupRole) throws SystemException {
2787 userGroupGroupRole = toUnwrappedModel(userGroupGroupRole);
2788
2789 Session session = null;
2790
2791 try {
2792 session = openSession();
2793
2794 if (!session.contains(userGroupGroupRole)) {
2795 userGroupGroupRole = (UserGroupGroupRole)session.get(UserGroupGroupRoleImpl.class,
2796 userGroupGroupRole.getPrimaryKeyObj());
2797 }
2798
2799 if (userGroupGroupRole != null) {
2800 session.delete(userGroupGroupRole);
2801 }
2802 }
2803 catch (Exception e) {
2804 throw processException(e);
2805 }
2806 finally {
2807 closeSession(session);
2808 }
2809
2810 if (userGroupGroupRole != null) {
2811 clearCache(userGroupGroupRole);
2812 }
2813
2814 return userGroupGroupRole;
2815 }
2816
2817 @Override
2818 public UserGroupGroupRole updateImpl(
2819 com.liferay.portal.model.UserGroupGroupRole userGroupGroupRole)
2820 throws SystemException {
2821 userGroupGroupRole = toUnwrappedModel(userGroupGroupRole);
2822
2823 boolean isNew = userGroupGroupRole.isNew();
2824
2825 UserGroupGroupRoleModelImpl userGroupGroupRoleModelImpl = (UserGroupGroupRoleModelImpl)userGroupGroupRole;
2826
2827 Session session = null;
2828
2829 try {
2830 session = openSession();
2831
2832 if (userGroupGroupRole.isNew()) {
2833 session.save(userGroupGroupRole);
2834
2835 userGroupGroupRole.setNew(false);
2836 }
2837 else {
2838 session.merge(userGroupGroupRole);
2839 }
2840 }
2841 catch (Exception e) {
2842 throw processException(e);
2843 }
2844 finally {
2845 closeSession(session);
2846 }
2847
2848 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2849
2850 if (isNew || !UserGroupGroupRoleModelImpl.COLUMN_BITMASK_ENABLED) {
2851 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2852 }
2853
2854 else {
2855 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
2856 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID.getColumnBitmask()) != 0) {
2857 Object[] args = new Object[] {
2858 userGroupGroupRoleModelImpl.getOriginalUserGroupId()
2859 };
2860
2861 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERGROUPID,
2862 args);
2863 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID,
2864 args);
2865
2866 args = new Object[] { userGroupGroupRoleModelImpl.getUserGroupId() };
2867
2868 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERGROUPID,
2869 args);
2870 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID,
2871 args);
2872 }
2873
2874 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
2875 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
2876 Object[] args = new Object[] {
2877 userGroupGroupRoleModelImpl.getOriginalGroupId()
2878 };
2879
2880 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
2881 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
2882 args);
2883
2884 args = new Object[] { userGroupGroupRoleModelImpl.getGroupId() };
2885
2886 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
2887 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
2888 args);
2889 }
2890
2891 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
2892 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID.getColumnBitmask()) != 0) {
2893 Object[] args = new Object[] {
2894 userGroupGroupRoleModelImpl.getOriginalRoleId()
2895 };
2896
2897 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ROLEID, args);
2898 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID,
2899 args);
2900
2901 args = new Object[] { userGroupGroupRoleModelImpl.getRoleId() };
2902
2903 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ROLEID, args);
2904 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID,
2905 args);
2906 }
2907
2908 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
2909 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G.getColumnBitmask()) != 0) {
2910 Object[] args = new Object[] {
2911 userGroupGroupRoleModelImpl.getOriginalUserGroupId(),
2912 userGroupGroupRoleModelImpl.getOriginalGroupId()
2913 };
2914
2915 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_G, args);
2916 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G,
2917 args);
2918
2919 args = new Object[] {
2920 userGroupGroupRoleModelImpl.getUserGroupId(),
2921 userGroupGroupRoleModelImpl.getGroupId()
2922 };
2923
2924 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_G, args);
2925 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G,
2926 args);
2927 }
2928
2929 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
2930 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R.getColumnBitmask()) != 0) {
2931 Object[] args = new Object[] {
2932 userGroupGroupRoleModelImpl.getOriginalGroupId(),
2933 userGroupGroupRoleModelImpl.getOriginalRoleId()
2934 };
2935
2936 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_R, args);
2937 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R,
2938 args);
2939
2940 args = new Object[] {
2941 userGroupGroupRoleModelImpl.getGroupId(),
2942 userGroupGroupRoleModelImpl.getRoleId()
2943 };
2944
2945 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_R, args);
2946 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R,
2947 args);
2948 }
2949 }
2950
2951 EntityCacheUtil.putResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
2952 UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey(),
2953 userGroupGroupRole);
2954
2955 return userGroupGroupRole;
2956 }
2957
2958 protected UserGroupGroupRole toUnwrappedModel(
2959 UserGroupGroupRole userGroupGroupRole) {
2960 if (userGroupGroupRole instanceof UserGroupGroupRoleImpl) {
2961 return userGroupGroupRole;
2962 }
2963
2964 UserGroupGroupRoleImpl userGroupGroupRoleImpl = new UserGroupGroupRoleImpl();
2965
2966 userGroupGroupRoleImpl.setNew(userGroupGroupRole.isNew());
2967 userGroupGroupRoleImpl.setPrimaryKey(userGroupGroupRole.getPrimaryKey());
2968
2969 userGroupGroupRoleImpl.setUserGroupId(userGroupGroupRole.getUserGroupId());
2970 userGroupGroupRoleImpl.setGroupId(userGroupGroupRole.getGroupId());
2971 userGroupGroupRoleImpl.setRoleId(userGroupGroupRole.getRoleId());
2972
2973 return userGroupGroupRoleImpl;
2974 }
2975
2976
2984 @Override
2985 public UserGroupGroupRole findByPrimaryKey(Serializable primaryKey)
2986 throws NoSuchUserGroupGroupRoleException, SystemException {
2987 UserGroupGroupRole userGroupGroupRole = fetchByPrimaryKey(primaryKey);
2988
2989 if (userGroupGroupRole == null) {
2990 if (_log.isWarnEnabled()) {
2991 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2992 }
2993
2994 throw new NoSuchUserGroupGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2995 primaryKey);
2996 }
2997
2998 return userGroupGroupRole;
2999 }
3000
3001
3009 @Override
3010 public UserGroupGroupRole findByPrimaryKey(
3011 UserGroupGroupRolePK userGroupGroupRolePK)
3012 throws NoSuchUserGroupGroupRoleException, SystemException {
3013 return findByPrimaryKey((Serializable)userGroupGroupRolePK);
3014 }
3015
3016
3023 @Override
3024 public UserGroupGroupRole fetchByPrimaryKey(Serializable primaryKey)
3025 throws SystemException {
3026 UserGroupGroupRole userGroupGroupRole = (UserGroupGroupRole)EntityCacheUtil.getResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
3027 UserGroupGroupRoleImpl.class, primaryKey);
3028
3029 if (userGroupGroupRole == _nullUserGroupGroupRole) {
3030 return null;
3031 }
3032
3033 if (userGroupGroupRole == null) {
3034 Session session = null;
3035
3036 try {
3037 session = openSession();
3038
3039 userGroupGroupRole = (UserGroupGroupRole)session.get(UserGroupGroupRoleImpl.class,
3040 primaryKey);
3041
3042 if (userGroupGroupRole != null) {
3043 cacheResult(userGroupGroupRole);
3044 }
3045 else {
3046 EntityCacheUtil.putResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
3047 UserGroupGroupRoleImpl.class, primaryKey,
3048 _nullUserGroupGroupRole);
3049 }
3050 }
3051 catch (Exception e) {
3052 EntityCacheUtil.removeResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
3053 UserGroupGroupRoleImpl.class, primaryKey);
3054
3055 throw processException(e);
3056 }
3057 finally {
3058 closeSession(session);
3059 }
3060 }
3061
3062 return userGroupGroupRole;
3063 }
3064
3065
3072 @Override
3073 public UserGroupGroupRole fetchByPrimaryKey(
3074 UserGroupGroupRolePK userGroupGroupRolePK) throws SystemException {
3075 return fetchByPrimaryKey((Serializable)userGroupGroupRolePK);
3076 }
3077
3078
3084 @Override
3085 public List<UserGroupGroupRole> findAll() throws SystemException {
3086 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3087 }
3088
3089
3101 @Override
3102 public List<UserGroupGroupRole> findAll(int start, int end)
3103 throws SystemException {
3104 return findAll(start, end, null);
3105 }
3106
3107
3120 @Override
3121 public List<UserGroupGroupRole> findAll(int start, int end,
3122 OrderByComparator orderByComparator) throws SystemException {
3123 boolean pagination = true;
3124 FinderPath finderPath = null;
3125 Object[] finderArgs = null;
3126
3127 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3128 (orderByComparator == null)) {
3129 pagination = false;
3130 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
3131 finderArgs = FINDER_ARGS_EMPTY;
3132 }
3133 else {
3134 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
3135 finderArgs = new Object[] { start, end, orderByComparator };
3136 }
3137
3138 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
3139 finderArgs, this);
3140
3141 if (list == null) {
3142 StringBundler query = null;
3143 String sql = null;
3144
3145 if (orderByComparator != null) {
3146 query = new StringBundler(2 +
3147 (orderByComparator.getOrderByFields().length * 3));
3148
3149 query.append(_SQL_SELECT_USERGROUPGROUPROLE);
3150
3151 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3152 orderByComparator);
3153
3154 sql = query.toString();
3155 }
3156 else {
3157 sql = _SQL_SELECT_USERGROUPGROUPROLE;
3158
3159 if (pagination) {
3160 sql = sql.concat(UserGroupGroupRoleModelImpl.ORDER_BY_JPQL);
3161 }
3162 }
3163
3164 Session session = null;
3165
3166 try {
3167 session = openSession();
3168
3169 Query q = session.createQuery(sql);
3170
3171 if (!pagination) {
3172 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
3173 getDialect(), start, end, false);
3174
3175 Collections.sort(list);
3176
3177 list = new UnmodifiableList<UserGroupGroupRole>(list);
3178 }
3179 else {
3180 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
3181 getDialect(), start, end);
3182 }
3183
3184 cacheResult(list);
3185
3186 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3187 }
3188 catch (Exception e) {
3189 FinderCacheUtil.removeResult(finderPath, finderArgs);
3190
3191 throw processException(e);
3192 }
3193 finally {
3194 closeSession(session);
3195 }
3196 }
3197
3198 return list;
3199 }
3200
3201
3206 @Override
3207 public void removeAll() throws SystemException {
3208 for (UserGroupGroupRole userGroupGroupRole : findAll()) {
3209 remove(userGroupGroupRole);
3210 }
3211 }
3212
3213
3219 @Override
3220 public int countAll() throws SystemException {
3221 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3222 FINDER_ARGS_EMPTY, this);
3223
3224 if (count == null) {
3225 Session session = null;
3226
3227 try {
3228 session = openSession();
3229
3230 Query q = session.createQuery(_SQL_COUNT_USERGROUPGROUPROLE);
3231
3232 count = (Long)q.uniqueResult();
3233
3234 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3235 FINDER_ARGS_EMPTY, count);
3236 }
3237 catch (Exception e) {
3238 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
3239 FINDER_ARGS_EMPTY);
3240
3241 throw processException(e);
3242 }
3243 finally {
3244 closeSession(session);
3245 }
3246 }
3247
3248 return count.intValue();
3249 }
3250
3251
3254 public void afterPropertiesSet() {
3255 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3256 com.liferay.portal.util.PropsUtil.get(
3257 "value.object.listener.com.liferay.portal.model.UserGroupGroupRole")));
3258
3259 if (listenerClassNames.length > 0) {
3260 try {
3261 List<ModelListener<UserGroupGroupRole>> listenersList = new ArrayList<ModelListener<UserGroupGroupRole>>();
3262
3263 for (String listenerClassName : listenerClassNames) {
3264 listenersList.add((ModelListener<UserGroupGroupRole>)InstanceFactory.newInstance(
3265 getClassLoader(), listenerClassName));
3266 }
3267
3268 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3269 }
3270 catch (Exception e) {
3271 _log.error(e);
3272 }
3273 }
3274 }
3275
3276 public void destroy() {
3277 EntityCacheUtil.removeCache(UserGroupGroupRoleImpl.class.getName());
3278 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3279 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
3280 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3281 }
3282
3283 private static final String _SQL_SELECT_USERGROUPGROUPROLE = "SELECT userGroupGroupRole FROM UserGroupGroupRole userGroupGroupRole";
3284 private static final String _SQL_SELECT_USERGROUPGROUPROLE_WHERE = "SELECT userGroupGroupRole FROM UserGroupGroupRole userGroupGroupRole WHERE ";
3285 private static final String _SQL_COUNT_USERGROUPGROUPROLE = "SELECT COUNT(userGroupGroupRole) FROM UserGroupGroupRole userGroupGroupRole";
3286 private static final String _SQL_COUNT_USERGROUPGROUPROLE_WHERE = "SELECT COUNT(userGroupGroupRole) FROM UserGroupGroupRole userGroupGroupRole WHERE ";
3287 private static final String _ORDER_BY_ENTITY_ALIAS = "userGroupGroupRole.";
3288 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserGroupGroupRole exists with the primary key ";
3289 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserGroupGroupRole exists with the key {";
3290 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3291 private static Log _log = LogFactoryUtil.getLog(UserGroupGroupRolePersistenceImpl.class);
3292 private static UserGroupGroupRole _nullUserGroupGroupRole = new UserGroupGroupRoleImpl() {
3293 @Override
3294 public Object clone() {
3295 return this;
3296 }
3297
3298 @Override
3299 public CacheModel<UserGroupGroupRole> toCacheModel() {
3300 return _nullUserGroupGroupRoleCacheModel;
3301 }
3302 };
3303
3304 private static CacheModel<UserGroupGroupRole> _nullUserGroupGroupRoleCacheModel =
3305 new CacheModel<UserGroupGroupRole>() {
3306 @Override
3307 public UserGroupGroupRole toEntityModel() {
3308 return _nullUserGroupGroupRole;
3309 }
3310 };
3311 }