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