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