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