1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.NoSuchUserGroupGroupRoleException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
22  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
24  import com.liferay.portal.kernel.dao.orm.FinderPath;
25  import com.liferay.portal.kernel.dao.orm.Query;
26  import com.liferay.portal.kernel.dao.orm.QueryPos;
27  import com.liferay.portal.kernel.dao.orm.QueryUtil;
28  import com.liferay.portal.kernel.dao.orm.Session;
29  import com.liferay.portal.kernel.exception.SystemException;
30  import com.liferay.portal.kernel.log.Log;
31  import com.liferay.portal.kernel.log.LogFactoryUtil;
32  import com.liferay.portal.kernel.util.GetterUtil;
33  import com.liferay.portal.kernel.util.OrderByComparator;
34  import com.liferay.portal.kernel.util.StringBundler;
35  import com.liferay.portal.kernel.util.StringPool;
36  import com.liferay.portal.kernel.util.StringUtil;
37  import com.liferay.portal.model.ModelListener;
38  import com.liferay.portal.model.UserGroupGroupRole;
39  import com.liferay.portal.model.impl.UserGroupGroupRoleImpl;
40  import com.liferay.portal.model.impl.UserGroupGroupRoleModelImpl;
41  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42  
43  import java.io.Serializable;
44  
45  import java.util.ArrayList;
46  import java.util.Collections;
47  import java.util.List;
48  
49  /**
50   * <a href="UserGroupGroupRolePersistenceImpl.java.html"><b><i>View Source</i></b></a>
51   *
52   * <p>
53   * ServiceBuilder generated this class. Modifications in this class will be
54   * overwritten the next time is generated.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       UserGroupGroupRolePersistence
59   * @see       UserGroupGroupRoleUtil
60   * @generated
61   */
62  public class UserGroupGroupRolePersistenceImpl extends BasePersistenceImpl<UserGroupGroupRole>
63      implements UserGroupGroupRolePersistence {
64      public static final String FINDER_CLASS_NAME_ENTITY = UserGroupGroupRoleImpl.class.getName();
65      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
66          ".List";
67      public static final FinderPath FINDER_PATH_FIND_BY_USERGROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
68              UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
69              FINDER_CLASS_NAME_LIST, "findByUserGroupId",
70              new String[] { Long.class.getName() });
71      public static final FinderPath FINDER_PATH_FIND_BY_OBC_USERGROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
72              UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
73              FINDER_CLASS_NAME_LIST, "findByUserGroupId",
74              new String[] {
75                  Long.class.getName(),
76                  
77              "java.lang.Integer", "java.lang.Integer",
78                  "com.liferay.portal.kernel.util.OrderByComparator"
79              });
80      public static final FinderPath FINDER_PATH_COUNT_BY_USERGROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
81              UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
82              FINDER_CLASS_NAME_LIST, "countByUserGroupId",
83              new String[] { Long.class.getName() });
84      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
85              UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
86              FINDER_CLASS_NAME_LIST, "findByGroupId",
87              new String[] { Long.class.getName() });
88      public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
89              UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
90              FINDER_CLASS_NAME_LIST, "findByGroupId",
91              new String[] {
92                  Long.class.getName(),
93                  
94              "java.lang.Integer", "java.lang.Integer",
95                  "com.liferay.portal.kernel.util.OrderByComparator"
96              });
97      public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
98              UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
99              FINDER_CLASS_NAME_LIST, "countByGroupId",
100             new String[] { Long.class.getName() });
101     public static final FinderPath FINDER_PATH_FIND_BY_ROLEID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
102             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
103             FINDER_CLASS_NAME_LIST, "findByRoleId",
104             new String[] { Long.class.getName() });
105     public static final FinderPath FINDER_PATH_FIND_BY_OBC_ROLEID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
106             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
107             FINDER_CLASS_NAME_LIST, "findByRoleId",
108             new String[] {
109                 Long.class.getName(),
110                 
111             "java.lang.Integer", "java.lang.Integer",
112                 "com.liferay.portal.kernel.util.OrderByComparator"
113             });
114     public static final FinderPath FINDER_PATH_COUNT_BY_ROLEID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
115             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
116             FINDER_CLASS_NAME_LIST, "countByRoleId",
117             new String[] { Long.class.getName() });
118     public static final FinderPath FINDER_PATH_FIND_BY_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
119             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
120             FINDER_CLASS_NAME_LIST, "findByU_G",
121             new String[] { Long.class.getName(), Long.class.getName() });
122     public static final FinderPath FINDER_PATH_FIND_BY_OBC_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
123             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
124             FINDER_CLASS_NAME_LIST, "findByU_G",
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_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
132             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
133             FINDER_CLASS_NAME_LIST, "countByU_G",
134             new String[] { Long.class.getName(), Long.class.getName() });
135     public static final FinderPath FINDER_PATH_FIND_BY_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
136             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
137             FINDER_CLASS_NAME_LIST, "findByG_R",
138             new String[] { Long.class.getName(), Long.class.getName() });
139     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
140             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
141             FINDER_CLASS_NAME_LIST, "findByG_R",
142             new String[] {
143                 Long.class.getName(), Long.class.getName(),
144                 
145             "java.lang.Integer", "java.lang.Integer",
146                 "com.liferay.portal.kernel.util.OrderByComparator"
147             });
148     public static final FinderPath FINDER_PATH_COUNT_BY_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
149             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
150             FINDER_CLASS_NAME_LIST, "countByG_R",
151             new String[] { Long.class.getName(), Long.class.getName() });
152     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
153             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
154             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
155     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
156             UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
157             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
158 
159     public void cacheResult(UserGroupGroupRole userGroupGroupRole) {
160         EntityCacheUtil.putResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
161             UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey(),
162             userGroupGroupRole);
163     }
164 
165     public void cacheResult(List<UserGroupGroupRole> userGroupGroupRoles) {
166         for (UserGroupGroupRole userGroupGroupRole : userGroupGroupRoles) {
167             if (EntityCacheUtil.getResult(
168                         UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
169                         UserGroupGroupRoleImpl.class,
170                         userGroupGroupRole.getPrimaryKey(), this) == null) {
171                 cacheResult(userGroupGroupRole);
172             }
173         }
174     }
175 
176     public void clearCache() {
177         CacheRegistry.clear(UserGroupGroupRoleImpl.class.getName());
178         EntityCacheUtil.clearCache(UserGroupGroupRoleImpl.class.getName());
179         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
180         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
181     }
182 
183     public UserGroupGroupRole create(UserGroupGroupRolePK userGroupGroupRolePK) {
184         UserGroupGroupRole userGroupGroupRole = new UserGroupGroupRoleImpl();
185 
186         userGroupGroupRole.setNew(true);
187         userGroupGroupRole.setPrimaryKey(userGroupGroupRolePK);
188 
189         return userGroupGroupRole;
190     }
191 
192     public UserGroupGroupRole remove(Serializable primaryKey)
193         throws NoSuchModelException, SystemException {
194         return remove((UserGroupGroupRolePK)primaryKey);
195     }
196 
197     public UserGroupGroupRole remove(UserGroupGroupRolePK userGroupGroupRolePK)
198         throws NoSuchUserGroupGroupRoleException, SystemException {
199         Session session = null;
200 
201         try {
202             session = openSession();
203 
204             UserGroupGroupRole userGroupGroupRole = (UserGroupGroupRole)session.get(UserGroupGroupRoleImpl.class,
205                     userGroupGroupRolePK);
206 
207             if (userGroupGroupRole == null) {
208                 if (_log.isWarnEnabled()) {
209                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
210                         userGroupGroupRolePK);
211                 }
212 
213                 throw new NoSuchUserGroupGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
214                     userGroupGroupRolePK);
215             }
216 
217             return remove(userGroupGroupRole);
218         }
219         catch (NoSuchUserGroupGroupRoleException nsee) {
220             throw nsee;
221         }
222         catch (Exception e) {
223             throw processException(e);
224         }
225         finally {
226             closeSession(session);
227         }
228     }
229 
230     public UserGroupGroupRole remove(UserGroupGroupRole userGroupGroupRole)
231         throws SystemException {
232         for (ModelListener<UserGroupGroupRole> listener : listeners) {
233             listener.onBeforeRemove(userGroupGroupRole);
234         }
235 
236         userGroupGroupRole = removeImpl(userGroupGroupRole);
237 
238         for (ModelListener<UserGroupGroupRole> listener : listeners) {
239             listener.onAfterRemove(userGroupGroupRole);
240         }
241 
242         return userGroupGroupRole;
243     }
244 
245     protected UserGroupGroupRole removeImpl(
246         UserGroupGroupRole userGroupGroupRole) throws SystemException {
247         userGroupGroupRole = toUnwrappedModel(userGroupGroupRole);
248 
249         Session session = null;
250 
251         try {
252             session = openSession();
253 
254             if (userGroupGroupRole.isCachedModel() ||
255                     BatchSessionUtil.isEnabled()) {
256                 Object staleObject = session.get(UserGroupGroupRoleImpl.class,
257                         userGroupGroupRole.getPrimaryKeyObj());
258 
259                 if (staleObject != null) {
260                     session.evict(staleObject);
261                 }
262             }
263 
264             session.delete(userGroupGroupRole);
265 
266             session.flush();
267         }
268         catch (Exception e) {
269             throw processException(e);
270         }
271         finally {
272             closeSession(session);
273         }
274 
275         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
276 
277         EntityCacheUtil.removeResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
278             UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey());
279 
280         return userGroupGroupRole;
281     }
282 
283     public UserGroupGroupRole updateImpl(
284         com.liferay.portal.model.UserGroupGroupRole userGroupGroupRole,
285         boolean merge) throws SystemException {
286         userGroupGroupRole = toUnwrappedModel(userGroupGroupRole);
287 
288         Session session = null;
289 
290         try {
291             session = openSession();
292 
293             BatchSessionUtil.update(session, userGroupGroupRole, merge);
294 
295             userGroupGroupRole.setNew(false);
296         }
297         catch (Exception e) {
298             throw processException(e);
299         }
300         finally {
301             closeSession(session);
302         }
303 
304         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
305 
306         EntityCacheUtil.putResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
307             UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey(),
308             userGroupGroupRole);
309 
310         return userGroupGroupRole;
311     }
312 
313     protected UserGroupGroupRole toUnwrappedModel(
314         UserGroupGroupRole userGroupGroupRole) {
315         if (userGroupGroupRole instanceof UserGroupGroupRoleImpl) {
316             return userGroupGroupRole;
317         }
318 
319         UserGroupGroupRoleImpl userGroupGroupRoleImpl = new UserGroupGroupRoleImpl();
320 
321         userGroupGroupRoleImpl.setNew(userGroupGroupRole.isNew());
322         userGroupGroupRoleImpl.setPrimaryKey(userGroupGroupRole.getPrimaryKey());
323 
324         userGroupGroupRoleImpl.setUserGroupId(userGroupGroupRole.getUserGroupId());
325         userGroupGroupRoleImpl.setGroupId(userGroupGroupRole.getGroupId());
326         userGroupGroupRoleImpl.setRoleId(userGroupGroupRole.getRoleId());
327 
328         return userGroupGroupRoleImpl;
329     }
330 
331     public UserGroupGroupRole findByPrimaryKey(Serializable primaryKey)
332         throws NoSuchModelException, SystemException {
333         return findByPrimaryKey((UserGroupGroupRolePK)primaryKey);
334     }
335 
336     public UserGroupGroupRole findByPrimaryKey(
337         UserGroupGroupRolePK userGroupGroupRolePK)
338         throws NoSuchUserGroupGroupRoleException, SystemException {
339         UserGroupGroupRole userGroupGroupRole = fetchByPrimaryKey(userGroupGroupRolePK);
340 
341         if (userGroupGroupRole == null) {
342             if (_log.isWarnEnabled()) {
343                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
344                     userGroupGroupRolePK);
345             }
346 
347             throw new NoSuchUserGroupGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
348                 userGroupGroupRolePK);
349         }
350 
351         return userGroupGroupRole;
352     }
353 
354     public UserGroupGroupRole fetchByPrimaryKey(Serializable primaryKey)
355         throws SystemException {
356         return fetchByPrimaryKey((UserGroupGroupRolePK)primaryKey);
357     }
358 
359     public UserGroupGroupRole fetchByPrimaryKey(
360         UserGroupGroupRolePK userGroupGroupRolePK) throws SystemException {
361         UserGroupGroupRole userGroupGroupRole = (UserGroupGroupRole)EntityCacheUtil.getResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
362                 UserGroupGroupRoleImpl.class, userGroupGroupRolePK, this);
363 
364         if (userGroupGroupRole == null) {
365             Session session = null;
366 
367             try {
368                 session = openSession();
369 
370                 userGroupGroupRole = (UserGroupGroupRole)session.get(UserGroupGroupRoleImpl.class,
371                         userGroupGroupRolePK);
372             }
373             catch (Exception e) {
374                 throw processException(e);
375             }
376             finally {
377                 if (userGroupGroupRole != null) {
378                     cacheResult(userGroupGroupRole);
379                 }
380 
381                 closeSession(session);
382             }
383         }
384 
385         return userGroupGroupRole;
386     }
387 
388     public List<UserGroupGroupRole> findByUserGroupId(long userGroupId)
389         throws SystemException {
390         Object[] finderArgs = new Object[] { new Long(userGroupId) };
391 
392         List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERGROUPID,
393                 finderArgs, this);
394 
395         if (list == null) {
396             Session session = null;
397 
398             try {
399                 session = openSession();
400 
401                 StringBundler query = new StringBundler(2);
402 
403                 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
404 
405                 query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
406 
407                 String sql = query.toString();
408 
409                 Query q = session.createQuery(sql);
410 
411                 QueryPos qPos = QueryPos.getInstance(q);
412 
413                 qPos.add(userGroupId);
414 
415                 list = q.list();
416             }
417             catch (Exception e) {
418                 throw processException(e);
419             }
420             finally {
421                 if (list == null) {
422                     list = new ArrayList<UserGroupGroupRole>();
423                 }
424 
425                 cacheResult(list);
426 
427                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERGROUPID,
428                     finderArgs, list);
429 
430                 closeSession(session);
431             }
432         }
433 
434         return list;
435     }
436 
437     public List<UserGroupGroupRole> findByUserGroupId(long userGroupId,
438         int start, int end) throws SystemException {
439         return findByUserGroupId(userGroupId, start, end, null);
440     }
441 
442     public List<UserGroupGroupRole> findByUserGroupId(long userGroupId,
443         int start, int end, OrderByComparator obc) throws SystemException {
444         Object[] finderArgs = new Object[] {
445                 new Long(userGroupId),
446                 
447                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
448             };
449 
450         List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERGROUPID,
451                 finderArgs, this);
452 
453         if (list == null) {
454             Session session = null;
455 
456             try {
457                 session = openSession();
458 
459                 StringBundler query = null;
460 
461                 if (obc != null) {
462                     query = new StringBundler(3 +
463                             (obc.getOrderByFields().length * 3));
464                 }
465                 else {
466                     query = new StringBundler(2);
467                 }
468 
469                 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
470 
471                 query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
472 
473                 if (obc != null) {
474                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
475                 }
476 
477                 String sql = query.toString();
478 
479                 Query q = session.createQuery(sql);
480 
481                 QueryPos qPos = QueryPos.getInstance(q);
482 
483                 qPos.add(userGroupId);
484 
485                 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
486                         getDialect(), start, end);
487             }
488             catch (Exception e) {
489                 throw processException(e);
490             }
491             finally {
492                 if (list == null) {
493                     list = new ArrayList<UserGroupGroupRole>();
494                 }
495 
496                 cacheResult(list);
497 
498                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERGROUPID,
499                     finderArgs, list);
500 
501                 closeSession(session);
502             }
503         }
504 
505         return list;
506     }
507 
508     public UserGroupGroupRole findByUserGroupId_First(long userGroupId,
509         OrderByComparator obc)
510         throws NoSuchUserGroupGroupRoleException, SystemException {
511         List<UserGroupGroupRole> list = findByUserGroupId(userGroupId, 0, 1, obc);
512 
513         if (list.isEmpty()) {
514             StringBundler msg = new StringBundler(4);
515 
516             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
517 
518             msg.append("userGroupId=");
519             msg.append(userGroupId);
520 
521             msg.append(StringPool.CLOSE_CURLY_BRACE);
522 
523             throw new NoSuchUserGroupGroupRoleException(msg.toString());
524         }
525         else {
526             return list.get(0);
527         }
528     }
529 
530     public UserGroupGroupRole findByUserGroupId_Last(long userGroupId,
531         OrderByComparator obc)
532         throws NoSuchUserGroupGroupRoleException, SystemException {
533         int count = countByUserGroupId(userGroupId);
534 
535         List<UserGroupGroupRole> list = findByUserGroupId(userGroupId,
536                 count - 1, count, obc);
537 
538         if (list.isEmpty()) {
539             StringBundler msg = new StringBundler(4);
540 
541             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
542 
543             msg.append("userGroupId=");
544             msg.append(userGroupId);
545 
546             msg.append(StringPool.CLOSE_CURLY_BRACE);
547 
548             throw new NoSuchUserGroupGroupRoleException(msg.toString());
549         }
550         else {
551             return list.get(0);
552         }
553     }
554 
555     public UserGroupGroupRole[] findByUserGroupId_PrevAndNext(
556         UserGroupGroupRolePK userGroupGroupRolePK, long userGroupId,
557         OrderByComparator obc)
558         throws NoSuchUserGroupGroupRoleException, SystemException {
559         UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
560 
561         int count = countByUserGroupId(userGroupId);
562 
563         Session session = null;
564 
565         try {
566             session = openSession();
567 
568             StringBundler query = null;
569 
570             if (obc != null) {
571                 query = new StringBundler(3 +
572                         (obc.getOrderByFields().length * 3));
573             }
574             else {
575                 query = new StringBundler(2);
576             }
577 
578             query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
579 
580             query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
581 
582             if (obc != null) {
583                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
584             }
585 
586             String sql = query.toString();
587 
588             Query q = session.createQuery(sql);
589 
590             QueryPos qPos = QueryPos.getInstance(q);
591 
592             qPos.add(userGroupId);
593 
594             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
595                     userGroupGroupRole);
596 
597             UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
598 
599             array[0] = (UserGroupGroupRole)objArray[0];
600             array[1] = (UserGroupGroupRole)objArray[1];
601             array[2] = (UserGroupGroupRole)objArray[2];
602 
603             return array;
604         }
605         catch (Exception e) {
606             throw processException(e);
607         }
608         finally {
609             closeSession(session);
610         }
611     }
612 
613     public List<UserGroupGroupRole> findByGroupId(long groupId)
614         throws SystemException {
615         Object[] finderArgs = new Object[] { new Long(groupId) };
616 
617         List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
618                 finderArgs, this);
619 
620         if (list == null) {
621             Session session = null;
622 
623             try {
624                 session = openSession();
625 
626                 StringBundler query = new StringBundler(2);
627 
628                 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
629 
630                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
631 
632                 String sql = query.toString();
633 
634                 Query q = session.createQuery(sql);
635 
636                 QueryPos qPos = QueryPos.getInstance(q);
637 
638                 qPos.add(groupId);
639 
640                 list = q.list();
641             }
642             catch (Exception e) {
643                 throw processException(e);
644             }
645             finally {
646                 if (list == null) {
647                     list = new ArrayList<UserGroupGroupRole>();
648                 }
649 
650                 cacheResult(list);
651 
652                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
653                     finderArgs, list);
654 
655                 closeSession(session);
656             }
657         }
658 
659         return list;
660     }
661 
662     public List<UserGroupGroupRole> findByGroupId(long groupId, int start,
663         int end) throws SystemException {
664         return findByGroupId(groupId, start, end, null);
665     }
666 
667     public List<UserGroupGroupRole> findByGroupId(long groupId, int start,
668         int end, OrderByComparator obc) throws SystemException {
669         Object[] finderArgs = new Object[] {
670                 new Long(groupId),
671                 
672                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
673             };
674 
675         List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
676                 finderArgs, this);
677 
678         if (list == null) {
679             Session session = null;
680 
681             try {
682                 session = openSession();
683 
684                 StringBundler query = null;
685 
686                 if (obc != null) {
687                     query = new StringBundler(3 +
688                             (obc.getOrderByFields().length * 3));
689                 }
690                 else {
691                     query = new StringBundler(2);
692                 }
693 
694                 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
695 
696                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
697 
698                 if (obc != null) {
699                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
700                 }
701 
702                 String sql = query.toString();
703 
704                 Query q = session.createQuery(sql);
705 
706                 QueryPos qPos = QueryPos.getInstance(q);
707 
708                 qPos.add(groupId);
709 
710                 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
711                         getDialect(), start, end);
712             }
713             catch (Exception e) {
714                 throw processException(e);
715             }
716             finally {
717                 if (list == null) {
718                     list = new ArrayList<UserGroupGroupRole>();
719                 }
720 
721                 cacheResult(list);
722 
723                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
724                     finderArgs, list);
725 
726                 closeSession(session);
727             }
728         }
729 
730         return list;
731     }
732 
733     public UserGroupGroupRole findByGroupId_First(long groupId,
734         OrderByComparator obc)
735         throws NoSuchUserGroupGroupRoleException, SystemException {
736         List<UserGroupGroupRole> list = findByGroupId(groupId, 0, 1, obc);
737 
738         if (list.isEmpty()) {
739             StringBundler msg = new StringBundler(4);
740 
741             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
742 
743             msg.append("groupId=");
744             msg.append(groupId);
745 
746             msg.append(StringPool.CLOSE_CURLY_BRACE);
747 
748             throw new NoSuchUserGroupGroupRoleException(msg.toString());
749         }
750         else {
751             return list.get(0);
752         }
753     }
754 
755     public UserGroupGroupRole findByGroupId_Last(long groupId,
756         OrderByComparator obc)
757         throws NoSuchUserGroupGroupRoleException, SystemException {
758         int count = countByGroupId(groupId);
759 
760         List<UserGroupGroupRole> list = findByGroupId(groupId, count - 1,
761                 count, obc);
762 
763         if (list.isEmpty()) {
764             StringBundler msg = new StringBundler(4);
765 
766             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
767 
768             msg.append("groupId=");
769             msg.append(groupId);
770 
771             msg.append(StringPool.CLOSE_CURLY_BRACE);
772 
773             throw new NoSuchUserGroupGroupRoleException(msg.toString());
774         }
775         else {
776             return list.get(0);
777         }
778     }
779 
780     public UserGroupGroupRole[] findByGroupId_PrevAndNext(
781         UserGroupGroupRolePK userGroupGroupRolePK, long groupId,
782         OrderByComparator obc)
783         throws NoSuchUserGroupGroupRoleException, SystemException {
784         UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
785 
786         int count = countByGroupId(groupId);
787 
788         Session session = null;
789 
790         try {
791             session = openSession();
792 
793             StringBundler query = null;
794 
795             if (obc != null) {
796                 query = new StringBundler(3 +
797                         (obc.getOrderByFields().length * 3));
798             }
799             else {
800                 query = new StringBundler(2);
801             }
802 
803             query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
804 
805             query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
806 
807             if (obc != null) {
808                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
809             }
810 
811             String sql = query.toString();
812 
813             Query q = session.createQuery(sql);
814 
815             QueryPos qPos = QueryPos.getInstance(q);
816 
817             qPos.add(groupId);
818 
819             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
820                     userGroupGroupRole);
821 
822             UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
823 
824             array[0] = (UserGroupGroupRole)objArray[0];
825             array[1] = (UserGroupGroupRole)objArray[1];
826             array[2] = (UserGroupGroupRole)objArray[2];
827 
828             return array;
829         }
830         catch (Exception e) {
831             throw processException(e);
832         }
833         finally {
834             closeSession(session);
835         }
836     }
837 
838     public List<UserGroupGroupRole> findByRoleId(long roleId)
839         throws SystemException {
840         Object[] finderArgs = new Object[] { new Long(roleId) };
841 
842         List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ROLEID,
843                 finderArgs, this);
844 
845         if (list == null) {
846             Session session = null;
847 
848             try {
849                 session = openSession();
850 
851                 StringBundler query = new StringBundler(2);
852 
853                 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
854 
855                 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
856 
857                 String sql = query.toString();
858 
859                 Query q = session.createQuery(sql);
860 
861                 QueryPos qPos = QueryPos.getInstance(q);
862 
863                 qPos.add(roleId);
864 
865                 list = q.list();
866             }
867             catch (Exception e) {
868                 throw processException(e);
869             }
870             finally {
871                 if (list == null) {
872                     list = new ArrayList<UserGroupGroupRole>();
873                 }
874 
875                 cacheResult(list);
876 
877                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ROLEID,
878                     finderArgs, list);
879 
880                 closeSession(session);
881             }
882         }
883 
884         return list;
885     }
886 
887     public List<UserGroupGroupRole> findByRoleId(long roleId, int start, int end)
888         throws SystemException {
889         return findByRoleId(roleId, start, end, null);
890     }
891 
892     public List<UserGroupGroupRole> findByRoleId(long roleId, int start,
893         int end, OrderByComparator obc) throws SystemException {
894         Object[] finderArgs = new Object[] {
895                 new Long(roleId),
896                 
897                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
898             };
899 
900         List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_ROLEID,
901                 finderArgs, this);
902 
903         if (list == null) {
904             Session session = null;
905 
906             try {
907                 session = openSession();
908 
909                 StringBundler query = null;
910 
911                 if (obc != null) {
912                     query = new StringBundler(3 +
913                             (obc.getOrderByFields().length * 3));
914                 }
915                 else {
916                     query = new StringBundler(2);
917                 }
918 
919                 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
920 
921                 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
922 
923                 if (obc != null) {
924                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
925                 }
926 
927                 String sql = query.toString();
928 
929                 Query q = session.createQuery(sql);
930 
931                 QueryPos qPos = QueryPos.getInstance(q);
932 
933                 qPos.add(roleId);
934 
935                 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
936                         getDialect(), start, end);
937             }
938             catch (Exception e) {
939                 throw processException(e);
940             }
941             finally {
942                 if (list == null) {
943                     list = new ArrayList<UserGroupGroupRole>();
944                 }
945 
946                 cacheResult(list);
947 
948                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_ROLEID,
949                     finderArgs, list);
950 
951                 closeSession(session);
952             }
953         }
954 
955         return list;
956     }
957 
958     public UserGroupGroupRole findByRoleId_First(long roleId,
959         OrderByComparator obc)
960         throws NoSuchUserGroupGroupRoleException, SystemException {
961         List<UserGroupGroupRole> list = findByRoleId(roleId, 0, 1, obc);
962 
963         if (list.isEmpty()) {
964             StringBundler msg = new StringBundler(4);
965 
966             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
967 
968             msg.append("roleId=");
969             msg.append(roleId);
970 
971             msg.append(StringPool.CLOSE_CURLY_BRACE);
972 
973             throw new NoSuchUserGroupGroupRoleException(msg.toString());
974         }
975         else {
976             return list.get(0);
977         }
978     }
979 
980     public UserGroupGroupRole findByRoleId_Last(long roleId,
981         OrderByComparator obc)
982         throws NoSuchUserGroupGroupRoleException, SystemException {
983         int count = countByRoleId(roleId);
984 
985         List<UserGroupGroupRole> list = findByRoleId(roleId, count - 1, count,
986                 obc);
987 
988         if (list.isEmpty()) {
989             StringBundler msg = new StringBundler(4);
990 
991             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
992 
993             msg.append("roleId=");
994             msg.append(roleId);
995 
996             msg.append(StringPool.CLOSE_CURLY_BRACE);
997 
998             throw new NoSuchUserGroupGroupRoleException(msg.toString());
999         }
1000        else {
1001            return list.get(0);
1002        }
1003    }
1004
1005    public UserGroupGroupRole[] findByRoleId_PrevAndNext(
1006        UserGroupGroupRolePK userGroupGroupRolePK, long roleId,
1007        OrderByComparator obc)
1008        throws NoSuchUserGroupGroupRoleException, SystemException {
1009        UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
1010
1011        int count = countByRoleId(roleId);
1012
1013        Session session = null;
1014
1015        try {
1016            session = openSession();
1017
1018            StringBundler query = null;
1019
1020            if (obc != null) {
1021                query = new StringBundler(3 +
1022                        (obc.getOrderByFields().length * 3));
1023            }
1024            else {
1025                query = new StringBundler(2);
1026            }
1027
1028            query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1029
1030            query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1031
1032            if (obc != null) {
1033                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1034            }
1035
1036            String sql = query.toString();
1037
1038            Query q = session.createQuery(sql);
1039
1040            QueryPos qPos = QueryPos.getInstance(q);
1041
1042            qPos.add(roleId);
1043
1044            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1045                    userGroupGroupRole);
1046
1047            UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
1048
1049            array[0] = (UserGroupGroupRole)objArray[0];
1050            array[1] = (UserGroupGroupRole)objArray[1];
1051            array[2] = (UserGroupGroupRole)objArray[2];
1052
1053            return array;
1054        }
1055        catch (Exception e) {
1056            throw processException(e);
1057        }
1058        finally {
1059            closeSession(session);
1060        }
1061    }
1062
1063    public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId)
1064        throws SystemException {
1065        Object[] finderArgs = new Object[] {
1066                new Long(userGroupId), new Long(groupId)
1067            };
1068
1069        List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_G,
1070                finderArgs, this);
1071
1072        if (list == null) {
1073            Session session = null;
1074
1075            try {
1076                session = openSession();
1077
1078                StringBundler query = new StringBundler(3);
1079
1080                query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1081
1082                query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
1083
1084                query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1085
1086                String sql = query.toString();
1087
1088                Query q = session.createQuery(sql);
1089
1090                QueryPos qPos = QueryPos.getInstance(q);
1091
1092                qPos.add(userGroupId);
1093
1094                qPos.add(groupId);
1095
1096                list = q.list();
1097            }
1098            catch (Exception e) {
1099                throw processException(e);
1100            }
1101            finally {
1102                if (list == null) {
1103                    list = new ArrayList<UserGroupGroupRole>();
1104                }
1105
1106                cacheResult(list);
1107
1108                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_G, finderArgs,
1109                    list);
1110
1111                closeSession(session);
1112            }
1113        }
1114
1115        return list;
1116    }
1117
1118    public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId,
1119        int start, int end) throws SystemException {
1120        return findByU_G(userGroupId, groupId, start, end, null);
1121    }
1122
1123    public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId,
1124        int start, int end, OrderByComparator obc) throws SystemException {
1125        Object[] finderArgs = new Object[] {
1126                new Long(userGroupId), new Long(groupId),
1127                
1128                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1129            };
1130
1131        List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_U_G,
1132                finderArgs, this);
1133
1134        if (list == null) {
1135            Session session = null;
1136
1137            try {
1138                session = openSession();
1139
1140                StringBundler query = null;
1141
1142                if (obc != null) {
1143                    query = new StringBundler(4 +
1144                            (obc.getOrderByFields().length * 3));
1145                }
1146                else {
1147                    query = new StringBundler(3);
1148                }
1149
1150                query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1151
1152                query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
1153
1154                query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1155
1156                if (obc != null) {
1157                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1158                }
1159
1160                String sql = query.toString();
1161
1162                Query q = session.createQuery(sql);
1163
1164                QueryPos qPos = QueryPos.getInstance(q);
1165
1166                qPos.add(userGroupId);
1167
1168                qPos.add(groupId);
1169
1170                list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1171                        getDialect(), start, end);
1172            }
1173            catch (Exception e) {
1174                throw processException(e);
1175            }
1176            finally {
1177                if (list == null) {
1178                    list = new ArrayList<UserGroupGroupRole>();
1179                }
1180
1181                cacheResult(list);
1182
1183                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_U_G,
1184                    finderArgs, list);
1185
1186                closeSession(session);
1187            }
1188        }
1189
1190        return list;
1191    }
1192
1193    public UserGroupGroupRole findByU_G_First(long userGroupId, long groupId,
1194        OrderByComparator obc)
1195        throws NoSuchUserGroupGroupRoleException, SystemException {
1196        List<UserGroupGroupRole> list = findByU_G(userGroupId, groupId, 0, 1,
1197                obc);
1198
1199        if (list.isEmpty()) {
1200            StringBundler msg = new StringBundler(6);
1201
1202            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1203
1204            msg.append("userGroupId=");
1205            msg.append(userGroupId);
1206
1207            msg.append(", groupId=");
1208            msg.append(groupId);
1209
1210            msg.append(StringPool.CLOSE_CURLY_BRACE);
1211
1212            throw new NoSuchUserGroupGroupRoleException(msg.toString());
1213        }
1214        else {
1215            return list.get(0);
1216        }
1217    }
1218
1219    public UserGroupGroupRole findByU_G_Last(long userGroupId, long groupId,
1220        OrderByComparator obc)
1221        throws NoSuchUserGroupGroupRoleException, SystemException {
1222        int count = countByU_G(userGroupId, groupId);
1223
1224        List<UserGroupGroupRole> list = findByU_G(userGroupId, groupId,
1225                count - 1, count, obc);
1226
1227        if (list.isEmpty()) {
1228            StringBundler msg = new StringBundler(6);
1229
1230            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1231
1232            msg.append("userGroupId=");
1233            msg.append(userGroupId);
1234
1235            msg.append(", groupId=");
1236            msg.append(groupId);
1237
1238            msg.append(StringPool.CLOSE_CURLY_BRACE);
1239
1240            throw new NoSuchUserGroupGroupRoleException(msg.toString());
1241        }
1242        else {
1243            return list.get(0);
1244        }
1245    }
1246
1247    public UserGroupGroupRole[] findByU_G_PrevAndNext(
1248        UserGroupGroupRolePK userGroupGroupRolePK, long userGroupId,
1249        long groupId, OrderByComparator obc)
1250        throws NoSuchUserGroupGroupRoleException, SystemException {
1251        UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
1252
1253        int count = countByU_G(userGroupId, groupId);
1254
1255        Session session = null;
1256
1257        try {
1258            session = openSession();
1259
1260            StringBundler query = null;
1261
1262            if (obc != null) {
1263                query = new StringBundler(4 +
1264                        (obc.getOrderByFields().length * 3));
1265            }
1266            else {
1267                query = new StringBundler(3);
1268            }
1269
1270            query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1271
1272            query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
1273
1274            query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1275
1276            if (obc != null) {
1277                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1278            }
1279
1280            String sql = query.toString();
1281
1282            Query q = session.createQuery(sql);
1283
1284            QueryPos qPos = QueryPos.getInstance(q);
1285
1286            qPos.add(userGroupId);
1287
1288            qPos.add(groupId);
1289
1290            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1291                    userGroupGroupRole);
1292
1293            UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
1294
1295            array[0] = (UserGroupGroupRole)objArray[0];
1296            array[1] = (UserGroupGroupRole)objArray[1];
1297            array[2] = (UserGroupGroupRole)objArray[2];
1298
1299            return array;
1300        }
1301        catch (Exception e) {
1302            throw processException(e);
1303        }
1304        finally {
1305            closeSession(session);
1306        }
1307    }
1308
1309    public List<UserGroupGroupRole> findByG_R(long groupId, long roleId)
1310        throws SystemException {
1311        Object[] finderArgs = new Object[] { new Long(groupId), new Long(roleId) };
1312
1313        List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_R,
1314                finderArgs, this);
1315
1316        if (list == null) {
1317            Session session = null;
1318
1319            try {
1320                session = openSession();
1321
1322                StringBundler query = new StringBundler(3);
1323
1324                query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1325
1326                query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1327
1328                query.append(_FINDER_COLUMN_G_R_ROLEID_2);
1329
1330                String sql = query.toString();
1331
1332                Query q = session.createQuery(sql);
1333
1334                QueryPos qPos = QueryPos.getInstance(q);
1335
1336                qPos.add(groupId);
1337
1338                qPos.add(roleId);
1339
1340                list = q.list();
1341            }
1342            catch (Exception e) {
1343                throw processException(e);
1344            }
1345            finally {
1346                if (list == null) {
1347                    list = new ArrayList<UserGroupGroupRole>();
1348                }
1349
1350                cacheResult(list);
1351
1352                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_R, finderArgs,
1353                    list);
1354
1355                closeSession(session);
1356            }
1357        }
1358
1359        return list;
1360    }
1361
1362    public List<UserGroupGroupRole> findByG_R(long groupId, long roleId,
1363        int start, int end) throws SystemException {
1364        return findByG_R(groupId, roleId, start, end, null);
1365    }
1366
1367    public List<UserGroupGroupRole> findByG_R(long groupId, long roleId,
1368        int start, int end, OrderByComparator obc) throws SystemException {
1369        Object[] finderArgs = new Object[] {
1370                new Long(groupId), new Long(roleId),
1371                
1372                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1373            };
1374
1375        List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_R,
1376                finderArgs, this);
1377
1378        if (list == null) {
1379            Session session = null;
1380
1381            try {
1382                session = openSession();
1383
1384                StringBundler query = null;
1385
1386                if (obc != null) {
1387                    query = new StringBundler(4 +
1388                            (obc.getOrderByFields().length * 3));
1389                }
1390                else {
1391                    query = new StringBundler(3);
1392                }
1393
1394                query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1395
1396                query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1397
1398                query.append(_FINDER_COLUMN_G_R_ROLEID_2);
1399
1400                if (obc != null) {
1401                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1402                }
1403
1404                String sql = query.toString();
1405
1406                Query q = session.createQuery(sql);
1407
1408                QueryPos qPos = QueryPos.getInstance(q);
1409
1410                qPos.add(groupId);
1411
1412                qPos.add(roleId);
1413
1414                list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1415                        getDialect(), start, end);
1416            }
1417            catch (Exception e) {
1418                throw processException(e);
1419            }
1420            finally {
1421                if (list == null) {
1422                    list = new ArrayList<UserGroupGroupRole>();
1423                }
1424
1425                cacheResult(list);
1426
1427                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_R,
1428                    finderArgs, list);
1429
1430                closeSession(session);
1431            }
1432        }
1433
1434        return list;
1435    }
1436
1437    public UserGroupGroupRole findByG_R_First(long groupId, long roleId,
1438        OrderByComparator obc)
1439        throws NoSuchUserGroupGroupRoleException, SystemException {
1440        List<UserGroupGroupRole> list = findByG_R(groupId, roleId, 0, 1, obc);
1441
1442        if (list.isEmpty()) {
1443            StringBundler msg = new StringBundler(6);
1444
1445            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1446
1447            msg.append("groupId=");
1448            msg.append(groupId);
1449
1450            msg.append(", roleId=");
1451            msg.append(roleId);
1452
1453            msg.append(StringPool.CLOSE_CURLY_BRACE);
1454
1455            throw new NoSuchUserGroupGroupRoleException(msg.toString());
1456        }
1457        else {
1458            return list.get(0);
1459        }
1460    }
1461
1462    public UserGroupGroupRole findByG_R_Last(long groupId, long roleId,
1463        OrderByComparator obc)
1464        throws NoSuchUserGroupGroupRoleException, SystemException {
1465        int count = countByG_R(groupId, roleId);
1466
1467        List<UserGroupGroupRole> list = findByG_R(groupId, roleId, count - 1,
1468                count, obc);
1469
1470        if (list.isEmpty()) {
1471            StringBundler msg = new StringBundler(6);
1472
1473            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1474
1475            msg.append("groupId=");
1476            msg.append(groupId);
1477
1478            msg.append(", roleId=");
1479            msg.append(roleId);
1480
1481            msg.append(StringPool.CLOSE_CURLY_BRACE);
1482
1483            throw new NoSuchUserGroupGroupRoleException(msg.toString());
1484        }
1485        else {
1486            return list.get(0);
1487        }
1488    }
1489
1490    public UserGroupGroupRole[] findByG_R_PrevAndNext(
1491        UserGroupGroupRolePK userGroupGroupRolePK, long groupId, long roleId,
1492        OrderByComparator obc)
1493        throws NoSuchUserGroupGroupRoleException, SystemException {
1494        UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
1495
1496        int count = countByG_R(groupId, roleId);
1497
1498        Session session = null;
1499
1500        try {
1501            session = openSession();
1502
1503            StringBundler query = null;
1504
1505            if (obc != null) {
1506                query = new StringBundler(4 +
1507                        (obc.getOrderByFields().length * 3));
1508            }
1509            else {
1510                query = new StringBundler(3);
1511            }
1512
1513            query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1514
1515            query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1516
1517            query.append(_FINDER_COLUMN_G_R_ROLEID_2);
1518
1519            if (obc != null) {
1520                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1521            }
1522
1523            String sql = query.toString();
1524
1525            Query q = session.createQuery(sql);
1526
1527            QueryPos qPos = QueryPos.getInstance(q);
1528
1529            qPos.add(groupId);
1530
1531            qPos.add(roleId);
1532
1533            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1534                    userGroupGroupRole);
1535
1536            UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
1537
1538            array[0] = (UserGroupGroupRole)objArray[0];
1539            array[1] = (UserGroupGroupRole)objArray[1];
1540            array[2] = (UserGroupGroupRole)objArray[2];
1541
1542            return array;
1543        }
1544        catch (Exception e) {
1545            throw processException(e);
1546        }
1547        finally {
1548            closeSession(session);
1549        }
1550    }
1551
1552    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1553        throws SystemException {
1554        Session session = null;
1555
1556        try {
1557            session = openSession();
1558
1559            dynamicQuery.compile(session);
1560
1561            return dynamicQuery.list();
1562        }
1563        catch (Exception e) {
1564            throw processException(e);
1565        }
1566        finally {
1567            closeSession(session);
1568        }
1569    }
1570
1571    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1572        int start, int end) throws SystemException {
1573        Session session = null;
1574
1575        try {
1576            session = openSession();
1577
1578            dynamicQuery.setLimit(start, end);
1579
1580            dynamicQuery.compile(session);
1581
1582            return dynamicQuery.list();
1583        }
1584        catch (Exception e) {
1585            throw processException(e);
1586        }
1587        finally {
1588            closeSession(session);
1589        }
1590    }
1591
1592    public List<UserGroupGroupRole> findAll() throws SystemException {
1593        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1594    }
1595
1596    public List<UserGroupGroupRole> findAll(int start, int end)
1597        throws SystemException {
1598        return findAll(start, end, null);
1599    }
1600
1601    public List<UserGroupGroupRole> findAll(int start, int end,
1602        OrderByComparator obc) throws SystemException {
1603        Object[] finderArgs = new Object[] {
1604                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1605            };
1606
1607        List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1608                finderArgs, this);
1609
1610        if (list == null) {
1611            Session session = null;
1612
1613            try {
1614                session = openSession();
1615
1616                StringBundler query = null;
1617                String sql = null;
1618
1619                if (obc != null) {
1620                    query = new StringBundler(2 +
1621                            (obc.getOrderByFields().length * 3));
1622
1623                    query.append(_SQL_SELECT_USERGROUPGROUPROLE);
1624
1625                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1626
1627                    sql = query.toString();
1628                }
1629
1630                sql = _SQL_SELECT_USERGROUPGROUPROLE;
1631
1632                Query q = session.createQuery(sql);
1633
1634                if (obc == null) {
1635                    list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1636                            getDialect(), start, end, false);
1637
1638                    Collections.sort(list);
1639                }
1640                else {
1641                    list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1642                            getDialect(), start, end);
1643                }
1644            }
1645            catch (Exception e) {
1646                throw processException(e);
1647            }
1648            finally {
1649                if (list == null) {
1650                    list = new ArrayList<UserGroupGroupRole>();
1651                }
1652
1653                cacheResult(list);
1654
1655                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1656
1657                closeSession(session);
1658            }
1659        }
1660
1661        return list;
1662    }
1663
1664    public void removeByUserGroupId(long userGroupId) throws SystemException {
1665        for (UserGroupGroupRole userGroupGroupRole : findByUserGroupId(
1666                userGroupId)) {
1667            remove(userGroupGroupRole);
1668        }
1669    }
1670
1671    public void removeByGroupId(long groupId) throws SystemException {
1672        for (UserGroupGroupRole userGroupGroupRole : findByGroupId(groupId)) {
1673            remove(userGroupGroupRole);
1674        }
1675    }
1676
1677    public void removeByRoleId(long roleId) throws SystemException {
1678        for (UserGroupGroupRole userGroupGroupRole : findByRoleId(roleId)) {
1679            remove(userGroupGroupRole);
1680        }
1681    }
1682
1683    public void removeByU_G(long userGroupId, long groupId)
1684        throws SystemException {
1685        for (UserGroupGroupRole userGroupGroupRole : findByU_G(userGroupId,
1686                groupId)) {
1687            remove(userGroupGroupRole);
1688        }
1689    }
1690
1691    public void removeByG_R(long groupId, long roleId)
1692        throws SystemException {
1693        for (UserGroupGroupRole userGroupGroupRole : findByG_R(groupId, roleId)) {
1694            remove(userGroupGroupRole);
1695        }
1696    }
1697
1698    public void removeAll() throws SystemException {
1699        for (UserGroupGroupRole userGroupGroupRole : findAll()) {
1700            remove(userGroupGroupRole);
1701        }
1702    }
1703
1704    public int countByUserGroupId(long userGroupId) throws SystemException {
1705        Object[] finderArgs = new Object[] { new Long(userGroupId) };
1706
1707        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERGROUPID,
1708                finderArgs, this);
1709
1710        if (count == null) {
1711            Session session = null;
1712
1713            try {
1714                session = openSession();
1715
1716                StringBundler query = new StringBundler(2);
1717
1718                query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
1719
1720                query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
1721
1722                String sql = query.toString();
1723
1724                Query q = session.createQuery(sql);
1725
1726                QueryPos qPos = QueryPos.getInstance(q);
1727
1728                qPos.add(userGroupId);
1729
1730                count = (Long)q.uniqueResult();
1731            }
1732            catch (Exception e) {
1733                throw processException(e);
1734            }
1735            finally {
1736                if (count == null) {
1737                    count = Long.valueOf(0);
1738                }
1739
1740                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERGROUPID,
1741                    finderArgs, count);
1742
1743                closeSession(session);
1744            }
1745        }
1746
1747        return count.intValue();
1748    }
1749
1750    public int countByGroupId(long groupId) throws SystemException {
1751        Object[] finderArgs = new Object[] { new Long(groupId) };
1752
1753        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1754                finderArgs, this);
1755
1756        if (count == null) {
1757            Session session = null;
1758
1759            try {
1760                session = openSession();
1761
1762                StringBundler query = new StringBundler(2);
1763
1764                query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
1765
1766                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1767
1768                String sql = query.toString();
1769
1770                Query q = session.createQuery(sql);
1771
1772                QueryPos qPos = QueryPos.getInstance(q);
1773
1774                qPos.add(groupId);
1775
1776                count = (Long)q.uniqueResult();
1777            }
1778            catch (Exception e) {
1779                throw processException(e);
1780            }
1781            finally {
1782                if (count == null) {
1783                    count = Long.valueOf(0);
1784                }
1785
1786                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1787                    finderArgs, count);
1788
1789                closeSession(session);
1790            }
1791        }
1792
1793        return count.intValue();
1794    }
1795
1796    public int countByRoleId(long roleId) throws SystemException {
1797        Object[] finderArgs = new Object[] { new Long(roleId) };
1798
1799        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ROLEID,
1800                finderArgs, this);
1801
1802        if (count == null) {
1803            Session session = null;
1804
1805            try {
1806                session = openSession();
1807
1808                StringBundler query = new StringBundler(2);
1809
1810                query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
1811
1812                query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1813
1814                String sql = query.toString();
1815
1816                Query q = session.createQuery(sql);
1817
1818                QueryPos qPos = QueryPos.getInstance(q);
1819
1820                qPos.add(roleId);
1821
1822                count = (Long)q.uniqueResult();
1823            }
1824            catch (Exception e) {
1825                throw processException(e);
1826            }
1827            finally {
1828                if (count == null) {
1829                    count = Long.valueOf(0);
1830                }
1831
1832                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ROLEID,
1833                    finderArgs, count);
1834
1835                closeSession(session);
1836            }
1837        }
1838
1839        return count.intValue();
1840    }
1841
1842    public int countByU_G(long userGroupId, long groupId)
1843        throws SystemException {
1844        Object[] finderArgs = new Object[] {
1845                new Long(userGroupId), new Long(groupId)
1846            };
1847
1848        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_G,
1849                finderArgs, this);
1850
1851        if (count == null) {
1852            Session session = null;
1853
1854            try {
1855                session = openSession();
1856
1857                StringBundler query = new StringBundler(3);
1858
1859                query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
1860
1861                query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
1862
1863                query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1864
1865                String sql = query.toString();
1866
1867                Query q = session.createQuery(sql);
1868
1869                QueryPos qPos = QueryPos.getInstance(q);
1870
1871                qPos.add(userGroupId);
1872
1873                qPos.add(groupId);
1874
1875                count = (Long)q.uniqueResult();
1876            }
1877            catch (Exception e) {
1878                throw processException(e);
1879            }
1880            finally {
1881                if (count == null) {
1882                    count = Long.valueOf(0);
1883                }
1884
1885                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_G, finderArgs,
1886                    count);
1887
1888                closeSession(session);
1889            }
1890        }
1891
1892        return count.intValue();
1893    }
1894
1895    public int countByG_R(long groupId, long roleId) throws SystemException {
1896        Object[] finderArgs = new Object[] { new Long(groupId), new Long(roleId) };
1897
1898        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
1899                finderArgs, this);
1900
1901        if (count == null) {
1902            Session session = null;
1903
1904            try {
1905                session = openSession();
1906
1907                StringBundler query = new StringBundler(3);
1908
1909                query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
1910
1911                query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1912
1913                query.append(_FINDER_COLUMN_G_R_ROLEID_2);
1914
1915                String sql = query.toString();
1916
1917                Query q = session.createQuery(sql);
1918
1919                QueryPos qPos = QueryPos.getInstance(q);
1920
1921                qPos.add(groupId);
1922
1923                qPos.add(roleId);
1924
1925                count = (Long)q.uniqueResult();
1926            }
1927            catch (Exception e) {
1928                throw processException(e);
1929            }
1930            finally {
1931                if (count == null) {
1932                    count = Long.valueOf(0);
1933                }
1934
1935                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_R, finderArgs,
1936                    count);
1937
1938                closeSession(session);
1939            }
1940        }
1941
1942        return count.intValue();
1943    }
1944
1945    public int countAll() throws SystemException {
1946        Object[] finderArgs = new Object[0];
1947
1948        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1949                finderArgs, this);
1950
1951        if (count == null) {
1952            Session session = null;
1953
1954            try {
1955                session = openSession();
1956
1957                Query q = session.createQuery(_SQL_COUNT_USERGROUPGROUPROLE);
1958
1959                count = (Long)q.uniqueResult();
1960            }
1961            catch (Exception e) {
1962                throw processException(e);
1963            }
1964            finally {
1965                if (count == null) {
1966                    count = Long.valueOf(0);
1967                }
1968
1969                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1970                    count);
1971
1972                closeSession(session);
1973            }
1974        }
1975
1976        return count.intValue();
1977    }
1978
1979    public void afterPropertiesSet() {
1980        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1981                    com.liferay.portal.util.PropsUtil.get(
1982                        "value.object.listener.com.liferay.portal.model.UserGroupGroupRole")));
1983
1984        if (listenerClassNames.length > 0) {
1985            try {
1986                List<ModelListener<UserGroupGroupRole>> listenersList = new ArrayList<ModelListener<UserGroupGroupRole>>();
1987
1988                for (String listenerClassName : listenerClassNames) {
1989                    listenersList.add((ModelListener<UserGroupGroupRole>)Class.forName(
1990                            listenerClassName).newInstance());
1991                }
1992
1993                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1994            }
1995            catch (Exception e) {
1996                _log.error(e);
1997            }
1998        }
1999    }
2000
2001    @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence")
2002    protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
2003    @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence")
2004    protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
2005    @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence")
2006    protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
2007    @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence")
2008    protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
2009    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
2010    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
2011    @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence")
2012    protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
2013    @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence")
2014    protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
2015    @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence")
2016    protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
2017    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
2018    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
2019    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
2020    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
2021    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence")
2022    protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
2023    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPrototypePersistence")
2024    protected com.liferay.portal.service.persistence.LayoutPrototypePersistence layoutPrototypePersistence;
2025    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence")
2026    protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
2027    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPrototypePersistence")
2028    protected com.liferay.portal.service.persistence.LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2029    @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence")
2030    protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
2031    @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence")
2032    protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
2033    @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence")
2034    protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
2035    @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence")
2036    protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
2037    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence")
2038    protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2039    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence")
2040    protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
2041    @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence")
2042    protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
2043    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence")
2044    protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
2045    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence")
2046    protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2047    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence")
2048    protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
2049    @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence")
2050    protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
2051    @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence")
2052    protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
2053    @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence")
2054    protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
2055    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence")
2056    protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
2057    @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence")
2058    protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
2059    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
2060    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
2061    @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence")
2062    protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
2063    @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence")
2064    protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
2065    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
2066    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
2067    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence")
2068    protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
2069    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence")
2070    protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
2071    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence")
2072    protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
2073    @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence")
2074    protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
2075    @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence")
2076    protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
2077    @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence")
2078    protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
2079    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
2080    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
2081    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
2082    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
2083    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence")
2084    protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
2085    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupGroupRolePersistence")
2086    protected com.liferay.portal.service.persistence.UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2087    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence")
2088    protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
2089    @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence")
2090    protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
2091    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence")
2092    protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
2093    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence")
2094    protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
2095    @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence")
2096    protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
2097    @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence")
2098    protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
2099    @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence")
2100    protected com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2101    @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence")
2102    protected com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2103    private static final String _SQL_SELECT_USERGROUPGROUPROLE = "SELECT userGroupGroupRole FROM UserGroupGroupRole userGroupGroupRole";
2104    private static final String _SQL_SELECT_USERGROUPGROUPROLE_WHERE = "SELECT userGroupGroupRole FROM UserGroupGroupRole userGroupGroupRole WHERE ";
2105    private static final String _SQL_COUNT_USERGROUPGROUPROLE = "SELECT COUNT(userGroupGroupRole) FROM UserGroupGroupRole userGroupGroupRole";
2106    private static final String _SQL_COUNT_USERGROUPGROUPROLE_WHERE = "SELECT COUNT(userGroupGroupRole) FROM UserGroupGroupRole userGroupGroupRole WHERE ";
2107    private static final String _FINDER_COLUMN_USERGROUPID_USERGROUPID_2 = "userGroupGroupRole.id.userGroupId = ?";
2108    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "userGroupGroupRole.id.groupId = ?";
2109    private static final String _FINDER_COLUMN_ROLEID_ROLEID_2 = "userGroupGroupRole.id.roleId = ?";
2110    private static final String _FINDER_COLUMN_U_G_USERGROUPID_2 = "userGroupGroupRole.id.userGroupId = ? AND ";
2111    private static final String _FINDER_COLUMN_U_G_GROUPID_2 = "userGroupGroupRole.id.groupId = ?";
2112    private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "userGroupGroupRole.id.groupId = ? AND ";
2113    private static final String _FINDER_COLUMN_G_R_ROLEID_2 = "userGroupGroupRole.id.roleId = ?";
2114    private static final String _ORDER_BY_ENTITY_ALIAS = "userGroupGroupRole.";
2115    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserGroupGroupRole exists with the primary key ";
2116    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserGroupGroupRole exists with the key {";
2117    private static Log _log = LogFactoryUtil.getLog(UserGroupGroupRolePersistenceImpl.class);
2118}