001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchUserGroupGroupRoleException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.ModelListener;
039 import com.liferay.portal.model.UserGroupGroupRole;
040 import com.liferay.portal.model.impl.UserGroupGroupRoleImpl;
041 import com.liferay.portal.model.impl.UserGroupGroupRoleModelImpl;
042 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043
044 import java.io.Serializable;
045
046 import java.util.ArrayList;
047 import java.util.Collections;
048 import java.util.List;
049
050
062 public class UserGroupGroupRolePersistenceImpl extends BasePersistenceImpl<UserGroupGroupRole>
063 implements UserGroupGroupRolePersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = UserGroupGroupRoleImpl.class.getName();
070 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071 ".List1";
072 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073 ".List2";
074 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERGROUPID =
075 new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
076 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
077 UserGroupGroupRoleImpl.class,
078 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserGroupId",
079 new String[] {
080 Long.class.getName(),
081
082 "java.lang.Integer", "java.lang.Integer",
083 "com.liferay.portal.kernel.util.OrderByComparator"
084 });
085 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID =
086 new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
087 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
088 UserGroupGroupRoleImpl.class,
089 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserGroupId",
090 new String[] { Long.class.getName() },
091 UserGroupGroupRoleModelImpl.USERGROUPID_COLUMN_BITMASK);
092 public static final FinderPath FINDER_PATH_COUNT_BY_USERGROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
093 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
094 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserGroupId",
095 new String[] { Long.class.getName() });
096 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
097 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
098 UserGroupGroupRoleImpl.class,
099 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
100 new String[] {
101 Long.class.getName(),
102
103 "java.lang.Integer", "java.lang.Integer",
104 "com.liferay.portal.kernel.util.OrderByComparator"
105 });
106 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
107 new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
108 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
109 UserGroupGroupRoleImpl.class,
110 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
111 new String[] { Long.class.getName() },
112 UserGroupGroupRoleModelImpl.GROUPID_COLUMN_BITMASK);
113 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
114 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
115 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
116 new String[] { Long.class.getName() });
117 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ROLEID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
118 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
119 UserGroupGroupRoleImpl.class,
120 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByRoleId",
121 new String[] {
122 Long.class.getName(),
123
124 "java.lang.Integer", "java.lang.Integer",
125 "com.liferay.portal.kernel.util.OrderByComparator"
126 });
127 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID =
128 new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
129 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
130 UserGroupGroupRoleImpl.class,
131 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByRoleId",
132 new String[] { Long.class.getName() },
133 UserGroupGroupRoleModelImpl.ROLEID_COLUMN_BITMASK);
134 public static final FinderPath FINDER_PATH_COUNT_BY_ROLEID = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
135 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
136 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRoleId",
137 new String[] { Long.class.getName() });
138 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
139 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
140 UserGroupGroupRoleImpl.class,
141 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByU_G",
142 new String[] {
143 Long.class.getName(), Long.class.getName(),
144
145 "java.lang.Integer", "java.lang.Integer",
146 "com.liferay.portal.kernel.util.OrderByComparator"
147 });
148 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
149 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
150 UserGroupGroupRoleImpl.class,
151 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByU_G",
152 new String[] { Long.class.getName(), Long.class.getName() },
153 UserGroupGroupRoleModelImpl.USERGROUPID_COLUMN_BITMASK |
154 UserGroupGroupRoleModelImpl.GROUPID_COLUMN_BITMASK);
155 public static final FinderPath FINDER_PATH_COUNT_BY_U_G = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
156 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
157 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByU_G",
158 new String[] { Long.class.getName(), Long.class.getName() });
159 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
160 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
161 UserGroupGroupRoleImpl.class,
162 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_R",
163 new String[] {
164 Long.class.getName(), Long.class.getName(),
165
166 "java.lang.Integer", "java.lang.Integer",
167 "com.liferay.portal.kernel.util.OrderByComparator"
168 });
169 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
170 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
171 UserGroupGroupRoleImpl.class,
172 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_R",
173 new String[] { Long.class.getName(), Long.class.getName() },
174 UserGroupGroupRoleModelImpl.GROUPID_COLUMN_BITMASK |
175 UserGroupGroupRoleModelImpl.ROLEID_COLUMN_BITMASK);
176 public static final FinderPath FINDER_PATH_COUNT_BY_G_R = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
177 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
178 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_R",
179 new String[] { Long.class.getName(), Long.class.getName() });
180 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
181 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
182 UserGroupGroupRoleImpl.class,
183 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
184 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
185 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED,
186 UserGroupGroupRoleImpl.class,
187 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
188 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
189 UserGroupGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
190 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
191
192
197 public void cacheResult(UserGroupGroupRole userGroupGroupRole) {
198 EntityCacheUtil.putResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
199 UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey(),
200 userGroupGroupRole);
201
202 userGroupGroupRole.resetOriginalValues();
203 }
204
205
210 public void cacheResult(List<UserGroupGroupRole> userGroupGroupRoles) {
211 for (UserGroupGroupRole userGroupGroupRole : userGroupGroupRoles) {
212 if (EntityCacheUtil.getResult(
213 UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
214 UserGroupGroupRoleImpl.class,
215 userGroupGroupRole.getPrimaryKey()) == null) {
216 cacheResult(userGroupGroupRole);
217 }
218 else {
219 userGroupGroupRole.resetOriginalValues();
220 }
221 }
222 }
223
224
231 @Override
232 public void clearCache() {
233 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
234 CacheRegistryUtil.clear(UserGroupGroupRoleImpl.class.getName());
235 }
236
237 EntityCacheUtil.clearCache(UserGroupGroupRoleImpl.class.getName());
238
239 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
240 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
241 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
242 }
243
244
251 @Override
252 public void clearCache(UserGroupGroupRole userGroupGroupRole) {
253 EntityCacheUtil.removeResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
254 UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey());
255
256 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
257 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
258 }
259
260 @Override
261 public void clearCache(List<UserGroupGroupRole> userGroupGroupRoles) {
262 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
263 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
264
265 for (UserGroupGroupRole userGroupGroupRole : userGroupGroupRoles) {
266 EntityCacheUtil.removeResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
267 UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey());
268 }
269 }
270
271
277 public UserGroupGroupRole create(UserGroupGroupRolePK userGroupGroupRolePK) {
278 UserGroupGroupRole userGroupGroupRole = new UserGroupGroupRoleImpl();
279
280 userGroupGroupRole.setNew(true);
281 userGroupGroupRole.setPrimaryKey(userGroupGroupRolePK);
282
283 return userGroupGroupRole;
284 }
285
286
294 public UserGroupGroupRole remove(UserGroupGroupRolePK userGroupGroupRolePK)
295 throws NoSuchUserGroupGroupRoleException, SystemException {
296 return remove((Serializable)userGroupGroupRolePK);
297 }
298
299
307 @Override
308 public UserGroupGroupRole remove(Serializable primaryKey)
309 throws NoSuchUserGroupGroupRoleException, SystemException {
310 Session session = null;
311
312 try {
313 session = openSession();
314
315 UserGroupGroupRole userGroupGroupRole = (UserGroupGroupRole)session.get(UserGroupGroupRoleImpl.class,
316 primaryKey);
317
318 if (userGroupGroupRole == null) {
319 if (_log.isWarnEnabled()) {
320 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
321 }
322
323 throw new NoSuchUserGroupGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
324 primaryKey);
325 }
326
327 return remove(userGroupGroupRole);
328 }
329 catch (NoSuchUserGroupGroupRoleException nsee) {
330 throw nsee;
331 }
332 catch (Exception e) {
333 throw processException(e);
334 }
335 finally {
336 closeSession(session);
337 }
338 }
339
340 @Override
341 protected UserGroupGroupRole removeImpl(
342 UserGroupGroupRole userGroupGroupRole) throws SystemException {
343 userGroupGroupRole = toUnwrappedModel(userGroupGroupRole);
344
345 Session session = null;
346
347 try {
348 session = openSession();
349
350 if (userGroupGroupRole.isCachedModel()) {
351 userGroupGroupRole = (UserGroupGroupRole)session.get(UserGroupGroupRoleImpl.class,
352 userGroupGroupRole.getPrimaryKeyObj());
353 }
354
355 session.delete(userGroupGroupRole);
356 }
357 catch (Exception e) {
358 throw processException(e);
359 }
360 finally {
361 closeSession(session);
362 }
363
364 clearCache(userGroupGroupRole);
365
366 return userGroupGroupRole;
367 }
368
369 @Override
370 public UserGroupGroupRole updateImpl(
371 com.liferay.portal.model.UserGroupGroupRole userGroupGroupRole)
372 throws SystemException {
373 userGroupGroupRole = toUnwrappedModel(userGroupGroupRole);
374
375 boolean isNew = userGroupGroupRole.isNew();
376
377 UserGroupGroupRoleModelImpl userGroupGroupRoleModelImpl = (UserGroupGroupRoleModelImpl)userGroupGroupRole;
378
379 Session session = null;
380
381 try {
382 session = openSession();
383
384 if (userGroupGroupRole.isNew()) {
385 session.save(userGroupGroupRole);
386
387 userGroupGroupRole.setNew(false);
388 }
389 else {
390 session.merge(userGroupGroupRole);
391 }
392 }
393 catch (Exception e) {
394 throw processException(e);
395 }
396 finally {
397 closeSession(session);
398 }
399
400 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
401
402 if (isNew || !UserGroupGroupRoleModelImpl.COLUMN_BITMASK_ENABLED) {
403 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
404 }
405
406 else {
407 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
408 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID.getColumnBitmask()) != 0) {
409 Object[] args = new Object[] {
410 Long.valueOf(userGroupGroupRoleModelImpl.getOriginalUserGroupId())
411 };
412
413 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERGROUPID,
414 args);
415 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID,
416 args);
417
418 args = new Object[] {
419 Long.valueOf(userGroupGroupRoleModelImpl.getUserGroupId())
420 };
421
422 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERGROUPID,
423 args);
424 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID,
425 args);
426 }
427
428 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
429 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
430 Object[] args = new Object[] {
431 Long.valueOf(userGroupGroupRoleModelImpl.getOriginalGroupId())
432 };
433
434 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
435 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
436 args);
437
438 args = new Object[] {
439 Long.valueOf(userGroupGroupRoleModelImpl.getGroupId())
440 };
441
442 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
443 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
444 args);
445 }
446
447 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
448 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID.getColumnBitmask()) != 0) {
449 Object[] args = new Object[] {
450 Long.valueOf(userGroupGroupRoleModelImpl.getOriginalRoleId())
451 };
452
453 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ROLEID, args);
454 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID,
455 args);
456
457 args = new Object[] {
458 Long.valueOf(userGroupGroupRoleModelImpl.getRoleId())
459 };
460
461 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ROLEID, args);
462 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID,
463 args);
464 }
465
466 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
467 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G.getColumnBitmask()) != 0) {
468 Object[] args = new Object[] {
469 Long.valueOf(userGroupGroupRoleModelImpl.getOriginalUserGroupId()),
470 Long.valueOf(userGroupGroupRoleModelImpl.getOriginalGroupId())
471 };
472
473 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_G, args);
474 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G,
475 args);
476
477 args = new Object[] {
478 Long.valueOf(userGroupGroupRoleModelImpl.getUserGroupId()),
479 Long.valueOf(userGroupGroupRoleModelImpl.getGroupId())
480 };
481
482 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_G, args);
483 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G,
484 args);
485 }
486
487 if ((userGroupGroupRoleModelImpl.getColumnBitmask() &
488 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R.getColumnBitmask()) != 0) {
489 Object[] args = new Object[] {
490 Long.valueOf(userGroupGroupRoleModelImpl.getOriginalGroupId()),
491 Long.valueOf(userGroupGroupRoleModelImpl.getOriginalRoleId())
492 };
493
494 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_R, args);
495 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R,
496 args);
497
498 args = new Object[] {
499 Long.valueOf(userGroupGroupRoleModelImpl.getGroupId()),
500 Long.valueOf(userGroupGroupRoleModelImpl.getRoleId())
501 };
502
503 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_R, args);
504 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R,
505 args);
506 }
507 }
508
509 EntityCacheUtil.putResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
510 UserGroupGroupRoleImpl.class, userGroupGroupRole.getPrimaryKey(),
511 userGroupGroupRole);
512
513 return userGroupGroupRole;
514 }
515
516 protected UserGroupGroupRole toUnwrappedModel(
517 UserGroupGroupRole userGroupGroupRole) {
518 if (userGroupGroupRole instanceof UserGroupGroupRoleImpl) {
519 return userGroupGroupRole;
520 }
521
522 UserGroupGroupRoleImpl userGroupGroupRoleImpl = new UserGroupGroupRoleImpl();
523
524 userGroupGroupRoleImpl.setNew(userGroupGroupRole.isNew());
525 userGroupGroupRoleImpl.setPrimaryKey(userGroupGroupRole.getPrimaryKey());
526
527 userGroupGroupRoleImpl.setUserGroupId(userGroupGroupRole.getUserGroupId());
528 userGroupGroupRoleImpl.setGroupId(userGroupGroupRole.getGroupId());
529 userGroupGroupRoleImpl.setRoleId(userGroupGroupRole.getRoleId());
530
531 return userGroupGroupRoleImpl;
532 }
533
534
542 @Override
543 public UserGroupGroupRole findByPrimaryKey(Serializable primaryKey)
544 throws NoSuchModelException, SystemException {
545 return findByPrimaryKey((UserGroupGroupRolePK)primaryKey);
546 }
547
548
556 public UserGroupGroupRole findByPrimaryKey(
557 UserGroupGroupRolePK userGroupGroupRolePK)
558 throws NoSuchUserGroupGroupRoleException, SystemException {
559 UserGroupGroupRole userGroupGroupRole = fetchByPrimaryKey(userGroupGroupRolePK);
560
561 if (userGroupGroupRole == null) {
562 if (_log.isWarnEnabled()) {
563 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
564 userGroupGroupRolePK);
565 }
566
567 throw new NoSuchUserGroupGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
568 userGroupGroupRolePK);
569 }
570
571 return userGroupGroupRole;
572 }
573
574
581 @Override
582 public UserGroupGroupRole fetchByPrimaryKey(Serializable primaryKey)
583 throws SystemException {
584 return fetchByPrimaryKey((UserGroupGroupRolePK)primaryKey);
585 }
586
587
594 public UserGroupGroupRole fetchByPrimaryKey(
595 UserGroupGroupRolePK userGroupGroupRolePK) throws SystemException {
596 UserGroupGroupRole userGroupGroupRole = (UserGroupGroupRole)EntityCacheUtil.getResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
597 UserGroupGroupRoleImpl.class, userGroupGroupRolePK);
598
599 if (userGroupGroupRole == _nullUserGroupGroupRole) {
600 return null;
601 }
602
603 if (userGroupGroupRole == null) {
604 Session session = null;
605
606 boolean hasException = false;
607
608 try {
609 session = openSession();
610
611 userGroupGroupRole = (UserGroupGroupRole)session.get(UserGroupGroupRoleImpl.class,
612 userGroupGroupRolePK);
613 }
614 catch (Exception e) {
615 hasException = true;
616
617 throw processException(e);
618 }
619 finally {
620 if (userGroupGroupRole != null) {
621 cacheResult(userGroupGroupRole);
622 }
623 else if (!hasException) {
624 EntityCacheUtil.putResult(UserGroupGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
625 UserGroupGroupRoleImpl.class, userGroupGroupRolePK,
626 _nullUserGroupGroupRole);
627 }
628
629 closeSession(session);
630 }
631 }
632
633 return userGroupGroupRole;
634 }
635
636
643 public List<UserGroupGroupRole> findByUserGroupId(long userGroupId)
644 throws SystemException {
645 return findByUserGroupId(userGroupId, QueryUtil.ALL_POS,
646 QueryUtil.ALL_POS, null);
647 }
648
649
662 public List<UserGroupGroupRole> findByUserGroupId(long userGroupId,
663 int start, int end) throws SystemException {
664 return findByUserGroupId(userGroupId, start, end, null);
665 }
666
667
681 public List<UserGroupGroupRole> findByUserGroupId(long userGroupId,
682 int start, int end, OrderByComparator orderByComparator)
683 throws SystemException {
684 FinderPath finderPath = null;
685 Object[] finderArgs = null;
686
687 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
688 (orderByComparator == null)) {
689 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERGROUPID;
690 finderArgs = new Object[] { userGroupId };
691 }
692 else {
693 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERGROUPID;
694 finderArgs = new Object[] { userGroupId, start, end, orderByComparator };
695 }
696
697 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
698 finderArgs, this);
699
700 if ((list != null) && !list.isEmpty()) {
701 for (UserGroupGroupRole userGroupGroupRole : list) {
702 if ((userGroupId != userGroupGroupRole.getUserGroupId())) {
703 list = null;
704
705 break;
706 }
707 }
708 }
709
710 if (list == null) {
711 StringBundler query = null;
712
713 if (orderByComparator != null) {
714 query = new StringBundler(3 +
715 (orderByComparator.getOrderByFields().length * 3));
716 }
717 else {
718 query = new StringBundler(2);
719 }
720
721 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
722
723 query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
724
725 if (orderByComparator != null) {
726 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
727 orderByComparator);
728 }
729
730 String sql = query.toString();
731
732 Session session = null;
733
734 try {
735 session = openSession();
736
737 Query q = session.createQuery(sql);
738
739 QueryPos qPos = QueryPos.getInstance(q);
740
741 qPos.add(userGroupId);
742
743 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
744 getDialect(), start, end);
745 }
746 catch (Exception e) {
747 throw processException(e);
748 }
749 finally {
750 if (list == null) {
751 FinderCacheUtil.removeResult(finderPath, finderArgs);
752 }
753 else {
754 cacheResult(list);
755
756 FinderCacheUtil.putResult(finderPath, finderArgs, list);
757 }
758
759 closeSession(session);
760 }
761 }
762
763 return list;
764 }
765
766
775 public UserGroupGroupRole findByUserGroupId_First(long userGroupId,
776 OrderByComparator orderByComparator)
777 throws NoSuchUserGroupGroupRoleException, SystemException {
778 UserGroupGroupRole userGroupGroupRole = fetchByUserGroupId_First(userGroupId,
779 orderByComparator);
780
781 if (userGroupGroupRole != null) {
782 return userGroupGroupRole;
783 }
784
785 StringBundler msg = new StringBundler(4);
786
787 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
788
789 msg.append("userGroupId=");
790 msg.append(userGroupId);
791
792 msg.append(StringPool.CLOSE_CURLY_BRACE);
793
794 throw new NoSuchUserGroupGroupRoleException(msg.toString());
795 }
796
797
805 public UserGroupGroupRole fetchByUserGroupId_First(long userGroupId,
806 OrderByComparator orderByComparator) throws SystemException {
807 List<UserGroupGroupRole> list = findByUserGroupId(userGroupId, 0, 1,
808 orderByComparator);
809
810 if (!list.isEmpty()) {
811 return list.get(0);
812 }
813
814 return null;
815 }
816
817
826 public UserGroupGroupRole findByUserGroupId_Last(long userGroupId,
827 OrderByComparator orderByComparator)
828 throws NoSuchUserGroupGroupRoleException, SystemException {
829 UserGroupGroupRole userGroupGroupRole = fetchByUserGroupId_Last(userGroupId,
830 orderByComparator);
831
832 if (userGroupGroupRole != null) {
833 return userGroupGroupRole;
834 }
835
836 StringBundler msg = new StringBundler(4);
837
838 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
839
840 msg.append("userGroupId=");
841 msg.append(userGroupId);
842
843 msg.append(StringPool.CLOSE_CURLY_BRACE);
844
845 throw new NoSuchUserGroupGroupRoleException(msg.toString());
846 }
847
848
856 public UserGroupGroupRole fetchByUserGroupId_Last(long userGroupId,
857 OrderByComparator orderByComparator) throws SystemException {
858 int count = countByUserGroupId(userGroupId);
859
860 List<UserGroupGroupRole> list = findByUserGroupId(userGroupId,
861 count - 1, count, orderByComparator);
862
863 if (!list.isEmpty()) {
864 return list.get(0);
865 }
866
867 return null;
868 }
869
870
880 public UserGroupGroupRole[] findByUserGroupId_PrevAndNext(
881 UserGroupGroupRolePK userGroupGroupRolePK, long userGroupId,
882 OrderByComparator orderByComparator)
883 throws NoSuchUserGroupGroupRoleException, SystemException {
884 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
885
886 Session session = null;
887
888 try {
889 session = openSession();
890
891 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
892
893 array[0] = getByUserGroupId_PrevAndNext(session,
894 userGroupGroupRole, userGroupId, orderByComparator, true);
895
896 array[1] = userGroupGroupRole;
897
898 array[2] = getByUserGroupId_PrevAndNext(session,
899 userGroupGroupRole, userGroupId, orderByComparator, false);
900
901 return array;
902 }
903 catch (Exception e) {
904 throw processException(e);
905 }
906 finally {
907 closeSession(session);
908 }
909 }
910
911 protected UserGroupGroupRole getByUserGroupId_PrevAndNext(Session session,
912 UserGroupGroupRole userGroupGroupRole, long userGroupId,
913 OrderByComparator orderByComparator, boolean previous) {
914 StringBundler query = null;
915
916 if (orderByComparator != null) {
917 query = new StringBundler(6 +
918 (orderByComparator.getOrderByFields().length * 6));
919 }
920 else {
921 query = new StringBundler(3);
922 }
923
924 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
925
926 query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
927
928 if (orderByComparator != null) {
929 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
930
931 if (orderByConditionFields.length > 0) {
932 query.append(WHERE_AND);
933 }
934
935 for (int i = 0; i < orderByConditionFields.length; i++) {
936 query.append(_ORDER_BY_ENTITY_ALIAS);
937 query.append(orderByConditionFields[i]);
938
939 if ((i + 1) < orderByConditionFields.length) {
940 if (orderByComparator.isAscending() ^ previous) {
941 query.append(WHERE_GREATER_THAN_HAS_NEXT);
942 }
943 else {
944 query.append(WHERE_LESSER_THAN_HAS_NEXT);
945 }
946 }
947 else {
948 if (orderByComparator.isAscending() ^ previous) {
949 query.append(WHERE_GREATER_THAN);
950 }
951 else {
952 query.append(WHERE_LESSER_THAN);
953 }
954 }
955 }
956
957 query.append(ORDER_BY_CLAUSE);
958
959 String[] orderByFields = orderByComparator.getOrderByFields();
960
961 for (int i = 0; i < orderByFields.length; i++) {
962 query.append(_ORDER_BY_ENTITY_ALIAS);
963 query.append(orderByFields[i]);
964
965 if ((i + 1) < orderByFields.length) {
966 if (orderByComparator.isAscending() ^ previous) {
967 query.append(ORDER_BY_ASC_HAS_NEXT);
968 }
969 else {
970 query.append(ORDER_BY_DESC_HAS_NEXT);
971 }
972 }
973 else {
974 if (orderByComparator.isAscending() ^ previous) {
975 query.append(ORDER_BY_ASC);
976 }
977 else {
978 query.append(ORDER_BY_DESC);
979 }
980 }
981 }
982 }
983
984 String sql = query.toString();
985
986 Query q = session.createQuery(sql);
987
988 q.setFirstResult(0);
989 q.setMaxResults(2);
990
991 QueryPos qPos = QueryPos.getInstance(q);
992
993 qPos.add(userGroupId);
994
995 if (orderByComparator != null) {
996 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
997
998 for (Object value : values) {
999 qPos.add(value);
1000 }
1001 }
1002
1003 List<UserGroupGroupRole> list = q.list();
1004
1005 if (list.size() == 2) {
1006 return list.get(1);
1007 }
1008 else {
1009 return null;
1010 }
1011 }
1012
1013
1020 public List<UserGroupGroupRole> findByGroupId(long groupId)
1021 throws SystemException {
1022 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1023 }
1024
1025
1038 public List<UserGroupGroupRole> findByGroupId(long groupId, int start,
1039 int end) throws SystemException {
1040 return findByGroupId(groupId, start, end, null);
1041 }
1042
1043
1057 public List<UserGroupGroupRole> findByGroupId(long groupId, int start,
1058 int end, OrderByComparator orderByComparator) throws SystemException {
1059 FinderPath finderPath = null;
1060 Object[] finderArgs = null;
1061
1062 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1063 (orderByComparator == null)) {
1064 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1065 finderArgs = new Object[] { groupId };
1066 }
1067 else {
1068 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1069 finderArgs = new Object[] { groupId, start, end, orderByComparator };
1070 }
1071
1072 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
1073 finderArgs, this);
1074
1075 if ((list != null) && !list.isEmpty()) {
1076 for (UserGroupGroupRole userGroupGroupRole : list) {
1077 if ((groupId != userGroupGroupRole.getGroupId())) {
1078 list = null;
1079
1080 break;
1081 }
1082 }
1083 }
1084
1085 if (list == null) {
1086 StringBundler query = null;
1087
1088 if (orderByComparator != null) {
1089 query = new StringBundler(3 +
1090 (orderByComparator.getOrderByFields().length * 3));
1091 }
1092 else {
1093 query = new StringBundler(2);
1094 }
1095
1096 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1097
1098 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1099
1100 if (orderByComparator != null) {
1101 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1102 orderByComparator);
1103 }
1104
1105 String sql = query.toString();
1106
1107 Session session = null;
1108
1109 try {
1110 session = openSession();
1111
1112 Query q = session.createQuery(sql);
1113
1114 QueryPos qPos = QueryPos.getInstance(q);
1115
1116 qPos.add(groupId);
1117
1118 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1119 getDialect(), start, end);
1120 }
1121 catch (Exception e) {
1122 throw processException(e);
1123 }
1124 finally {
1125 if (list == null) {
1126 FinderCacheUtil.removeResult(finderPath, finderArgs);
1127 }
1128 else {
1129 cacheResult(list);
1130
1131 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1132 }
1133
1134 closeSession(session);
1135 }
1136 }
1137
1138 return list;
1139 }
1140
1141
1150 public UserGroupGroupRole findByGroupId_First(long groupId,
1151 OrderByComparator orderByComparator)
1152 throws NoSuchUserGroupGroupRoleException, SystemException {
1153 UserGroupGroupRole userGroupGroupRole = fetchByGroupId_First(groupId,
1154 orderByComparator);
1155
1156 if (userGroupGroupRole != null) {
1157 return userGroupGroupRole;
1158 }
1159
1160 StringBundler msg = new StringBundler(4);
1161
1162 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1163
1164 msg.append("groupId=");
1165 msg.append(groupId);
1166
1167 msg.append(StringPool.CLOSE_CURLY_BRACE);
1168
1169 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1170 }
1171
1172
1180 public UserGroupGroupRole fetchByGroupId_First(long groupId,
1181 OrderByComparator orderByComparator) throws SystemException {
1182 List<UserGroupGroupRole> list = findByGroupId(groupId, 0, 1,
1183 orderByComparator);
1184
1185 if (!list.isEmpty()) {
1186 return list.get(0);
1187 }
1188
1189 return null;
1190 }
1191
1192
1201 public UserGroupGroupRole findByGroupId_Last(long groupId,
1202 OrderByComparator orderByComparator)
1203 throws NoSuchUserGroupGroupRoleException, SystemException {
1204 UserGroupGroupRole userGroupGroupRole = fetchByGroupId_Last(groupId,
1205 orderByComparator);
1206
1207 if (userGroupGroupRole != null) {
1208 return userGroupGroupRole;
1209 }
1210
1211 StringBundler msg = new StringBundler(4);
1212
1213 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1214
1215 msg.append("groupId=");
1216 msg.append(groupId);
1217
1218 msg.append(StringPool.CLOSE_CURLY_BRACE);
1219
1220 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1221 }
1222
1223
1231 public UserGroupGroupRole fetchByGroupId_Last(long groupId,
1232 OrderByComparator orderByComparator) throws SystemException {
1233 int count = countByGroupId(groupId);
1234
1235 List<UserGroupGroupRole> list = findByGroupId(groupId, count - 1,
1236 count, orderByComparator);
1237
1238 if (!list.isEmpty()) {
1239 return list.get(0);
1240 }
1241
1242 return null;
1243 }
1244
1245
1255 public UserGroupGroupRole[] findByGroupId_PrevAndNext(
1256 UserGroupGroupRolePK userGroupGroupRolePK, long groupId,
1257 OrderByComparator orderByComparator)
1258 throws NoSuchUserGroupGroupRoleException, SystemException {
1259 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
1260
1261 Session session = null;
1262
1263 try {
1264 session = openSession();
1265
1266 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
1267
1268 array[0] = getByGroupId_PrevAndNext(session, userGroupGroupRole,
1269 groupId, orderByComparator, true);
1270
1271 array[1] = userGroupGroupRole;
1272
1273 array[2] = getByGroupId_PrevAndNext(session, userGroupGroupRole,
1274 groupId, orderByComparator, false);
1275
1276 return array;
1277 }
1278 catch (Exception e) {
1279 throw processException(e);
1280 }
1281 finally {
1282 closeSession(session);
1283 }
1284 }
1285
1286 protected UserGroupGroupRole getByGroupId_PrevAndNext(Session session,
1287 UserGroupGroupRole userGroupGroupRole, long groupId,
1288 OrderByComparator orderByComparator, boolean previous) {
1289 StringBundler query = null;
1290
1291 if (orderByComparator != null) {
1292 query = new StringBundler(6 +
1293 (orderByComparator.getOrderByFields().length * 6));
1294 }
1295 else {
1296 query = new StringBundler(3);
1297 }
1298
1299 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1300
1301 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1302
1303 if (orderByComparator != null) {
1304 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1305
1306 if (orderByConditionFields.length > 0) {
1307 query.append(WHERE_AND);
1308 }
1309
1310 for (int i = 0; i < orderByConditionFields.length; i++) {
1311 query.append(_ORDER_BY_ENTITY_ALIAS);
1312 query.append(orderByConditionFields[i]);
1313
1314 if ((i + 1) < orderByConditionFields.length) {
1315 if (orderByComparator.isAscending() ^ previous) {
1316 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1317 }
1318 else {
1319 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1320 }
1321 }
1322 else {
1323 if (orderByComparator.isAscending() ^ previous) {
1324 query.append(WHERE_GREATER_THAN);
1325 }
1326 else {
1327 query.append(WHERE_LESSER_THAN);
1328 }
1329 }
1330 }
1331
1332 query.append(ORDER_BY_CLAUSE);
1333
1334 String[] orderByFields = orderByComparator.getOrderByFields();
1335
1336 for (int i = 0; i < orderByFields.length; i++) {
1337 query.append(_ORDER_BY_ENTITY_ALIAS);
1338 query.append(orderByFields[i]);
1339
1340 if ((i + 1) < orderByFields.length) {
1341 if (orderByComparator.isAscending() ^ previous) {
1342 query.append(ORDER_BY_ASC_HAS_NEXT);
1343 }
1344 else {
1345 query.append(ORDER_BY_DESC_HAS_NEXT);
1346 }
1347 }
1348 else {
1349 if (orderByComparator.isAscending() ^ previous) {
1350 query.append(ORDER_BY_ASC);
1351 }
1352 else {
1353 query.append(ORDER_BY_DESC);
1354 }
1355 }
1356 }
1357 }
1358
1359 String sql = query.toString();
1360
1361 Query q = session.createQuery(sql);
1362
1363 q.setFirstResult(0);
1364 q.setMaxResults(2);
1365
1366 QueryPos qPos = QueryPos.getInstance(q);
1367
1368 qPos.add(groupId);
1369
1370 if (orderByComparator != null) {
1371 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
1372
1373 for (Object value : values) {
1374 qPos.add(value);
1375 }
1376 }
1377
1378 List<UserGroupGroupRole> list = q.list();
1379
1380 if (list.size() == 2) {
1381 return list.get(1);
1382 }
1383 else {
1384 return null;
1385 }
1386 }
1387
1388
1395 public List<UserGroupGroupRole> findByRoleId(long roleId)
1396 throws SystemException {
1397 return findByRoleId(roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1398 }
1399
1400
1413 public List<UserGroupGroupRole> findByRoleId(long roleId, int start, int end)
1414 throws SystemException {
1415 return findByRoleId(roleId, start, end, null);
1416 }
1417
1418
1432 public List<UserGroupGroupRole> findByRoleId(long roleId, int start,
1433 int end, OrderByComparator orderByComparator) throws SystemException {
1434 FinderPath finderPath = null;
1435 Object[] finderArgs = null;
1436
1437 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1438 (orderByComparator == null)) {
1439 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID;
1440 finderArgs = new Object[] { roleId };
1441 }
1442 else {
1443 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ROLEID;
1444 finderArgs = new Object[] { roleId, start, end, orderByComparator };
1445 }
1446
1447 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
1448 finderArgs, this);
1449
1450 if ((list != null) && !list.isEmpty()) {
1451 for (UserGroupGroupRole userGroupGroupRole : list) {
1452 if ((roleId != userGroupGroupRole.getRoleId())) {
1453 list = null;
1454
1455 break;
1456 }
1457 }
1458 }
1459
1460 if (list == null) {
1461 StringBundler query = null;
1462
1463 if (orderByComparator != null) {
1464 query = new StringBundler(3 +
1465 (orderByComparator.getOrderByFields().length * 3));
1466 }
1467 else {
1468 query = new StringBundler(2);
1469 }
1470
1471 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1472
1473 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1474
1475 if (orderByComparator != null) {
1476 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1477 orderByComparator);
1478 }
1479
1480 String sql = query.toString();
1481
1482 Session session = null;
1483
1484 try {
1485 session = openSession();
1486
1487 Query q = session.createQuery(sql);
1488
1489 QueryPos qPos = QueryPos.getInstance(q);
1490
1491 qPos.add(roleId);
1492
1493 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1494 getDialect(), start, end);
1495 }
1496 catch (Exception e) {
1497 throw processException(e);
1498 }
1499 finally {
1500 if (list == null) {
1501 FinderCacheUtil.removeResult(finderPath, finderArgs);
1502 }
1503 else {
1504 cacheResult(list);
1505
1506 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1507 }
1508
1509 closeSession(session);
1510 }
1511 }
1512
1513 return list;
1514 }
1515
1516
1525 public UserGroupGroupRole findByRoleId_First(long roleId,
1526 OrderByComparator orderByComparator)
1527 throws NoSuchUserGroupGroupRoleException, SystemException {
1528 UserGroupGroupRole userGroupGroupRole = fetchByRoleId_First(roleId,
1529 orderByComparator);
1530
1531 if (userGroupGroupRole != null) {
1532 return userGroupGroupRole;
1533 }
1534
1535 StringBundler msg = new StringBundler(4);
1536
1537 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1538
1539 msg.append("roleId=");
1540 msg.append(roleId);
1541
1542 msg.append(StringPool.CLOSE_CURLY_BRACE);
1543
1544 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1545 }
1546
1547
1555 public UserGroupGroupRole fetchByRoleId_First(long roleId,
1556 OrderByComparator orderByComparator) throws SystemException {
1557 List<UserGroupGroupRole> list = findByRoleId(roleId, 0, 1,
1558 orderByComparator);
1559
1560 if (!list.isEmpty()) {
1561 return list.get(0);
1562 }
1563
1564 return null;
1565 }
1566
1567
1576 public UserGroupGroupRole findByRoleId_Last(long roleId,
1577 OrderByComparator orderByComparator)
1578 throws NoSuchUserGroupGroupRoleException, SystemException {
1579 UserGroupGroupRole userGroupGroupRole = fetchByRoleId_Last(roleId,
1580 orderByComparator);
1581
1582 if (userGroupGroupRole != null) {
1583 return userGroupGroupRole;
1584 }
1585
1586 StringBundler msg = new StringBundler(4);
1587
1588 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1589
1590 msg.append("roleId=");
1591 msg.append(roleId);
1592
1593 msg.append(StringPool.CLOSE_CURLY_BRACE);
1594
1595 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1596 }
1597
1598
1606 public UserGroupGroupRole fetchByRoleId_Last(long roleId,
1607 OrderByComparator orderByComparator) throws SystemException {
1608 int count = countByRoleId(roleId);
1609
1610 List<UserGroupGroupRole> list = findByRoleId(roleId, count - 1, count,
1611 orderByComparator);
1612
1613 if (!list.isEmpty()) {
1614 return list.get(0);
1615 }
1616
1617 return null;
1618 }
1619
1620
1630 public UserGroupGroupRole[] findByRoleId_PrevAndNext(
1631 UserGroupGroupRolePK userGroupGroupRolePK, long roleId,
1632 OrderByComparator orderByComparator)
1633 throws NoSuchUserGroupGroupRoleException, SystemException {
1634 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
1635
1636 Session session = null;
1637
1638 try {
1639 session = openSession();
1640
1641 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
1642
1643 array[0] = getByRoleId_PrevAndNext(session, userGroupGroupRole,
1644 roleId, orderByComparator, true);
1645
1646 array[1] = userGroupGroupRole;
1647
1648 array[2] = getByRoleId_PrevAndNext(session, userGroupGroupRole,
1649 roleId, orderByComparator, false);
1650
1651 return array;
1652 }
1653 catch (Exception e) {
1654 throw processException(e);
1655 }
1656 finally {
1657 closeSession(session);
1658 }
1659 }
1660
1661 protected UserGroupGroupRole getByRoleId_PrevAndNext(Session session,
1662 UserGroupGroupRole userGroupGroupRole, long roleId,
1663 OrderByComparator orderByComparator, boolean previous) {
1664 StringBundler query = null;
1665
1666 if (orderByComparator != null) {
1667 query = new StringBundler(6 +
1668 (orderByComparator.getOrderByFields().length * 6));
1669 }
1670 else {
1671 query = new StringBundler(3);
1672 }
1673
1674 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1675
1676 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1677
1678 if (orderByComparator != null) {
1679 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1680
1681 if (orderByConditionFields.length > 0) {
1682 query.append(WHERE_AND);
1683 }
1684
1685 for (int i = 0; i < orderByConditionFields.length; i++) {
1686 query.append(_ORDER_BY_ENTITY_ALIAS);
1687 query.append(orderByConditionFields[i]);
1688
1689 if ((i + 1) < orderByConditionFields.length) {
1690 if (orderByComparator.isAscending() ^ previous) {
1691 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1692 }
1693 else {
1694 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1695 }
1696 }
1697 else {
1698 if (orderByComparator.isAscending() ^ previous) {
1699 query.append(WHERE_GREATER_THAN);
1700 }
1701 else {
1702 query.append(WHERE_LESSER_THAN);
1703 }
1704 }
1705 }
1706
1707 query.append(ORDER_BY_CLAUSE);
1708
1709 String[] orderByFields = orderByComparator.getOrderByFields();
1710
1711 for (int i = 0; i < orderByFields.length; i++) {
1712 query.append(_ORDER_BY_ENTITY_ALIAS);
1713 query.append(orderByFields[i]);
1714
1715 if ((i + 1) < orderByFields.length) {
1716 if (orderByComparator.isAscending() ^ previous) {
1717 query.append(ORDER_BY_ASC_HAS_NEXT);
1718 }
1719 else {
1720 query.append(ORDER_BY_DESC_HAS_NEXT);
1721 }
1722 }
1723 else {
1724 if (orderByComparator.isAscending() ^ previous) {
1725 query.append(ORDER_BY_ASC);
1726 }
1727 else {
1728 query.append(ORDER_BY_DESC);
1729 }
1730 }
1731 }
1732 }
1733
1734 String sql = query.toString();
1735
1736 Query q = session.createQuery(sql);
1737
1738 q.setFirstResult(0);
1739 q.setMaxResults(2);
1740
1741 QueryPos qPos = QueryPos.getInstance(q);
1742
1743 qPos.add(roleId);
1744
1745 if (orderByComparator != null) {
1746 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
1747
1748 for (Object value : values) {
1749 qPos.add(value);
1750 }
1751 }
1752
1753 List<UserGroupGroupRole> list = q.list();
1754
1755 if (list.size() == 2) {
1756 return list.get(1);
1757 }
1758 else {
1759 return null;
1760 }
1761 }
1762
1763
1771 public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId)
1772 throws SystemException {
1773 return findByU_G(userGroupId, groupId, QueryUtil.ALL_POS,
1774 QueryUtil.ALL_POS, null);
1775 }
1776
1777
1791 public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId,
1792 int start, int end) throws SystemException {
1793 return findByU_G(userGroupId, groupId, start, end, null);
1794 }
1795
1796
1811 public List<UserGroupGroupRole> findByU_G(long userGroupId, long groupId,
1812 int start, int end, OrderByComparator orderByComparator)
1813 throws SystemException {
1814 FinderPath finderPath = null;
1815 Object[] finderArgs = null;
1816
1817 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1818 (orderByComparator == null)) {
1819 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G;
1820 finderArgs = new Object[] { userGroupId, groupId };
1821 }
1822 else {
1823 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_U_G;
1824 finderArgs = new Object[] {
1825 userGroupId, groupId,
1826
1827 start, end, orderByComparator
1828 };
1829 }
1830
1831 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
1832 finderArgs, this);
1833
1834 if ((list != null) && !list.isEmpty()) {
1835 for (UserGroupGroupRole userGroupGroupRole : list) {
1836 if ((userGroupId != userGroupGroupRole.getUserGroupId()) ||
1837 (groupId != userGroupGroupRole.getGroupId())) {
1838 list = null;
1839
1840 break;
1841 }
1842 }
1843 }
1844
1845 if (list == null) {
1846 StringBundler query = null;
1847
1848 if (orderByComparator != null) {
1849 query = new StringBundler(4 +
1850 (orderByComparator.getOrderByFields().length * 3));
1851 }
1852 else {
1853 query = new StringBundler(3);
1854 }
1855
1856 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
1857
1858 query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
1859
1860 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
1861
1862 if (orderByComparator != null) {
1863 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1864 orderByComparator);
1865 }
1866
1867 String sql = query.toString();
1868
1869 Session session = null;
1870
1871 try {
1872 session = openSession();
1873
1874 Query q = session.createQuery(sql);
1875
1876 QueryPos qPos = QueryPos.getInstance(q);
1877
1878 qPos.add(userGroupId);
1879
1880 qPos.add(groupId);
1881
1882 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
1883 getDialect(), start, end);
1884 }
1885 catch (Exception e) {
1886 throw processException(e);
1887 }
1888 finally {
1889 if (list == null) {
1890 FinderCacheUtil.removeResult(finderPath, finderArgs);
1891 }
1892 else {
1893 cacheResult(list);
1894
1895 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1896 }
1897
1898 closeSession(session);
1899 }
1900 }
1901
1902 return list;
1903 }
1904
1905
1915 public UserGroupGroupRole findByU_G_First(long userGroupId, long groupId,
1916 OrderByComparator orderByComparator)
1917 throws NoSuchUserGroupGroupRoleException, SystemException {
1918 UserGroupGroupRole userGroupGroupRole = fetchByU_G_First(userGroupId,
1919 groupId, orderByComparator);
1920
1921 if (userGroupGroupRole != null) {
1922 return userGroupGroupRole;
1923 }
1924
1925 StringBundler msg = new StringBundler(6);
1926
1927 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1928
1929 msg.append("userGroupId=");
1930 msg.append(userGroupId);
1931
1932 msg.append(", groupId=");
1933 msg.append(groupId);
1934
1935 msg.append(StringPool.CLOSE_CURLY_BRACE);
1936
1937 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1938 }
1939
1940
1949 public UserGroupGroupRole fetchByU_G_First(long userGroupId, long groupId,
1950 OrderByComparator orderByComparator) throws SystemException {
1951 List<UserGroupGroupRole> list = findByU_G(userGroupId, groupId, 0, 1,
1952 orderByComparator);
1953
1954 if (!list.isEmpty()) {
1955 return list.get(0);
1956 }
1957
1958 return null;
1959 }
1960
1961
1971 public UserGroupGroupRole findByU_G_Last(long userGroupId, long groupId,
1972 OrderByComparator orderByComparator)
1973 throws NoSuchUserGroupGroupRoleException, SystemException {
1974 UserGroupGroupRole userGroupGroupRole = fetchByU_G_Last(userGroupId,
1975 groupId, orderByComparator);
1976
1977 if (userGroupGroupRole != null) {
1978 return userGroupGroupRole;
1979 }
1980
1981 StringBundler msg = new StringBundler(6);
1982
1983 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1984
1985 msg.append("userGroupId=");
1986 msg.append(userGroupId);
1987
1988 msg.append(", groupId=");
1989 msg.append(groupId);
1990
1991 msg.append(StringPool.CLOSE_CURLY_BRACE);
1992
1993 throw new NoSuchUserGroupGroupRoleException(msg.toString());
1994 }
1995
1996
2005 public UserGroupGroupRole fetchByU_G_Last(long userGroupId, long groupId,
2006 OrderByComparator orderByComparator) throws SystemException {
2007 int count = countByU_G(userGroupId, groupId);
2008
2009 List<UserGroupGroupRole> list = findByU_G(userGroupId, groupId,
2010 count - 1, count, orderByComparator);
2011
2012 if (!list.isEmpty()) {
2013 return list.get(0);
2014 }
2015
2016 return null;
2017 }
2018
2019
2030 public UserGroupGroupRole[] findByU_G_PrevAndNext(
2031 UserGroupGroupRolePK userGroupGroupRolePK, long userGroupId,
2032 long groupId, OrderByComparator orderByComparator)
2033 throws NoSuchUserGroupGroupRoleException, SystemException {
2034 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
2035
2036 Session session = null;
2037
2038 try {
2039 session = openSession();
2040
2041 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
2042
2043 array[0] = getByU_G_PrevAndNext(session, userGroupGroupRole,
2044 userGroupId, groupId, orderByComparator, true);
2045
2046 array[1] = userGroupGroupRole;
2047
2048 array[2] = getByU_G_PrevAndNext(session, userGroupGroupRole,
2049 userGroupId, groupId, orderByComparator, false);
2050
2051 return array;
2052 }
2053 catch (Exception e) {
2054 throw processException(e);
2055 }
2056 finally {
2057 closeSession(session);
2058 }
2059 }
2060
2061 protected UserGroupGroupRole getByU_G_PrevAndNext(Session session,
2062 UserGroupGroupRole userGroupGroupRole, long userGroupId, long groupId,
2063 OrderByComparator orderByComparator, boolean previous) {
2064 StringBundler query = null;
2065
2066 if (orderByComparator != null) {
2067 query = new StringBundler(6 +
2068 (orderByComparator.getOrderByFields().length * 6));
2069 }
2070 else {
2071 query = new StringBundler(3);
2072 }
2073
2074 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
2075
2076 query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
2077
2078 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
2079
2080 if (orderByComparator != null) {
2081 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2082
2083 if (orderByConditionFields.length > 0) {
2084 query.append(WHERE_AND);
2085 }
2086
2087 for (int i = 0; i < orderByConditionFields.length; i++) {
2088 query.append(_ORDER_BY_ENTITY_ALIAS);
2089 query.append(orderByConditionFields[i]);
2090
2091 if ((i + 1) < orderByConditionFields.length) {
2092 if (orderByComparator.isAscending() ^ previous) {
2093 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2094 }
2095 else {
2096 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2097 }
2098 }
2099 else {
2100 if (orderByComparator.isAscending() ^ previous) {
2101 query.append(WHERE_GREATER_THAN);
2102 }
2103 else {
2104 query.append(WHERE_LESSER_THAN);
2105 }
2106 }
2107 }
2108
2109 query.append(ORDER_BY_CLAUSE);
2110
2111 String[] orderByFields = orderByComparator.getOrderByFields();
2112
2113 for (int i = 0; i < orderByFields.length; i++) {
2114 query.append(_ORDER_BY_ENTITY_ALIAS);
2115 query.append(orderByFields[i]);
2116
2117 if ((i + 1) < orderByFields.length) {
2118 if (orderByComparator.isAscending() ^ previous) {
2119 query.append(ORDER_BY_ASC_HAS_NEXT);
2120 }
2121 else {
2122 query.append(ORDER_BY_DESC_HAS_NEXT);
2123 }
2124 }
2125 else {
2126 if (orderByComparator.isAscending() ^ previous) {
2127 query.append(ORDER_BY_ASC);
2128 }
2129 else {
2130 query.append(ORDER_BY_DESC);
2131 }
2132 }
2133 }
2134 }
2135
2136 String sql = query.toString();
2137
2138 Query q = session.createQuery(sql);
2139
2140 q.setFirstResult(0);
2141 q.setMaxResults(2);
2142
2143 QueryPos qPos = QueryPos.getInstance(q);
2144
2145 qPos.add(userGroupId);
2146
2147 qPos.add(groupId);
2148
2149 if (orderByComparator != null) {
2150 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
2151
2152 for (Object value : values) {
2153 qPos.add(value);
2154 }
2155 }
2156
2157 List<UserGroupGroupRole> list = q.list();
2158
2159 if (list.size() == 2) {
2160 return list.get(1);
2161 }
2162 else {
2163 return null;
2164 }
2165 }
2166
2167
2175 public List<UserGroupGroupRole> findByG_R(long groupId, long roleId)
2176 throws SystemException {
2177 return findByG_R(groupId, roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2178 null);
2179 }
2180
2181
2195 public List<UserGroupGroupRole> findByG_R(long groupId, long roleId,
2196 int start, int end) throws SystemException {
2197 return findByG_R(groupId, roleId, start, end, null);
2198 }
2199
2200
2215 public List<UserGroupGroupRole> findByG_R(long groupId, long roleId,
2216 int start, int end, OrderByComparator orderByComparator)
2217 throws SystemException {
2218 FinderPath finderPath = null;
2219 Object[] finderArgs = null;
2220
2221 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2222 (orderByComparator == null)) {
2223 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_R;
2224 finderArgs = new Object[] { groupId, roleId };
2225 }
2226 else {
2227 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_R;
2228 finderArgs = new Object[] {
2229 groupId, roleId,
2230
2231 start, end, orderByComparator
2232 };
2233 }
2234
2235 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
2236 finderArgs, this);
2237
2238 if ((list != null) && !list.isEmpty()) {
2239 for (UserGroupGroupRole userGroupGroupRole : list) {
2240 if ((groupId != userGroupGroupRole.getGroupId()) ||
2241 (roleId != userGroupGroupRole.getRoleId())) {
2242 list = null;
2243
2244 break;
2245 }
2246 }
2247 }
2248
2249 if (list == null) {
2250 StringBundler query = null;
2251
2252 if (orderByComparator != null) {
2253 query = new StringBundler(4 +
2254 (orderByComparator.getOrderByFields().length * 3));
2255 }
2256 else {
2257 query = new StringBundler(3);
2258 }
2259
2260 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
2261
2262 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2263
2264 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2265
2266 if (orderByComparator != null) {
2267 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2268 orderByComparator);
2269 }
2270
2271 String sql = query.toString();
2272
2273 Session session = null;
2274
2275 try {
2276 session = openSession();
2277
2278 Query q = session.createQuery(sql);
2279
2280 QueryPos qPos = QueryPos.getInstance(q);
2281
2282 qPos.add(groupId);
2283
2284 qPos.add(roleId);
2285
2286 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
2287 getDialect(), start, end);
2288 }
2289 catch (Exception e) {
2290 throw processException(e);
2291 }
2292 finally {
2293 if (list == null) {
2294 FinderCacheUtil.removeResult(finderPath, finderArgs);
2295 }
2296 else {
2297 cacheResult(list);
2298
2299 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2300 }
2301
2302 closeSession(session);
2303 }
2304 }
2305
2306 return list;
2307 }
2308
2309
2319 public UserGroupGroupRole findByG_R_First(long groupId, long roleId,
2320 OrderByComparator orderByComparator)
2321 throws NoSuchUserGroupGroupRoleException, SystemException {
2322 UserGroupGroupRole userGroupGroupRole = fetchByG_R_First(groupId,
2323 roleId, orderByComparator);
2324
2325 if (userGroupGroupRole != null) {
2326 return userGroupGroupRole;
2327 }
2328
2329 StringBundler msg = new StringBundler(6);
2330
2331 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2332
2333 msg.append("groupId=");
2334 msg.append(groupId);
2335
2336 msg.append(", roleId=");
2337 msg.append(roleId);
2338
2339 msg.append(StringPool.CLOSE_CURLY_BRACE);
2340
2341 throw new NoSuchUserGroupGroupRoleException(msg.toString());
2342 }
2343
2344
2353 public UserGroupGroupRole fetchByG_R_First(long groupId, long roleId,
2354 OrderByComparator orderByComparator) throws SystemException {
2355 List<UserGroupGroupRole> list = findByG_R(groupId, roleId, 0, 1,
2356 orderByComparator);
2357
2358 if (!list.isEmpty()) {
2359 return list.get(0);
2360 }
2361
2362 return null;
2363 }
2364
2365
2375 public UserGroupGroupRole findByG_R_Last(long groupId, long roleId,
2376 OrderByComparator orderByComparator)
2377 throws NoSuchUserGroupGroupRoleException, SystemException {
2378 UserGroupGroupRole userGroupGroupRole = fetchByG_R_Last(groupId,
2379 roleId, orderByComparator);
2380
2381 if (userGroupGroupRole != null) {
2382 return userGroupGroupRole;
2383 }
2384
2385 StringBundler msg = new StringBundler(6);
2386
2387 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2388
2389 msg.append("groupId=");
2390 msg.append(groupId);
2391
2392 msg.append(", roleId=");
2393 msg.append(roleId);
2394
2395 msg.append(StringPool.CLOSE_CURLY_BRACE);
2396
2397 throw new NoSuchUserGroupGroupRoleException(msg.toString());
2398 }
2399
2400
2409 public UserGroupGroupRole fetchByG_R_Last(long groupId, long roleId,
2410 OrderByComparator orderByComparator) throws SystemException {
2411 int count = countByG_R(groupId, roleId);
2412
2413 List<UserGroupGroupRole> list = findByG_R(groupId, roleId, count - 1,
2414 count, orderByComparator);
2415
2416 if (!list.isEmpty()) {
2417 return list.get(0);
2418 }
2419
2420 return null;
2421 }
2422
2423
2434 public UserGroupGroupRole[] findByG_R_PrevAndNext(
2435 UserGroupGroupRolePK userGroupGroupRolePK, long groupId, long roleId,
2436 OrderByComparator orderByComparator)
2437 throws NoSuchUserGroupGroupRoleException, SystemException {
2438 UserGroupGroupRole userGroupGroupRole = findByPrimaryKey(userGroupGroupRolePK);
2439
2440 Session session = null;
2441
2442 try {
2443 session = openSession();
2444
2445 UserGroupGroupRole[] array = new UserGroupGroupRoleImpl[3];
2446
2447 array[0] = getByG_R_PrevAndNext(session, userGroupGroupRole,
2448 groupId, roleId, orderByComparator, true);
2449
2450 array[1] = userGroupGroupRole;
2451
2452 array[2] = getByG_R_PrevAndNext(session, userGroupGroupRole,
2453 groupId, roleId, orderByComparator, false);
2454
2455 return array;
2456 }
2457 catch (Exception e) {
2458 throw processException(e);
2459 }
2460 finally {
2461 closeSession(session);
2462 }
2463 }
2464
2465 protected UserGroupGroupRole getByG_R_PrevAndNext(Session session,
2466 UserGroupGroupRole userGroupGroupRole, long groupId, long roleId,
2467 OrderByComparator orderByComparator, boolean previous) {
2468 StringBundler query = null;
2469
2470 if (orderByComparator != null) {
2471 query = new StringBundler(6 +
2472 (orderByComparator.getOrderByFields().length * 6));
2473 }
2474 else {
2475 query = new StringBundler(3);
2476 }
2477
2478 query.append(_SQL_SELECT_USERGROUPGROUPROLE_WHERE);
2479
2480 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2481
2482 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
2483
2484 if (orderByComparator != null) {
2485 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2486
2487 if (orderByConditionFields.length > 0) {
2488 query.append(WHERE_AND);
2489 }
2490
2491 for (int i = 0; i < orderByConditionFields.length; i++) {
2492 query.append(_ORDER_BY_ENTITY_ALIAS);
2493 query.append(orderByConditionFields[i]);
2494
2495 if ((i + 1) < orderByConditionFields.length) {
2496 if (orderByComparator.isAscending() ^ previous) {
2497 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2498 }
2499 else {
2500 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2501 }
2502 }
2503 else {
2504 if (orderByComparator.isAscending() ^ previous) {
2505 query.append(WHERE_GREATER_THAN);
2506 }
2507 else {
2508 query.append(WHERE_LESSER_THAN);
2509 }
2510 }
2511 }
2512
2513 query.append(ORDER_BY_CLAUSE);
2514
2515 String[] orderByFields = orderByComparator.getOrderByFields();
2516
2517 for (int i = 0; i < orderByFields.length; i++) {
2518 query.append(_ORDER_BY_ENTITY_ALIAS);
2519 query.append(orderByFields[i]);
2520
2521 if ((i + 1) < orderByFields.length) {
2522 if (orderByComparator.isAscending() ^ previous) {
2523 query.append(ORDER_BY_ASC_HAS_NEXT);
2524 }
2525 else {
2526 query.append(ORDER_BY_DESC_HAS_NEXT);
2527 }
2528 }
2529 else {
2530 if (orderByComparator.isAscending() ^ previous) {
2531 query.append(ORDER_BY_ASC);
2532 }
2533 else {
2534 query.append(ORDER_BY_DESC);
2535 }
2536 }
2537 }
2538 }
2539
2540 String sql = query.toString();
2541
2542 Query q = session.createQuery(sql);
2543
2544 q.setFirstResult(0);
2545 q.setMaxResults(2);
2546
2547 QueryPos qPos = QueryPos.getInstance(q);
2548
2549 qPos.add(groupId);
2550
2551 qPos.add(roleId);
2552
2553 if (orderByComparator != null) {
2554 Object[] values = orderByComparator.getOrderByConditionValues(userGroupGroupRole);
2555
2556 for (Object value : values) {
2557 qPos.add(value);
2558 }
2559 }
2560
2561 List<UserGroupGroupRole> list = q.list();
2562
2563 if (list.size() == 2) {
2564 return list.get(1);
2565 }
2566 else {
2567 return null;
2568 }
2569 }
2570
2571
2577 public List<UserGroupGroupRole> findAll() throws SystemException {
2578 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2579 }
2580
2581
2593 public List<UserGroupGroupRole> findAll(int start, int end)
2594 throws SystemException {
2595 return findAll(start, end, null);
2596 }
2597
2598
2611 public List<UserGroupGroupRole> findAll(int start, int end,
2612 OrderByComparator orderByComparator) throws SystemException {
2613 FinderPath finderPath = null;
2614 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2615
2616 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2617 (orderByComparator == null)) {
2618 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2619 finderArgs = FINDER_ARGS_EMPTY;
2620 }
2621 else {
2622 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2623 finderArgs = new Object[] { start, end, orderByComparator };
2624 }
2625
2626 List<UserGroupGroupRole> list = (List<UserGroupGroupRole>)FinderCacheUtil.getResult(finderPath,
2627 finderArgs, this);
2628
2629 if (list == null) {
2630 StringBundler query = null;
2631 String sql = null;
2632
2633 if (orderByComparator != null) {
2634 query = new StringBundler(2 +
2635 (orderByComparator.getOrderByFields().length * 3));
2636
2637 query.append(_SQL_SELECT_USERGROUPGROUPROLE);
2638
2639 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2640 orderByComparator);
2641
2642 sql = query.toString();
2643 }
2644 else {
2645 sql = _SQL_SELECT_USERGROUPGROUPROLE;
2646 }
2647
2648 Session session = null;
2649
2650 try {
2651 session = openSession();
2652
2653 Query q = session.createQuery(sql);
2654
2655 if (orderByComparator == null) {
2656 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
2657 getDialect(), start, end, false);
2658
2659 Collections.sort(list);
2660 }
2661 else {
2662 list = (List<UserGroupGroupRole>)QueryUtil.list(q,
2663 getDialect(), start, end);
2664 }
2665 }
2666 catch (Exception e) {
2667 throw processException(e);
2668 }
2669 finally {
2670 if (list == null) {
2671 FinderCacheUtil.removeResult(finderPath, finderArgs);
2672 }
2673 else {
2674 cacheResult(list);
2675
2676 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2677 }
2678
2679 closeSession(session);
2680 }
2681 }
2682
2683 return list;
2684 }
2685
2686
2692 public void removeByUserGroupId(long userGroupId) throws SystemException {
2693 for (UserGroupGroupRole userGroupGroupRole : findByUserGroupId(
2694 userGroupId)) {
2695 remove(userGroupGroupRole);
2696 }
2697 }
2698
2699
2705 public void removeByGroupId(long groupId) throws SystemException {
2706 for (UserGroupGroupRole userGroupGroupRole : findByGroupId(groupId)) {
2707 remove(userGroupGroupRole);
2708 }
2709 }
2710
2711
2717 public void removeByRoleId(long roleId) throws SystemException {
2718 for (UserGroupGroupRole userGroupGroupRole : findByRoleId(roleId)) {
2719 remove(userGroupGroupRole);
2720 }
2721 }
2722
2723
2730 public void removeByU_G(long userGroupId, long groupId)
2731 throws SystemException {
2732 for (UserGroupGroupRole userGroupGroupRole : findByU_G(userGroupId,
2733 groupId)) {
2734 remove(userGroupGroupRole);
2735 }
2736 }
2737
2738
2745 public void removeByG_R(long groupId, long roleId)
2746 throws SystemException {
2747 for (UserGroupGroupRole userGroupGroupRole : findByG_R(groupId, roleId)) {
2748 remove(userGroupGroupRole);
2749 }
2750 }
2751
2752
2757 public void removeAll() throws SystemException {
2758 for (UserGroupGroupRole userGroupGroupRole : findAll()) {
2759 remove(userGroupGroupRole);
2760 }
2761 }
2762
2763
2770 public int countByUserGroupId(long userGroupId) throws SystemException {
2771 Object[] finderArgs = new Object[] { userGroupId };
2772
2773 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERGROUPID,
2774 finderArgs, this);
2775
2776 if (count == null) {
2777 StringBundler query = new StringBundler(2);
2778
2779 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
2780
2781 query.append(_FINDER_COLUMN_USERGROUPID_USERGROUPID_2);
2782
2783 String sql = query.toString();
2784
2785 Session session = null;
2786
2787 try {
2788 session = openSession();
2789
2790 Query q = session.createQuery(sql);
2791
2792 QueryPos qPos = QueryPos.getInstance(q);
2793
2794 qPos.add(userGroupId);
2795
2796 count = (Long)q.uniqueResult();
2797 }
2798 catch (Exception e) {
2799 throw processException(e);
2800 }
2801 finally {
2802 if (count == null) {
2803 count = Long.valueOf(0);
2804 }
2805
2806 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERGROUPID,
2807 finderArgs, count);
2808
2809 closeSession(session);
2810 }
2811 }
2812
2813 return count.intValue();
2814 }
2815
2816
2823 public int countByGroupId(long groupId) throws SystemException {
2824 Object[] finderArgs = new Object[] { groupId };
2825
2826 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2827 finderArgs, this);
2828
2829 if (count == null) {
2830 StringBundler query = new StringBundler(2);
2831
2832 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
2833
2834 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2835
2836 String sql = query.toString();
2837
2838 Session session = null;
2839
2840 try {
2841 session = openSession();
2842
2843 Query q = session.createQuery(sql);
2844
2845 QueryPos qPos = QueryPos.getInstance(q);
2846
2847 qPos.add(groupId);
2848
2849 count = (Long)q.uniqueResult();
2850 }
2851 catch (Exception e) {
2852 throw processException(e);
2853 }
2854 finally {
2855 if (count == null) {
2856 count = Long.valueOf(0);
2857 }
2858
2859 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2860 finderArgs, count);
2861
2862 closeSession(session);
2863 }
2864 }
2865
2866 return count.intValue();
2867 }
2868
2869
2876 public int countByRoleId(long roleId) throws SystemException {
2877 Object[] finderArgs = new Object[] { roleId };
2878
2879 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ROLEID,
2880 finderArgs, this);
2881
2882 if (count == null) {
2883 StringBundler query = new StringBundler(2);
2884
2885 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
2886
2887 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
2888
2889 String sql = query.toString();
2890
2891 Session session = null;
2892
2893 try {
2894 session = openSession();
2895
2896 Query q = session.createQuery(sql);
2897
2898 QueryPos qPos = QueryPos.getInstance(q);
2899
2900 qPos.add(roleId);
2901
2902 count = (Long)q.uniqueResult();
2903 }
2904 catch (Exception e) {
2905 throw processException(e);
2906 }
2907 finally {
2908 if (count == null) {
2909 count = Long.valueOf(0);
2910 }
2911
2912 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ROLEID,
2913 finderArgs, count);
2914
2915 closeSession(session);
2916 }
2917 }
2918
2919 return count.intValue();
2920 }
2921
2922
2930 public int countByU_G(long userGroupId, long groupId)
2931 throws SystemException {
2932 Object[] finderArgs = new Object[] { userGroupId, groupId };
2933
2934 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_G,
2935 finderArgs, this);
2936
2937 if (count == null) {
2938 StringBundler query = new StringBundler(3);
2939
2940 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
2941
2942 query.append(_FINDER_COLUMN_U_G_USERGROUPID_2);
2943
2944 query.append(_FINDER_COLUMN_U_G_GROUPID_2);
2945
2946 String sql = query.toString();
2947
2948 Session session = null;
2949
2950 try {
2951 session = openSession();
2952
2953 Query q = session.createQuery(sql);
2954
2955 QueryPos qPos = QueryPos.getInstance(q);
2956
2957 qPos.add(userGroupId);
2958
2959 qPos.add(groupId);
2960
2961 count = (Long)q.uniqueResult();
2962 }
2963 catch (Exception e) {
2964 throw processException(e);
2965 }
2966 finally {
2967 if (count == null) {
2968 count = Long.valueOf(0);
2969 }
2970
2971 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_G, finderArgs,
2972 count);
2973
2974 closeSession(session);
2975 }
2976 }
2977
2978 return count.intValue();
2979 }
2980
2981
2989 public int countByG_R(long groupId, long roleId) throws SystemException {
2990 Object[] finderArgs = new Object[] { groupId, roleId };
2991
2992 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
2993 finderArgs, this);
2994
2995 if (count == null) {
2996 StringBundler query = new StringBundler(3);
2997
2998 query.append(_SQL_COUNT_USERGROUPGROUPROLE_WHERE);
2999
3000 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
3001
3002 query.append(_FINDER_COLUMN_G_R_ROLEID_2);
3003
3004 String sql = query.toString();
3005
3006 Session session = null;
3007
3008 try {
3009 session = openSession();
3010
3011 Query q = session.createQuery(sql);
3012
3013 QueryPos qPos = QueryPos.getInstance(q);
3014
3015 qPos.add(groupId);
3016
3017 qPos.add(roleId);
3018
3019 count = (Long)q.uniqueResult();
3020 }
3021 catch (Exception e) {
3022 throw processException(e);
3023 }
3024 finally {
3025 if (count == null) {
3026 count = Long.valueOf(0);
3027 }
3028
3029 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_R, finderArgs,
3030 count);
3031
3032 closeSession(session);
3033 }
3034 }
3035
3036 return count.intValue();
3037 }
3038
3039
3045 public int countAll() throws SystemException {
3046 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3047 FINDER_ARGS_EMPTY, this);
3048
3049 if (count == null) {
3050 Session session = null;
3051
3052 try {
3053 session = openSession();
3054
3055 Query q = session.createQuery(_SQL_COUNT_USERGROUPGROUPROLE);
3056
3057 count = (Long)q.uniqueResult();
3058 }
3059 catch (Exception e) {
3060 throw processException(e);
3061 }
3062 finally {
3063 if (count == null) {
3064 count = Long.valueOf(0);
3065 }
3066
3067 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3068 FINDER_ARGS_EMPTY, count);
3069
3070 closeSession(session);
3071 }
3072 }
3073
3074 return count.intValue();
3075 }
3076
3077
3080 public void afterPropertiesSet() {
3081 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3082 com.liferay.portal.util.PropsUtil.get(
3083 "value.object.listener.com.liferay.portal.model.UserGroupGroupRole")));
3084
3085 if (listenerClassNames.length > 0) {
3086 try {
3087 List<ModelListener<UserGroupGroupRole>> listenersList = new ArrayList<ModelListener<UserGroupGroupRole>>();
3088
3089 for (String listenerClassName : listenerClassNames) {
3090 listenersList.add((ModelListener<UserGroupGroupRole>)InstanceFactory.newInstance(
3091 listenerClassName));
3092 }
3093
3094 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3095 }
3096 catch (Exception e) {
3097 _log.error(e);
3098 }
3099 }
3100 }
3101
3102 public void destroy() {
3103 EntityCacheUtil.removeCache(UserGroupGroupRoleImpl.class.getName());
3104 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3105 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3106 }
3107
3108 @BeanReference(type = AccountPersistence.class)
3109 protected AccountPersistence accountPersistence;
3110 @BeanReference(type = AddressPersistence.class)
3111 protected AddressPersistence addressPersistence;
3112 @BeanReference(type = BrowserTrackerPersistence.class)
3113 protected BrowserTrackerPersistence browserTrackerPersistence;
3114 @BeanReference(type = ClassNamePersistence.class)
3115 protected ClassNamePersistence classNamePersistence;
3116 @BeanReference(type = ClusterGroupPersistence.class)
3117 protected ClusterGroupPersistence clusterGroupPersistence;
3118 @BeanReference(type = CompanyPersistence.class)
3119 protected CompanyPersistence companyPersistence;
3120 @BeanReference(type = ContactPersistence.class)
3121 protected ContactPersistence contactPersistence;
3122 @BeanReference(type = CountryPersistence.class)
3123 protected CountryPersistence countryPersistence;
3124 @BeanReference(type = EmailAddressPersistence.class)
3125 protected EmailAddressPersistence emailAddressPersistence;
3126 @BeanReference(type = GroupPersistence.class)
3127 protected GroupPersistence groupPersistence;
3128 @BeanReference(type = ImagePersistence.class)
3129 protected ImagePersistence imagePersistence;
3130 @BeanReference(type = LayoutPersistence.class)
3131 protected LayoutPersistence layoutPersistence;
3132 @BeanReference(type = LayoutBranchPersistence.class)
3133 protected LayoutBranchPersistence layoutBranchPersistence;
3134 @BeanReference(type = LayoutPrototypePersistence.class)
3135 protected LayoutPrototypePersistence layoutPrototypePersistence;
3136 @BeanReference(type = LayoutRevisionPersistence.class)
3137 protected LayoutRevisionPersistence layoutRevisionPersistence;
3138 @BeanReference(type = LayoutSetPersistence.class)
3139 protected LayoutSetPersistence layoutSetPersistence;
3140 @BeanReference(type = LayoutSetBranchPersistence.class)
3141 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3142 @BeanReference(type = LayoutSetPrototypePersistence.class)
3143 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3144 @BeanReference(type = ListTypePersistence.class)
3145 protected ListTypePersistence listTypePersistence;
3146 @BeanReference(type = LockPersistence.class)
3147 protected LockPersistence lockPersistence;
3148 @BeanReference(type = MembershipRequestPersistence.class)
3149 protected MembershipRequestPersistence membershipRequestPersistence;
3150 @BeanReference(type = OrganizationPersistence.class)
3151 protected OrganizationPersistence organizationPersistence;
3152 @BeanReference(type = OrgGroupRolePersistence.class)
3153 protected OrgGroupRolePersistence orgGroupRolePersistence;
3154 @BeanReference(type = OrgLaborPersistence.class)
3155 protected OrgLaborPersistence orgLaborPersistence;
3156 @BeanReference(type = PasswordPolicyPersistence.class)
3157 protected PasswordPolicyPersistence passwordPolicyPersistence;
3158 @BeanReference(type = PasswordPolicyRelPersistence.class)
3159 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3160 @BeanReference(type = PasswordTrackerPersistence.class)
3161 protected PasswordTrackerPersistence passwordTrackerPersistence;
3162 @BeanReference(type = PhonePersistence.class)
3163 protected PhonePersistence phonePersistence;
3164 @BeanReference(type = PluginSettingPersistence.class)
3165 protected PluginSettingPersistence pluginSettingPersistence;
3166 @BeanReference(type = PortalPreferencesPersistence.class)
3167 protected PortalPreferencesPersistence portalPreferencesPersistence;
3168 @BeanReference(type = PortletPersistence.class)
3169 protected PortletPersistence portletPersistence;
3170 @BeanReference(type = PortletItemPersistence.class)
3171 protected PortletItemPersistence portletItemPersistence;
3172 @BeanReference(type = PortletPreferencesPersistence.class)
3173 protected PortletPreferencesPersistence portletPreferencesPersistence;
3174 @BeanReference(type = RegionPersistence.class)
3175 protected RegionPersistence regionPersistence;
3176 @BeanReference(type = ReleasePersistence.class)
3177 protected ReleasePersistence releasePersistence;
3178 @BeanReference(type = RepositoryPersistence.class)
3179 protected RepositoryPersistence repositoryPersistence;
3180 @BeanReference(type = RepositoryEntryPersistence.class)
3181 protected RepositoryEntryPersistence repositoryEntryPersistence;
3182 @BeanReference(type = ResourceActionPersistence.class)
3183 protected ResourceActionPersistence resourceActionPersistence;
3184 @BeanReference(type = ResourceBlockPersistence.class)
3185 protected ResourceBlockPersistence resourceBlockPersistence;
3186 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3187 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3188 @BeanReference(type = ResourcePermissionPersistence.class)
3189 protected ResourcePermissionPersistence resourcePermissionPersistence;
3190 @BeanReference(type = ResourceTypePermissionPersistence.class)
3191 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3192 @BeanReference(type = RolePersistence.class)
3193 protected RolePersistence rolePersistence;
3194 @BeanReference(type = ServiceComponentPersistence.class)
3195 protected ServiceComponentPersistence serviceComponentPersistence;
3196 @BeanReference(type = ShardPersistence.class)
3197 protected ShardPersistence shardPersistence;
3198 @BeanReference(type = SubscriptionPersistence.class)
3199 protected SubscriptionPersistence subscriptionPersistence;
3200 @BeanReference(type = TeamPersistence.class)
3201 protected TeamPersistence teamPersistence;
3202 @BeanReference(type = TicketPersistence.class)
3203 protected TicketPersistence ticketPersistence;
3204 @BeanReference(type = UserPersistence.class)
3205 protected UserPersistence userPersistence;
3206 @BeanReference(type = UserGroupPersistence.class)
3207 protected UserGroupPersistence userGroupPersistence;
3208 @BeanReference(type = UserGroupGroupRolePersistence.class)
3209 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3210 @BeanReference(type = UserGroupRolePersistence.class)
3211 protected UserGroupRolePersistence userGroupRolePersistence;
3212 @BeanReference(type = UserIdMapperPersistence.class)
3213 protected UserIdMapperPersistence userIdMapperPersistence;
3214 @BeanReference(type = UserNotificationEventPersistence.class)
3215 protected UserNotificationEventPersistence userNotificationEventPersistence;
3216 @BeanReference(type = UserTrackerPersistence.class)
3217 protected UserTrackerPersistence userTrackerPersistence;
3218 @BeanReference(type = UserTrackerPathPersistence.class)
3219 protected UserTrackerPathPersistence userTrackerPathPersistence;
3220 @BeanReference(type = VirtualHostPersistence.class)
3221 protected VirtualHostPersistence virtualHostPersistence;
3222 @BeanReference(type = WebDAVPropsPersistence.class)
3223 protected WebDAVPropsPersistence webDAVPropsPersistence;
3224 @BeanReference(type = WebsitePersistence.class)
3225 protected WebsitePersistence websitePersistence;
3226 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3227 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3228 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3229 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3230 private static final String _SQL_SELECT_USERGROUPGROUPROLE = "SELECT userGroupGroupRole FROM UserGroupGroupRole userGroupGroupRole";
3231 private static final String _SQL_SELECT_USERGROUPGROUPROLE_WHERE = "SELECT userGroupGroupRole FROM UserGroupGroupRole userGroupGroupRole WHERE ";
3232 private static final String _SQL_COUNT_USERGROUPGROUPROLE = "SELECT COUNT(userGroupGroupRole) FROM UserGroupGroupRole userGroupGroupRole";
3233 private static final String _SQL_COUNT_USERGROUPGROUPROLE_WHERE = "SELECT COUNT(userGroupGroupRole) FROM UserGroupGroupRole userGroupGroupRole WHERE ";
3234 private static final String _FINDER_COLUMN_USERGROUPID_USERGROUPID_2 = "userGroupGroupRole.id.userGroupId = ?";
3235 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "userGroupGroupRole.id.groupId = ?";
3236 private static final String _FINDER_COLUMN_ROLEID_ROLEID_2 = "userGroupGroupRole.id.roleId = ?";
3237 private static final String _FINDER_COLUMN_U_G_USERGROUPID_2 = "userGroupGroupRole.id.userGroupId = ? AND ";
3238 private static final String _FINDER_COLUMN_U_G_GROUPID_2 = "userGroupGroupRole.id.groupId = ?";
3239 private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "userGroupGroupRole.id.groupId = ? AND ";
3240 private static final String _FINDER_COLUMN_G_R_ROLEID_2 = "userGroupGroupRole.id.roleId = ?";
3241 private static final String _ORDER_BY_ENTITY_ALIAS = "userGroupGroupRole.";
3242 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserGroupGroupRole exists with the primary key ";
3243 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserGroupGroupRole exists with the key {";
3244 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3245 private static Log _log = LogFactoryUtil.getLog(UserGroupGroupRolePersistenceImpl.class);
3246 private static UserGroupGroupRole _nullUserGroupGroupRole = new UserGroupGroupRoleImpl() {
3247 @Override
3248 public Object clone() {
3249 return this;
3250 }
3251
3252 @Override
3253 public CacheModel<UserGroupGroupRole> toCacheModel() {
3254 return _nullUserGroupGroupRoleCacheModel;
3255 }
3256 };
3257
3258 private static CacheModel<UserGroupGroupRole> _nullUserGroupGroupRoleCacheModel =
3259 new CacheModel<UserGroupGroupRole>() {
3260 public UserGroupGroupRole toEntityModel() {
3261 return _nullUserGroupGroupRole;
3262 }
3263 };
3264 }