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