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