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