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