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