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