1
14
15 package com.liferay.portal.service.persistence;
16
17 import com.liferay.portal.NoSuchModelException;
18 import com.liferay.portal.NoSuchPermissionException;
19 import com.liferay.portal.kernel.annotation.BeanReference;
20 import com.liferay.portal.kernel.cache.CacheRegistry;
21 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
22 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
23 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
24 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
25 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
26 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
27 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
28 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
29 import com.liferay.portal.kernel.dao.orm.FinderPath;
30 import com.liferay.portal.kernel.dao.orm.Query;
31 import com.liferay.portal.kernel.dao.orm.QueryPos;
32 import com.liferay.portal.kernel.dao.orm.QueryUtil;
33 import com.liferay.portal.kernel.dao.orm.SQLQuery;
34 import com.liferay.portal.kernel.dao.orm.Session;
35 import com.liferay.portal.kernel.dao.orm.Type;
36 import com.liferay.portal.kernel.exception.SystemException;
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.SetUtil;
42 import com.liferay.portal.kernel.util.StringBundler;
43 import com.liferay.portal.kernel.util.StringPool;
44 import com.liferay.portal.kernel.util.StringUtil;
45 import com.liferay.portal.kernel.util.Validator;
46 import com.liferay.portal.model.ModelListener;
47 import com.liferay.portal.model.Permission;
48 import com.liferay.portal.model.impl.PermissionImpl;
49 import com.liferay.portal.model.impl.PermissionModelImpl;
50 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
51
52 import java.io.Serializable;
53
54 import java.sql.Types;
55
56 import java.util.ArrayList;
57 import java.util.Collections;
58 import java.util.List;
59 import java.util.Set;
60
61
74 public class PermissionPersistenceImpl extends BasePersistenceImpl<Permission>
75 implements PermissionPersistence {
76 public static final String FINDER_CLASS_NAME_ENTITY = PermissionImpl.class.getName();
77 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
78 ".List";
79 public static final FinderPath FINDER_PATH_FIND_BY_RESOURCEID = new FinderPath(PermissionModelImpl.ENTITY_CACHE_ENABLED,
80 PermissionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81 "findByResourceId", new String[] { Long.class.getName() });
82 public static final FinderPath FINDER_PATH_FIND_BY_OBC_RESOURCEID = new FinderPath(PermissionModelImpl.ENTITY_CACHE_ENABLED,
83 PermissionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
84 "findByResourceId",
85 new String[] {
86 Long.class.getName(),
87
88 "java.lang.Integer", "java.lang.Integer",
89 "com.liferay.portal.kernel.util.OrderByComparator"
90 });
91 public static final FinderPath FINDER_PATH_COUNT_BY_RESOURCEID = new FinderPath(PermissionModelImpl.ENTITY_CACHE_ENABLED,
92 PermissionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
93 "countByResourceId", new String[] { Long.class.getName() });
94 public static final FinderPath FINDER_PATH_FETCH_BY_A_R = new FinderPath(PermissionModelImpl.ENTITY_CACHE_ENABLED,
95 PermissionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
96 "fetchByA_R",
97 new String[] { String.class.getName(), Long.class.getName() });
98 public static final FinderPath FINDER_PATH_COUNT_BY_A_R = new FinderPath(PermissionModelImpl.ENTITY_CACHE_ENABLED,
99 PermissionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
100 "countByA_R",
101 new String[] { String.class.getName(), Long.class.getName() });
102 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(PermissionModelImpl.ENTITY_CACHE_ENABLED,
103 PermissionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
104 "findAll", new String[0]);
105 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PermissionModelImpl.ENTITY_CACHE_ENABLED,
106 PermissionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
107 "countAll", new String[0]);
108
109 public void cacheResult(Permission permission) {
110 EntityCacheUtil.putResult(PermissionModelImpl.ENTITY_CACHE_ENABLED,
111 PermissionImpl.class, permission.getPrimaryKey(), permission);
112
113 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A_R,
114 new Object[] {
115 permission.getActionId(), new Long(permission.getResourceId())
116 }, permission);
117 }
118
119 public void cacheResult(List<Permission> permissions) {
120 for (Permission permission : permissions) {
121 if (EntityCacheUtil.getResult(
122 PermissionModelImpl.ENTITY_CACHE_ENABLED,
123 PermissionImpl.class, permission.getPrimaryKey(), this) == null) {
124 cacheResult(permission);
125 }
126 }
127 }
128
129 public void clearCache() {
130 CacheRegistry.clear(PermissionImpl.class.getName());
131 EntityCacheUtil.clearCache(PermissionImpl.class.getName());
132 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
133 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
134 }
135
136 public Permission create(long permissionId) {
137 Permission permission = new PermissionImpl();
138
139 permission.setNew(true);
140 permission.setPrimaryKey(permissionId);
141
142 return permission;
143 }
144
145 public Permission remove(Serializable primaryKey)
146 throws NoSuchModelException, SystemException {
147 return remove(((Long)primaryKey).longValue());
148 }
149
150 public Permission remove(long permissionId)
151 throws NoSuchPermissionException, SystemException {
152 Session session = null;
153
154 try {
155 session = openSession();
156
157 Permission permission = (Permission)session.get(PermissionImpl.class,
158 new Long(permissionId));
159
160 if (permission == null) {
161 if (_log.isWarnEnabled()) {
162 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + permissionId);
163 }
164
165 throw new NoSuchPermissionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
166 permissionId);
167 }
168
169 return remove(permission);
170 }
171 catch (NoSuchPermissionException nsee) {
172 throw nsee;
173 }
174 catch (Exception e) {
175 throw processException(e);
176 }
177 finally {
178 closeSession(session);
179 }
180 }
181
182 public Permission remove(Permission permission) throws SystemException {
183 for (ModelListener<Permission> listener : listeners) {
184 listener.onBeforeRemove(permission);
185 }
186
187 permission = removeImpl(permission);
188
189 for (ModelListener<Permission> listener : listeners) {
190 listener.onAfterRemove(permission);
191 }
192
193 return permission;
194 }
195
196 protected Permission removeImpl(Permission permission)
197 throws SystemException {
198 permission = toUnwrappedModel(permission);
199
200 try {
201 clearGroups.clear(permission.getPrimaryKey());
202 }
203 catch (Exception e) {
204 throw processException(e);
205 }
206 finally {
207 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
208 }
209
210 try {
211 clearRoles.clear(permission.getPrimaryKey());
212 }
213 catch (Exception e) {
214 throw processException(e);
215 }
216 finally {
217 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
218 }
219
220 try {
221 clearUsers.clear(permission.getPrimaryKey());
222 }
223 catch (Exception e) {
224 throw processException(e);
225 }
226 finally {
227 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
228 }
229
230 Session session = null;
231
232 try {
233 session = openSession();
234
235 if (permission.isCachedModel() || BatchSessionUtil.isEnabled()) {
236 Object staleObject = session.get(PermissionImpl.class,
237 permission.getPrimaryKeyObj());
238
239 if (staleObject != null) {
240 session.evict(staleObject);
241 }
242 }
243
244 session.delete(permission);
245
246 session.flush();
247 }
248 catch (Exception e) {
249 throw processException(e);
250 }
251 finally {
252 closeSession(session);
253 }
254
255 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
256
257 PermissionModelImpl permissionModelImpl = (PermissionModelImpl)permission;
258
259 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A_R,
260 new Object[] {
261 permissionModelImpl.getOriginalActionId(),
262 new Long(permissionModelImpl.getOriginalResourceId())
263 });
264
265 EntityCacheUtil.removeResult(PermissionModelImpl.ENTITY_CACHE_ENABLED,
266 PermissionImpl.class, permission.getPrimaryKey());
267
268 return permission;
269 }
270
271 public Permission updateImpl(
272 com.liferay.portal.model.Permission permission, boolean merge)
273 throws SystemException {
274 permission = toUnwrappedModel(permission);
275
276 boolean isNew = permission.isNew();
277
278 PermissionModelImpl permissionModelImpl = (PermissionModelImpl)permission;
279
280 Session session = null;
281
282 try {
283 session = openSession();
284
285 BatchSessionUtil.update(session, permission, merge);
286
287 permission.setNew(false);
288 }
289 catch (Exception e) {
290 throw processException(e);
291 }
292 finally {
293 closeSession(session);
294 }
295
296 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
297
298 EntityCacheUtil.putResult(PermissionModelImpl.ENTITY_CACHE_ENABLED,
299 PermissionImpl.class, permission.getPrimaryKey(), permission);
300
301 if (!isNew &&
302 (!Validator.equals(permission.getActionId(),
303 permissionModelImpl.getOriginalActionId()) ||
304 (permission.getResourceId() != permissionModelImpl.getOriginalResourceId()))) {
305 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A_R,
306 new Object[] {
307 permissionModelImpl.getOriginalActionId(),
308 new Long(permissionModelImpl.getOriginalResourceId())
309 });
310 }
311
312 if (isNew ||
313 (!Validator.equals(permission.getActionId(),
314 permissionModelImpl.getOriginalActionId()) ||
315 (permission.getResourceId() != permissionModelImpl.getOriginalResourceId()))) {
316 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A_R,
317 new Object[] {
318 permission.getActionId(),
319 new Long(permission.getResourceId())
320 }, permission);
321 }
322
323 return permission;
324 }
325
326 protected Permission toUnwrappedModel(Permission permission) {
327 if (permission instanceof PermissionImpl) {
328 return permission;
329 }
330
331 PermissionImpl permissionImpl = new PermissionImpl();
332
333 permissionImpl.setNew(permission.isNew());
334 permissionImpl.setPrimaryKey(permission.getPrimaryKey());
335
336 permissionImpl.setPermissionId(permission.getPermissionId());
337 permissionImpl.setCompanyId(permission.getCompanyId());
338 permissionImpl.setActionId(permission.getActionId());
339 permissionImpl.setResourceId(permission.getResourceId());
340
341 return permissionImpl;
342 }
343
344 public Permission findByPrimaryKey(Serializable primaryKey)
345 throws NoSuchModelException, SystemException {
346 return findByPrimaryKey(((Long)primaryKey).longValue());
347 }
348
349 public Permission findByPrimaryKey(long permissionId)
350 throws NoSuchPermissionException, SystemException {
351 Permission permission = fetchByPrimaryKey(permissionId);
352
353 if (permission == null) {
354 if (_log.isWarnEnabled()) {
355 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + permissionId);
356 }
357
358 throw new NoSuchPermissionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
359 permissionId);
360 }
361
362 return permission;
363 }
364
365 public Permission fetchByPrimaryKey(Serializable primaryKey)
366 throws SystemException {
367 return fetchByPrimaryKey(((Long)primaryKey).longValue());
368 }
369
370 public Permission fetchByPrimaryKey(long permissionId)
371 throws SystemException {
372 Permission permission = (Permission)EntityCacheUtil.getResult(PermissionModelImpl.ENTITY_CACHE_ENABLED,
373 PermissionImpl.class, permissionId, this);
374
375 if (permission == null) {
376 Session session = null;
377
378 try {
379 session = openSession();
380
381 permission = (Permission)session.get(PermissionImpl.class,
382 new Long(permissionId));
383 }
384 catch (Exception e) {
385 throw processException(e);
386 }
387 finally {
388 if (permission != null) {
389 cacheResult(permission);
390 }
391
392 closeSession(session);
393 }
394 }
395
396 return permission;
397 }
398
399 public List<Permission> findByResourceId(long resourceId)
400 throws SystemException {
401 Object[] finderArgs = new Object[] { new Long(resourceId) };
402
403 List<Permission> list = (List<Permission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_RESOURCEID,
404 finderArgs, this);
405
406 if (list == null) {
407 Session session = null;
408
409 try {
410 session = openSession();
411
412 StringBundler query = new StringBundler(2);
413
414 query.append(_SQL_SELECT_PERMISSION_WHERE);
415
416 query.append(_FINDER_COLUMN_RESOURCEID_RESOURCEID_2);
417
418 String sql = query.toString();
419
420 Query q = session.createQuery(sql);
421
422 QueryPos qPos = QueryPos.getInstance(q);
423
424 qPos.add(resourceId);
425
426 list = q.list();
427 }
428 catch (Exception e) {
429 throw processException(e);
430 }
431 finally {
432 if (list == null) {
433 list = new ArrayList<Permission>();
434 }
435
436 cacheResult(list);
437
438 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_RESOURCEID,
439 finderArgs, list);
440
441 closeSession(session);
442 }
443 }
444
445 return list;
446 }
447
448 public List<Permission> findByResourceId(long resourceId, int start, int end)
449 throws SystemException {
450 return findByResourceId(resourceId, start, end, null);
451 }
452
453 public List<Permission> findByResourceId(long resourceId, int start,
454 int end, OrderByComparator obc) throws SystemException {
455 Object[] finderArgs = new Object[] {
456 new Long(resourceId),
457
458 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
459 };
460
461 List<Permission> list = (List<Permission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_RESOURCEID,
462 finderArgs, this);
463
464 if (list == null) {
465 Session session = null;
466
467 try {
468 session = openSession();
469
470 StringBundler query = null;
471
472 if (obc != null) {
473 query = new StringBundler(3 +
474 (obc.getOrderByFields().length * 3));
475 }
476 else {
477 query = new StringBundler(2);
478 }
479
480 query.append(_SQL_SELECT_PERMISSION_WHERE);
481
482 query.append(_FINDER_COLUMN_RESOURCEID_RESOURCEID_2);
483
484 if (obc != null) {
485 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
486 }
487
488 String sql = query.toString();
489
490 Query q = session.createQuery(sql);
491
492 QueryPos qPos = QueryPos.getInstance(q);
493
494 qPos.add(resourceId);
495
496 list = (List<Permission>)QueryUtil.list(q, getDialect(), start,
497 end);
498 }
499 catch (Exception e) {
500 throw processException(e);
501 }
502 finally {
503 if (list == null) {
504 list = new ArrayList<Permission>();
505 }
506
507 cacheResult(list);
508
509 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_RESOURCEID,
510 finderArgs, list);
511
512 closeSession(session);
513 }
514 }
515
516 return list;
517 }
518
519 public Permission findByResourceId_First(long resourceId,
520 OrderByComparator obc)
521 throws NoSuchPermissionException, SystemException {
522 List<Permission> list = findByResourceId(resourceId, 0, 1, obc);
523
524 if (list.isEmpty()) {
525 StringBundler msg = new StringBundler(4);
526
527 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
528
529 msg.append("resourceId=");
530 msg.append(resourceId);
531
532 msg.append(StringPool.CLOSE_CURLY_BRACE);
533
534 throw new NoSuchPermissionException(msg.toString());
535 }
536 else {
537 return list.get(0);
538 }
539 }
540
541 public Permission findByResourceId_Last(long resourceId,
542 OrderByComparator obc)
543 throws NoSuchPermissionException, SystemException {
544 int count = countByResourceId(resourceId);
545
546 List<Permission> list = findByResourceId(resourceId, count - 1, count,
547 obc);
548
549 if (list.isEmpty()) {
550 StringBundler msg = new StringBundler(4);
551
552 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
553
554 msg.append("resourceId=");
555 msg.append(resourceId);
556
557 msg.append(StringPool.CLOSE_CURLY_BRACE);
558
559 throw new NoSuchPermissionException(msg.toString());
560 }
561 else {
562 return list.get(0);
563 }
564 }
565
566 public Permission[] findByResourceId_PrevAndNext(long permissionId,
567 long resourceId, OrderByComparator obc)
568 throws NoSuchPermissionException, SystemException {
569 Permission permission = findByPrimaryKey(permissionId);
570
571 int count = countByResourceId(resourceId);
572
573 Session session = null;
574
575 try {
576 session = openSession();
577
578 StringBundler query = null;
579
580 if (obc != null) {
581 query = new StringBundler(3 +
582 (obc.getOrderByFields().length * 3));
583 }
584 else {
585 query = new StringBundler(2);
586 }
587
588 query.append(_SQL_SELECT_PERMISSION_WHERE);
589
590 query.append(_FINDER_COLUMN_RESOURCEID_RESOURCEID_2);
591
592 if (obc != null) {
593 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
594 }
595
596 String sql = query.toString();
597
598 Query q = session.createQuery(sql);
599
600 QueryPos qPos = QueryPos.getInstance(q);
601
602 qPos.add(resourceId);
603
604 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
605 permission);
606
607 Permission[] array = new PermissionImpl[3];
608
609 array[0] = (Permission)objArray[0];
610 array[1] = (Permission)objArray[1];
611 array[2] = (Permission)objArray[2];
612
613 return array;
614 }
615 catch (Exception e) {
616 throw processException(e);
617 }
618 finally {
619 closeSession(session);
620 }
621 }
622
623 public Permission findByA_R(String actionId, long resourceId)
624 throws NoSuchPermissionException, SystemException {
625 Permission permission = fetchByA_R(actionId, resourceId);
626
627 if (permission == null) {
628 StringBundler msg = new StringBundler(6);
629
630 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
631
632 msg.append("actionId=");
633 msg.append(actionId);
634
635 msg.append(", resourceId=");
636 msg.append(resourceId);
637
638 msg.append(StringPool.CLOSE_CURLY_BRACE);
639
640 if (_log.isWarnEnabled()) {
641 _log.warn(msg.toString());
642 }
643
644 throw new NoSuchPermissionException(msg.toString());
645 }
646
647 return permission;
648 }
649
650 public Permission fetchByA_R(String actionId, long resourceId)
651 throws SystemException {
652 return fetchByA_R(actionId, resourceId, true);
653 }
654
655 public Permission fetchByA_R(String actionId, long resourceId,
656 boolean retrieveFromCache) throws SystemException {
657 Object[] finderArgs = new Object[] { actionId, new Long(resourceId) };
658
659 Object result = null;
660
661 if (retrieveFromCache) {
662 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A_R,
663 finderArgs, this);
664 }
665
666 if (result == null) {
667 Session session = null;
668
669 try {
670 session = openSession();
671
672 StringBundler query = new StringBundler(3);
673
674 query.append(_SQL_SELECT_PERMISSION_WHERE);
675
676 if (actionId == null) {
677 query.append(_FINDER_COLUMN_A_R_ACTIONID_1);
678 }
679 else {
680 if (actionId.equals(StringPool.BLANK)) {
681 query.append(_FINDER_COLUMN_A_R_ACTIONID_3);
682 }
683 else {
684 query.append(_FINDER_COLUMN_A_R_ACTIONID_2);
685 }
686 }
687
688 query.append(_FINDER_COLUMN_A_R_RESOURCEID_2);
689
690 String sql = query.toString();
691
692 Query q = session.createQuery(sql);
693
694 QueryPos qPos = QueryPos.getInstance(q);
695
696 if (actionId != null) {
697 qPos.add(actionId);
698 }
699
700 qPos.add(resourceId);
701
702 List<Permission> list = q.list();
703
704 result = list;
705
706 Permission permission = null;
707
708 if (list.isEmpty()) {
709 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A_R,
710 finderArgs, list);
711 }
712 else {
713 permission = list.get(0);
714
715 cacheResult(permission);
716
717 if ((permission.getActionId() == null) ||
718 !permission.getActionId().equals(actionId) ||
719 (permission.getResourceId() != resourceId)) {
720 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A_R,
721 finderArgs, permission);
722 }
723 }
724
725 return permission;
726 }
727 catch (Exception e) {
728 throw processException(e);
729 }
730 finally {
731 if (result == null) {
732 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A_R,
733 finderArgs, new ArrayList<Permission>());
734 }
735
736 closeSession(session);
737 }
738 }
739 else {
740 if (result instanceof List<?>) {
741 return null;
742 }
743 else {
744 return (Permission)result;
745 }
746 }
747 }
748
749 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
750 throws SystemException {
751 Session session = null;
752
753 try {
754 session = openSession();
755
756 dynamicQuery.compile(session);
757
758 return dynamicQuery.list();
759 }
760 catch (Exception e) {
761 throw processException(e);
762 }
763 finally {
764 closeSession(session);
765 }
766 }
767
768 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
769 int start, int end) throws SystemException {
770 Session session = null;
771
772 try {
773 session = openSession();
774
775 dynamicQuery.setLimit(start, end);
776
777 dynamicQuery.compile(session);
778
779 return dynamicQuery.list();
780 }
781 catch (Exception e) {
782 throw processException(e);
783 }
784 finally {
785 closeSession(session);
786 }
787 }
788
789 public List<Permission> findAll() throws SystemException {
790 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
791 }
792
793 public List<Permission> findAll(int start, int end)
794 throws SystemException {
795 return findAll(start, end, null);
796 }
797
798 public List<Permission> findAll(int start, int end, OrderByComparator obc)
799 throws SystemException {
800 Object[] finderArgs = new Object[] {
801 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
802 };
803
804 List<Permission> list = (List<Permission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
805 finderArgs, this);
806
807 if (list == null) {
808 Session session = null;
809
810 try {
811 session = openSession();
812
813 StringBundler query = null;
814 String sql = null;
815
816 if (obc != null) {
817 query = new StringBundler(2 +
818 (obc.getOrderByFields().length * 3));
819
820 query.append(_SQL_SELECT_PERMISSION);
821
822 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
823
824 sql = query.toString();
825 }
826
827 sql = _SQL_SELECT_PERMISSION;
828
829 Query q = session.createQuery(sql);
830
831 if (obc == null) {
832 list = (List<Permission>)QueryUtil.list(q, getDialect(),
833 start, end, false);
834
835 Collections.sort(list);
836 }
837 else {
838 list = (List<Permission>)QueryUtil.list(q, getDialect(),
839 start, end);
840 }
841 }
842 catch (Exception e) {
843 throw processException(e);
844 }
845 finally {
846 if (list == null) {
847 list = new ArrayList<Permission>();
848 }
849
850 cacheResult(list);
851
852 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
853
854 closeSession(session);
855 }
856 }
857
858 return list;
859 }
860
861 public void removeByResourceId(long resourceId) throws SystemException {
862 for (Permission permission : findByResourceId(resourceId)) {
863 remove(permission);
864 }
865 }
866
867 public void removeByA_R(String actionId, long resourceId)
868 throws NoSuchPermissionException, SystemException {
869 Permission permission = findByA_R(actionId, resourceId);
870
871 remove(permission);
872 }
873
874 public void removeAll() throws SystemException {
875 for (Permission permission : findAll()) {
876 remove(permission);
877 }
878 }
879
880 public int countByResourceId(long resourceId) throws SystemException {
881 Object[] finderArgs = new Object[] { new Long(resourceId) };
882
883 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RESOURCEID,
884 finderArgs, this);
885
886 if (count == null) {
887 Session session = null;
888
889 try {
890 session = openSession();
891
892 StringBundler query = new StringBundler(2);
893
894 query.append(_SQL_COUNT_PERMISSION_WHERE);
895
896 query.append(_FINDER_COLUMN_RESOURCEID_RESOURCEID_2);
897
898 String sql = query.toString();
899
900 Query q = session.createQuery(sql);
901
902 QueryPos qPos = QueryPos.getInstance(q);
903
904 qPos.add(resourceId);
905
906 count = (Long)q.uniqueResult();
907 }
908 catch (Exception e) {
909 throw processException(e);
910 }
911 finally {
912 if (count == null) {
913 count = Long.valueOf(0);
914 }
915
916 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RESOURCEID,
917 finderArgs, count);
918
919 closeSession(session);
920 }
921 }
922
923 return count.intValue();
924 }
925
926 public int countByA_R(String actionId, long resourceId)
927 throws SystemException {
928 Object[] finderArgs = new Object[] { actionId, new Long(resourceId) };
929
930 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A_R,
931 finderArgs, this);
932
933 if (count == null) {
934 Session session = null;
935
936 try {
937 session = openSession();
938
939 StringBundler query = new StringBundler(3);
940
941 query.append(_SQL_COUNT_PERMISSION_WHERE);
942
943 if (actionId == null) {
944 query.append(_FINDER_COLUMN_A_R_ACTIONID_1);
945 }
946 else {
947 if (actionId.equals(StringPool.BLANK)) {
948 query.append(_FINDER_COLUMN_A_R_ACTIONID_3);
949 }
950 else {
951 query.append(_FINDER_COLUMN_A_R_ACTIONID_2);
952 }
953 }
954
955 query.append(_FINDER_COLUMN_A_R_RESOURCEID_2);
956
957 String sql = query.toString();
958
959 Query q = session.createQuery(sql);
960
961 QueryPos qPos = QueryPos.getInstance(q);
962
963 if (actionId != null) {
964 qPos.add(actionId);
965 }
966
967 qPos.add(resourceId);
968
969 count = (Long)q.uniqueResult();
970 }
971 catch (Exception e) {
972 throw processException(e);
973 }
974 finally {
975 if (count == null) {
976 count = Long.valueOf(0);
977 }
978
979 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A_R, finderArgs,
980 count);
981
982 closeSession(session);
983 }
984 }
985
986 return count.intValue();
987 }
988
989 public int countAll() throws SystemException {
990 Object[] finderArgs = new Object[0];
991
992 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
993 finderArgs, this);
994
995 if (count == null) {
996 Session session = null;
997
998 try {
999 session = openSession();
1000
1001 Query q = session.createQuery(_SQL_COUNT_PERMISSION);
1002
1003 count = (Long)q.uniqueResult();
1004 }
1005 catch (Exception e) {
1006 throw processException(e);
1007 }
1008 finally {
1009 if (count == null) {
1010 count = Long.valueOf(0);
1011 }
1012
1013 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1014 count);
1015
1016 closeSession(session);
1017 }
1018 }
1019
1020 return count.intValue();
1021 }
1022
1023 public List<com.liferay.portal.model.Group> getGroups(long pk)
1024 throws SystemException {
1025 return getGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1026 }
1027
1028 public List<com.liferay.portal.model.Group> getGroups(long pk, int start,
1029 int end) throws SystemException {
1030 return getGroups(pk, start, end, null);
1031 }
1032
1033 public static final FinderPath FINDER_PATH_GET_GROUPS = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
1034 PermissionModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
1035 PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME,
1036 "getGroups",
1037 new String[] {
1038 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1039 "com.liferay.portal.kernel.util.OrderByComparator"
1040 });
1041
1042 public List<com.liferay.portal.model.Group> getGroups(long pk, int start,
1043 int end, OrderByComparator obc) throws SystemException {
1044 Object[] finderArgs = new Object[] {
1045 new Long(pk), String.valueOf(start), String.valueOf(end),
1046 String.valueOf(obc)
1047 };
1048
1049 List<com.liferay.portal.model.Group> list = (List<com.liferay.portal.model.Group>)FinderCacheUtil.getResult(FINDER_PATH_GET_GROUPS,
1050 finderArgs, this);
1051
1052 if (list == null) {
1053 Session session = null;
1054
1055 try {
1056 session = openSession();
1057
1058 String sql = null;
1059
1060 if (obc != null) {
1061 sql = _SQL_GETGROUPS.concat(ORDER_BY_CLAUSE)
1062 .concat(obc.getOrderBy());
1063 }
1064
1065 else {
1066 sql = _SQL_GETGROUPS.concat(com.liferay.portal.model.impl.GroupModelImpl.ORDER_BY_SQL);
1067 }
1068
1069 SQLQuery q = session.createSQLQuery(sql);
1070
1071 q.addEntity("Group_",
1072 com.liferay.portal.model.impl.GroupImpl.class);
1073
1074 QueryPos qPos = QueryPos.getInstance(q);
1075
1076 qPos.add(pk);
1077
1078 list = (List<com.liferay.portal.model.Group>)QueryUtil.list(q,
1079 getDialect(), start, end);
1080 }
1081 catch (Exception e) {
1082 throw processException(e);
1083 }
1084 finally {
1085 if (list == null) {
1086 list = new ArrayList<com.liferay.portal.model.Group>();
1087 }
1088
1089 groupPersistence.cacheResult(list);
1090
1091 FinderCacheUtil.putResult(FINDER_PATH_GET_GROUPS, finderArgs,
1092 list);
1093
1094 closeSession(session);
1095 }
1096 }
1097
1098 return list;
1099 }
1100
1101 public static final FinderPath FINDER_PATH_GET_GROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
1102 PermissionModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
1103 PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME,
1104 "getGroupsSize", new String[] { Long.class.getName() });
1105
1106 public int getGroupsSize(long pk) throws SystemException {
1107 Object[] finderArgs = new Object[] { new Long(pk) };
1108
1109 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_GROUPS_SIZE,
1110 finderArgs, this);
1111
1112 if (count == null) {
1113 Session session = null;
1114
1115 try {
1116 session = openSession();
1117
1118 SQLQuery q = session.createSQLQuery(_SQL_GETGROUPSSIZE);
1119
1120 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
1121
1122 QueryPos qPos = QueryPos.getInstance(q);
1123
1124 qPos.add(pk);
1125
1126 count = (Long)q.uniqueResult();
1127 }
1128 catch (Exception e) {
1129 throw processException(e);
1130 }
1131 finally {
1132 if (count == null) {
1133 count = Long.valueOf(0);
1134 }
1135
1136 FinderCacheUtil.putResult(FINDER_PATH_GET_GROUPS_SIZE,
1137 finderArgs, count);
1138
1139 closeSession(session);
1140 }
1141 }
1142
1143 return count.intValue();
1144 }
1145
1146 public static final FinderPath FINDER_PATH_CONTAINS_GROUP = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
1147 PermissionModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
1148 PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME,
1149 "containsGroup",
1150 new String[] { Long.class.getName(), Long.class.getName() });
1151
1152 public boolean containsGroup(long pk, long groupPK)
1153 throws SystemException {
1154 Object[] finderArgs = new Object[] { new Long(pk), new Long(groupPK) };
1155
1156 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_GROUP,
1157 finderArgs, this);
1158
1159 if (value == null) {
1160 try {
1161 value = Boolean.valueOf(containsGroup.contains(pk, groupPK));
1162 }
1163 catch (Exception e) {
1164 throw processException(e);
1165 }
1166 finally {
1167 if (value == null) {
1168 value = Boolean.FALSE;
1169 }
1170
1171 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_GROUP,
1172 finderArgs, value);
1173 }
1174 }
1175
1176 return value.booleanValue();
1177 }
1178
1179 public boolean containsGroups(long pk) throws SystemException {
1180 if (getGroupsSize(pk) > 0) {
1181 return true;
1182 }
1183 else {
1184 return false;
1185 }
1186 }
1187
1188 public void addGroup(long pk, long groupPK) throws SystemException {
1189 try {
1190 addGroup.add(pk, groupPK);
1191 }
1192 catch (Exception e) {
1193 throw processException(e);
1194 }
1195 finally {
1196 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1197 }
1198 }
1199
1200 public void addGroup(long pk, com.liferay.portal.model.Group group)
1201 throws SystemException {
1202 try {
1203 addGroup.add(pk, group.getPrimaryKey());
1204 }
1205 catch (Exception e) {
1206 throw processException(e);
1207 }
1208 finally {
1209 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1210 }
1211 }
1212
1213 public void addGroups(long pk, long[] groupPKs) throws SystemException {
1214 try {
1215 for (long groupPK : groupPKs) {
1216 addGroup.add(pk, groupPK);
1217 }
1218 }
1219 catch (Exception e) {
1220 throw processException(e);
1221 }
1222 finally {
1223 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1224 }
1225 }
1226
1227 public void addGroups(long pk, List<com.liferay.portal.model.Group> groups)
1228 throws SystemException {
1229 try {
1230 for (com.liferay.portal.model.Group group : groups) {
1231 addGroup.add(pk, group.getPrimaryKey());
1232 }
1233 }
1234 catch (Exception e) {
1235 throw processException(e);
1236 }
1237 finally {
1238 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1239 }
1240 }
1241
1242 public void clearGroups(long pk) throws SystemException {
1243 try {
1244 clearGroups.clear(pk);
1245 }
1246 catch (Exception e) {
1247 throw processException(e);
1248 }
1249 finally {
1250 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1251 }
1252 }
1253
1254 public void removeGroup(long pk, long groupPK) throws SystemException {
1255 try {
1256 removeGroup.remove(pk, groupPK);
1257 }
1258 catch (Exception e) {
1259 throw processException(e);
1260 }
1261 finally {
1262 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1263 }
1264 }
1265
1266 public void removeGroup(long pk, com.liferay.portal.model.Group group)
1267 throws SystemException {
1268 try {
1269 removeGroup.remove(pk, group.getPrimaryKey());
1270 }
1271 catch (Exception e) {
1272 throw processException(e);
1273 }
1274 finally {
1275 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1276 }
1277 }
1278
1279 public void removeGroups(long pk, long[] groupPKs)
1280 throws SystemException {
1281 try {
1282 for (long groupPK : groupPKs) {
1283 removeGroup.remove(pk, groupPK);
1284 }
1285 }
1286 catch (Exception e) {
1287 throw processException(e);
1288 }
1289 finally {
1290 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1291 }
1292 }
1293
1294 public void removeGroups(long pk,
1295 List<com.liferay.portal.model.Group> groups) throws SystemException {
1296 try {
1297 for (com.liferay.portal.model.Group group : groups) {
1298 removeGroup.remove(pk, group.getPrimaryKey());
1299 }
1300 }
1301 catch (Exception e) {
1302 throw processException(e);
1303 }
1304 finally {
1305 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1306 }
1307 }
1308
1309 public void setGroups(long pk, long[] groupPKs) throws SystemException {
1310 try {
1311 Set<Long> groupPKSet = SetUtil.fromArray(groupPKs);
1312
1313 List<com.liferay.portal.model.Group> groups = getGroups(pk);
1314
1315 for (com.liferay.portal.model.Group group : groups) {
1316 if (!groupPKSet.contains(group.getPrimaryKey())) {
1317 removeGroup.remove(pk, group.getPrimaryKey());
1318 }
1319 else {
1320 groupPKSet.remove(group.getPrimaryKey());
1321 }
1322 }
1323
1324 for (Long groupPK : groupPKSet) {
1325 addGroup.add(pk, groupPK);
1326 }
1327 }
1328 catch (Exception e) {
1329 throw processException(e);
1330 }
1331 finally {
1332 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1333 }
1334 }
1335
1336 public void setGroups(long pk, List<com.liferay.portal.model.Group> groups)
1337 throws SystemException {
1338 try {
1339 long[] groupPKs = new long[groups.size()];
1340
1341 for (int i = 0; i < groups.size(); i++) {
1342 com.liferay.portal.model.Group group = groups.get(i);
1343
1344 groupPKs[i] = group.getPrimaryKey();
1345 }
1346
1347 setGroups(pk, groupPKs);
1348 }
1349 catch (Exception e) {
1350 throw processException(e);
1351 }
1352 finally {
1353 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
1354 }
1355 }
1356
1357 public List<com.liferay.portal.model.Role> getRoles(long pk)
1358 throws SystemException {
1359 return getRoles(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1360 }
1361
1362 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
1363 int end) throws SystemException {
1364 return getRoles(pk, start, end, null);
1365 }
1366
1367 public static final FinderPath FINDER_PATH_GET_ROLES = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
1368 PermissionModelImpl.FINDER_CACHE_ENABLED_ROLES_PERMISSIONS,
1369 PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME,
1370 "getRoles",
1371 new String[] {
1372 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1373 "com.liferay.portal.kernel.util.OrderByComparator"
1374 });
1375
1376 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
1377 int end, OrderByComparator obc) throws SystemException {
1378 Object[] finderArgs = new Object[] {
1379 new Long(pk), String.valueOf(start), String.valueOf(end),
1380 String.valueOf(obc)
1381 };
1382
1383 List<com.liferay.portal.model.Role> list = (List<com.liferay.portal.model.Role>)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES,
1384 finderArgs, this);
1385
1386 if (list == null) {
1387 Session session = null;
1388
1389 try {
1390 session = openSession();
1391
1392 String sql = null;
1393
1394 if (obc != null) {
1395 sql = _SQL_GETROLES.concat(ORDER_BY_CLAUSE)
1396 .concat(obc.getOrderBy());
1397 }
1398
1399 else {
1400 sql = _SQL_GETROLES.concat(com.liferay.portal.model.impl.RoleModelImpl.ORDER_BY_SQL);
1401 }
1402
1403 SQLQuery q = session.createSQLQuery(sql);
1404
1405 q.addEntity("Role_",
1406 com.liferay.portal.model.impl.RoleImpl.class);
1407
1408 QueryPos qPos = QueryPos.getInstance(q);
1409
1410 qPos.add(pk);
1411
1412 list = (List<com.liferay.portal.model.Role>)QueryUtil.list(q,
1413 getDialect(), start, end);
1414 }
1415 catch (Exception e) {
1416 throw processException(e);
1417 }
1418 finally {
1419 if (list == null) {
1420 list = new ArrayList<com.liferay.portal.model.Role>();
1421 }
1422
1423 rolePersistence.cacheResult(list);
1424
1425 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES, finderArgs,
1426 list);
1427
1428 closeSession(session);
1429 }
1430 }
1431
1432 return list;
1433 }
1434
1435 public static final FinderPath FINDER_PATH_GET_ROLES_SIZE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
1436 PermissionModelImpl.FINDER_CACHE_ENABLED_ROLES_PERMISSIONS,
1437 PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME,
1438 "getRolesSize", new String[] { Long.class.getName() });
1439
1440 public int getRolesSize(long pk) throws SystemException {
1441 Object[] finderArgs = new Object[] { new Long(pk) };
1442
1443 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES_SIZE,
1444 finderArgs, this);
1445
1446 if (count == null) {
1447 Session session = null;
1448
1449 try {
1450 session = openSession();
1451
1452 SQLQuery q = session.createSQLQuery(_SQL_GETROLESSIZE);
1453
1454 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
1455
1456 QueryPos qPos = QueryPos.getInstance(q);
1457
1458 qPos.add(pk);
1459
1460 count = (Long)q.uniqueResult();
1461 }
1462 catch (Exception e) {
1463 throw processException(e);
1464 }
1465 finally {
1466 if (count == null) {
1467 count = Long.valueOf(0);
1468 }
1469
1470 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES_SIZE,
1471 finderArgs, count);
1472
1473 closeSession(session);
1474 }
1475 }
1476
1477 return count.intValue();
1478 }
1479
1480 public static final FinderPath FINDER_PATH_CONTAINS_ROLE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
1481 PermissionModelImpl.FINDER_CACHE_ENABLED_ROLES_PERMISSIONS,
1482 PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME,
1483 "containsRole",
1484 new String[] { Long.class.getName(), Long.class.getName() });
1485
1486 public boolean containsRole(long pk, long rolePK) throws SystemException {
1487 Object[] finderArgs = new Object[] { new Long(pk), new Long(rolePK) };
1488
1489 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ROLE,
1490 finderArgs, this);
1491
1492 if (value == null) {
1493 try {
1494 value = Boolean.valueOf(containsRole.contains(pk, rolePK));
1495 }
1496 catch (Exception e) {
1497 throw processException(e);
1498 }
1499 finally {
1500 if (value == null) {
1501 value = Boolean.FALSE;
1502 }
1503
1504 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ROLE,
1505 finderArgs, value);
1506 }
1507 }
1508
1509 return value.booleanValue();
1510 }
1511
1512 public boolean containsRoles(long pk) throws SystemException {
1513 if (getRolesSize(pk) > 0) {
1514 return true;
1515 }
1516 else {
1517 return false;
1518 }
1519 }
1520
1521 public void addRole(long pk, long rolePK) throws SystemException {
1522 try {
1523 addRole.add(pk, rolePK);
1524 }
1525 catch (Exception e) {
1526 throw processException(e);
1527 }
1528 finally {
1529 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1530 }
1531 }
1532
1533 public void addRole(long pk, com.liferay.portal.model.Role role)
1534 throws SystemException {
1535 try {
1536 addRole.add(pk, role.getPrimaryKey());
1537 }
1538 catch (Exception e) {
1539 throw processException(e);
1540 }
1541 finally {
1542 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1543 }
1544 }
1545
1546 public void addRoles(long pk, long[] rolePKs) throws SystemException {
1547 try {
1548 for (long rolePK : rolePKs) {
1549 addRole.add(pk, rolePK);
1550 }
1551 }
1552 catch (Exception e) {
1553 throw processException(e);
1554 }
1555 finally {
1556 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1557 }
1558 }
1559
1560 public void addRoles(long pk, List<com.liferay.portal.model.Role> roles)
1561 throws SystemException {
1562 try {
1563 for (com.liferay.portal.model.Role role : roles) {
1564 addRole.add(pk, role.getPrimaryKey());
1565 }
1566 }
1567 catch (Exception e) {
1568 throw processException(e);
1569 }
1570 finally {
1571 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1572 }
1573 }
1574
1575 public void clearRoles(long pk) throws SystemException {
1576 try {
1577 clearRoles.clear(pk);
1578 }
1579 catch (Exception e) {
1580 throw processException(e);
1581 }
1582 finally {
1583 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1584 }
1585 }
1586
1587 public void removeRole(long pk, long rolePK) throws SystemException {
1588 try {
1589 removeRole.remove(pk, rolePK);
1590 }
1591 catch (Exception e) {
1592 throw processException(e);
1593 }
1594 finally {
1595 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1596 }
1597 }
1598
1599 public void removeRole(long pk, com.liferay.portal.model.Role role)
1600 throws SystemException {
1601 try {
1602 removeRole.remove(pk, role.getPrimaryKey());
1603 }
1604 catch (Exception e) {
1605 throw processException(e);
1606 }
1607 finally {
1608 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1609 }
1610 }
1611
1612 public void removeRoles(long pk, long[] rolePKs) throws SystemException {
1613 try {
1614 for (long rolePK : rolePKs) {
1615 removeRole.remove(pk, rolePK);
1616 }
1617 }
1618 catch (Exception e) {
1619 throw processException(e);
1620 }
1621 finally {
1622 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1623 }
1624 }
1625
1626 public void removeRoles(long pk, List<com.liferay.portal.model.Role> roles)
1627 throws SystemException {
1628 try {
1629 for (com.liferay.portal.model.Role role : roles) {
1630 removeRole.remove(pk, role.getPrimaryKey());
1631 }
1632 }
1633 catch (Exception e) {
1634 throw processException(e);
1635 }
1636 finally {
1637 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1638 }
1639 }
1640
1641 public void setRoles(long pk, long[] rolePKs) throws SystemException {
1642 try {
1643 Set<Long> rolePKSet = SetUtil.fromArray(rolePKs);
1644
1645 List<com.liferay.portal.model.Role> roles = getRoles(pk);
1646
1647 for (com.liferay.portal.model.Role role : roles) {
1648 if (!rolePKSet.contains(role.getPrimaryKey())) {
1649 removeRole.remove(pk, role.getPrimaryKey());
1650 }
1651 else {
1652 rolePKSet.remove(role.getPrimaryKey());
1653 }
1654 }
1655
1656 for (Long rolePK : rolePKSet) {
1657 addRole.add(pk, rolePK);
1658 }
1659 }
1660 catch (Exception e) {
1661 throw processException(e);
1662 }
1663 finally {
1664 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1665 }
1666 }
1667
1668 public void setRoles(long pk, List<com.liferay.portal.model.Role> roles)
1669 throws SystemException {
1670 try {
1671 long[] rolePKs = new long[roles.size()];
1672
1673 for (int i = 0; i < roles.size(); i++) {
1674 com.liferay.portal.model.Role role = roles.get(i);
1675
1676 rolePKs[i] = role.getPrimaryKey();
1677 }
1678
1679 setRoles(pk, rolePKs);
1680 }
1681 catch (Exception e) {
1682 throw processException(e);
1683 }
1684 finally {
1685 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_ROLES_PERMISSIONS_NAME);
1686 }
1687 }
1688
1689 public List<com.liferay.portal.model.User> getUsers(long pk)
1690 throws SystemException {
1691 return getUsers(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1692 }
1693
1694 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
1695 int end) throws SystemException {
1696 return getUsers(pk, start, end, null);
1697 }
1698
1699 public static final FinderPath FINDER_PATH_GET_USERS = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
1700 PermissionModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
1701 PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
1702 "getUsers",
1703 new String[] {
1704 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1705 "com.liferay.portal.kernel.util.OrderByComparator"
1706 });
1707
1708 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
1709 int end, OrderByComparator obc) throws SystemException {
1710 Object[] finderArgs = new Object[] {
1711 new Long(pk), String.valueOf(start), String.valueOf(end),
1712 String.valueOf(obc)
1713 };
1714
1715 List<com.liferay.portal.model.User> list = (List<com.liferay.portal.model.User>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS,
1716 finderArgs, this);
1717
1718 if (list == null) {
1719 Session session = null;
1720
1721 try {
1722 session = openSession();
1723
1724 String sql = null;
1725
1726 if (obc != null) {
1727 sql = _SQL_GETUSERS.concat(ORDER_BY_CLAUSE)
1728 .concat(obc.getOrderBy());
1729 }
1730
1731 sql = _SQL_GETUSERS;
1732
1733 SQLQuery q = session.createSQLQuery(sql);
1734
1735 q.addEntity("User_",
1736 com.liferay.portal.model.impl.UserImpl.class);
1737
1738 QueryPos qPos = QueryPos.getInstance(q);
1739
1740 qPos.add(pk);
1741
1742 list = (List<com.liferay.portal.model.User>)QueryUtil.list(q,
1743 getDialect(), start, end);
1744 }
1745 catch (Exception e) {
1746 throw processException(e);
1747 }
1748 finally {
1749 if (list == null) {
1750 list = new ArrayList<com.liferay.portal.model.User>();
1751 }
1752
1753 userPersistence.cacheResult(list);
1754
1755 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS, finderArgs,
1756 list);
1757
1758 closeSession(session);
1759 }
1760 }
1761
1762 return list;
1763 }
1764
1765 public static final FinderPath FINDER_PATH_GET_USERS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
1766 PermissionModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
1767 PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
1768 "getUsersSize", new String[] { Long.class.getName() });
1769
1770 public int getUsersSize(long pk) throws SystemException {
1771 Object[] finderArgs = new Object[] { new Long(pk) };
1772
1773 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS_SIZE,
1774 finderArgs, this);
1775
1776 if (count == null) {
1777 Session session = null;
1778
1779 try {
1780 session = openSession();
1781
1782 SQLQuery q = session.createSQLQuery(_SQL_GETUSERSSIZE);
1783
1784 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
1785
1786 QueryPos qPos = QueryPos.getInstance(q);
1787
1788 qPos.add(pk);
1789
1790 count = (Long)q.uniqueResult();
1791 }
1792 catch (Exception e) {
1793 throw processException(e);
1794 }
1795 finally {
1796 if (count == null) {
1797 count = Long.valueOf(0);
1798 }
1799
1800 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS_SIZE,
1801 finderArgs, count);
1802
1803 closeSession(session);
1804 }
1805 }
1806
1807 return count.intValue();
1808 }
1809
1810 public static final FinderPath FINDER_PATH_CONTAINS_USER = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
1811 PermissionModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
1812 PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
1813 "containsUser",
1814 new String[] { Long.class.getName(), Long.class.getName() });
1815
1816 public boolean containsUser(long pk, long userPK) throws SystemException {
1817 Object[] finderArgs = new Object[] { new Long(pk), new Long(userPK) };
1818
1819 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USER,
1820 finderArgs, this);
1821
1822 if (value == null) {
1823 try {
1824 value = Boolean.valueOf(containsUser.contains(pk, userPK));
1825 }
1826 catch (Exception e) {
1827 throw processException(e);
1828 }
1829 finally {
1830 if (value == null) {
1831 value = Boolean.FALSE;
1832 }
1833
1834 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USER,
1835 finderArgs, value);
1836 }
1837 }
1838
1839 return value.booleanValue();
1840 }
1841
1842 public boolean containsUsers(long pk) throws SystemException {
1843 if (getUsersSize(pk) > 0) {
1844 return true;
1845 }
1846 else {
1847 return false;
1848 }
1849 }
1850
1851 public void addUser(long pk, long userPK) throws SystemException {
1852 try {
1853 addUser.add(pk, userPK);
1854 }
1855 catch (Exception e) {
1856 throw processException(e);
1857 }
1858 finally {
1859 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1860 }
1861 }
1862
1863 public void addUser(long pk, com.liferay.portal.model.User user)
1864 throws SystemException {
1865 try {
1866 addUser.add(pk, user.getPrimaryKey());
1867 }
1868 catch (Exception e) {
1869 throw processException(e);
1870 }
1871 finally {
1872 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1873 }
1874 }
1875
1876 public void addUsers(long pk, long[] userPKs) throws SystemException {
1877 try {
1878 for (long userPK : userPKs) {
1879 addUser.add(pk, userPK);
1880 }
1881 }
1882 catch (Exception e) {
1883 throw processException(e);
1884 }
1885 finally {
1886 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1887 }
1888 }
1889
1890 public void addUsers(long pk, List<com.liferay.portal.model.User> users)
1891 throws SystemException {
1892 try {
1893 for (com.liferay.portal.model.User user : users) {
1894 addUser.add(pk, user.getPrimaryKey());
1895 }
1896 }
1897 catch (Exception e) {
1898 throw processException(e);
1899 }
1900 finally {
1901 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1902 }
1903 }
1904
1905 public void clearUsers(long pk) throws SystemException {
1906 try {
1907 clearUsers.clear(pk);
1908 }
1909 catch (Exception e) {
1910 throw processException(e);
1911 }
1912 finally {
1913 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1914 }
1915 }
1916
1917 public void removeUser(long pk, long userPK) throws SystemException {
1918 try {
1919 removeUser.remove(pk, userPK);
1920 }
1921 catch (Exception e) {
1922 throw processException(e);
1923 }
1924 finally {
1925 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1926 }
1927 }
1928
1929 public void removeUser(long pk, com.liferay.portal.model.User user)
1930 throws SystemException {
1931 try {
1932 removeUser.remove(pk, user.getPrimaryKey());
1933 }
1934 catch (Exception e) {
1935 throw processException(e);
1936 }
1937 finally {
1938 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1939 }
1940 }
1941
1942 public void removeUsers(long pk, long[] userPKs) throws SystemException {
1943 try {
1944 for (long userPK : userPKs) {
1945 removeUser.remove(pk, userPK);
1946 }
1947 }
1948 catch (Exception e) {
1949 throw processException(e);
1950 }
1951 finally {
1952 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1953 }
1954 }
1955
1956 public void removeUsers(long pk, List<com.liferay.portal.model.User> users)
1957 throws SystemException {
1958 try {
1959 for (com.liferay.portal.model.User user : users) {
1960 removeUser.remove(pk, user.getPrimaryKey());
1961 }
1962 }
1963 catch (Exception e) {
1964 throw processException(e);
1965 }
1966 finally {
1967 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1968 }
1969 }
1970
1971 public void setUsers(long pk, long[] userPKs) throws SystemException {
1972 try {
1973 Set<Long> userPKSet = SetUtil.fromArray(userPKs);
1974
1975 List<com.liferay.portal.model.User> users = getUsers(pk);
1976
1977 for (com.liferay.portal.model.User user : users) {
1978 if (!userPKSet.contains(user.getPrimaryKey())) {
1979 removeUser.remove(pk, user.getPrimaryKey());
1980 }
1981 else {
1982 userPKSet.remove(user.getPrimaryKey());
1983 }
1984 }
1985
1986 for (Long userPK : userPKSet) {
1987 addUser.add(pk, userPK);
1988 }
1989 }
1990 catch (Exception e) {
1991 throw processException(e);
1992 }
1993 finally {
1994 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
1995 }
1996 }
1997
1998 public void setUsers(long pk, List<com.liferay.portal.model.User> users)
1999 throws SystemException {
2000 try {
2001 long[] userPKs = new long[users.size()];
2002
2003 for (int i = 0; i < users.size(); i++) {
2004 com.liferay.portal.model.User user = users.get(i);
2005
2006 userPKs[i] = user.getPrimaryKey();
2007 }
2008
2009 setUsers(pk, userPKs);
2010 }
2011 catch (Exception e) {
2012 throw processException(e);
2013 }
2014 finally {
2015 FinderCacheUtil.clearCache(PermissionModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
2016 }
2017 }
2018
2019 public void afterPropertiesSet() {
2020 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2021 com.liferay.portal.util.PropsUtil.get(
2022 "value.object.listener.com.liferay.portal.model.Permission")));
2023
2024 if (listenerClassNames.length > 0) {
2025 try {
2026 List<ModelListener<Permission>> listenersList = new ArrayList<ModelListener<Permission>>();
2027
2028 for (String listenerClassName : listenerClassNames) {
2029 listenersList.add((ModelListener<Permission>)Class.forName(
2030 listenerClassName).newInstance());
2031 }
2032
2033 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2034 }
2035 catch (Exception e) {
2036 _log.error(e);
2037 }
2038 }
2039
2040 containsGroup = new ContainsGroup(this);
2041
2042 addGroup = new AddGroup(this);
2043 clearGroups = new ClearGroups(this);
2044 removeGroup = new RemoveGroup(this);
2045
2046 containsRole = new ContainsRole(this);
2047
2048 addRole = new AddRole(this);
2049 clearRoles = new ClearRoles(this);
2050 removeRole = new RemoveRole(this);
2051
2052 containsUser = new ContainsUser(this);
2053
2054 addUser = new AddUser(this);
2055 clearUsers = new ClearUsers(this);
2056 removeUser = new RemoveUser(this);
2057 }
2058
2059 @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence")
2060 protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
2061 @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence")
2062 protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
2063 @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence")
2064 protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
2065 @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence")
2066 protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
2067 @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
2068 protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
2069 @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence")
2070 protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
2071 @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence")
2072 protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
2073 @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence")
2074 protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
2075 @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
2076 protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
2077 @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
2078 protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
2079 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence")
2080 protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
2081 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPrototypePersistence")
2082 protected com.liferay.portal.service.persistence.LayoutPrototypePersistence layoutPrototypePersistence;
2083 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence")
2084 protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
2085 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPrototypePersistence")
2086 protected com.liferay.portal.service.persistence.LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2087 @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence")
2088 protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
2089 @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence")
2090 protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
2091 @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence")
2092 protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
2093 @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence")
2094 protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
2095 @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence")
2096 protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2097 @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence")
2098 protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
2099 @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence")
2100 protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
2101 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence")
2102 protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
2103 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence")
2104 protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2105 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence")
2106 protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
2107 @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence")
2108 protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
2109 @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence")
2110 protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
2111 @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence")
2112 protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
2113 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence")
2114 protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
2115 @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence")
2116 protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
2117 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
2118 protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
2119 @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence")
2120 protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
2121 @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence")
2122 protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
2123 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
2124 protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
2125 @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence")
2126 protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
2127 @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence")
2128 protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
2129 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence")
2130 protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
2131 @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence")
2132 protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
2133 @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence")
2134 protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
2135 @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence")
2136 protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
2137 @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
2138 protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
2139 @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
2140 protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
2141 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence")
2142 protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
2143 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupGroupRolePersistence")
2144 protected com.liferay.portal.service.persistence.UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2145 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence")
2146 protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
2147 @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence")
2148 protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
2149 @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence")
2150 protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
2151 @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence")
2152 protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
2153 @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence")
2154 protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
2155 @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence")
2156 protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
2157 @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence")
2158 protected com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2159 @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence")
2160 protected com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2161 protected ContainsGroup containsGroup;
2162 protected AddGroup addGroup;
2163 protected ClearGroups clearGroups;
2164 protected RemoveGroup removeGroup;
2165 protected ContainsRole containsRole;
2166 protected AddRole addRole;
2167 protected ClearRoles clearRoles;
2168 protected RemoveRole removeRole;
2169 protected ContainsUser containsUser;
2170 protected AddUser addUser;
2171 protected ClearUsers clearUsers;
2172 protected RemoveUser removeUser;
2173
2174 protected class ContainsGroup {
2175 protected ContainsGroup(PermissionPersistenceImpl persistenceImpl) {
2176 super();
2177
2178 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2179 _SQL_CONTAINSGROUP,
2180 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
2181 }
2182
2183 protected boolean contains(long permissionId, long groupId) {
2184 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2185 new Long(permissionId), new Long(groupId)
2186 });
2187
2188 if (results.size() > 0) {
2189 Integer count = results.get(0);
2190
2191 if (count.intValue() > 0) {
2192 return true;
2193 }
2194 }
2195
2196 return false;
2197 }
2198
2199 private MappingSqlQuery<Integer> _mappingSqlQuery;
2200 }
2201
2202 protected class AddGroup {
2203 protected AddGroup(PermissionPersistenceImpl persistenceImpl) {
2204 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2205 "INSERT INTO Groups_Permissions (permissionId, groupId) VALUES (?, ?)",
2206 new int[] { Types.BIGINT, Types.BIGINT });
2207 _persistenceImpl = persistenceImpl;
2208 }
2209
2210 protected void add(long permissionId, long groupId)
2211 throws SystemException {
2212 if (!_persistenceImpl.containsGroup.contains(permissionId, groupId)) {
2213 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
2214
2215 for (ModelListener<Permission> listener : listeners) {
2216 listener.onBeforeAddAssociation(permissionId,
2217 com.liferay.portal.model.Group.class.getName(), groupId);
2218 }
2219
2220 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
2221 listener.onBeforeAddAssociation(groupId,
2222 Permission.class.getName(), permissionId);
2223 }
2224
2225 _sqlUpdate.update(new Object[] {
2226 new Long(permissionId), new Long(groupId)
2227 });
2228
2229 for (ModelListener<Permission> listener : listeners) {
2230 listener.onAfterAddAssociation(permissionId,
2231 com.liferay.portal.model.Group.class.getName(), groupId);
2232 }
2233
2234 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
2235 listener.onAfterAddAssociation(groupId,
2236 Permission.class.getName(), permissionId);
2237 }
2238 }
2239 }
2240
2241 private SqlUpdate _sqlUpdate;
2242 private PermissionPersistenceImpl _persistenceImpl;
2243 }
2244
2245 protected class ClearGroups {
2246 protected ClearGroups(PermissionPersistenceImpl persistenceImpl) {
2247 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2248 "DELETE FROM Groups_Permissions WHERE permissionId = ?",
2249 new int[] { Types.BIGINT });
2250 }
2251
2252 protected void clear(long permissionId) throws SystemException {
2253 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
2254
2255 List<com.liferay.portal.model.Group> groups = null;
2256
2257 if ((listeners.length > 0) || (groupListeners.length > 0)) {
2258 groups = getGroups(permissionId);
2259
2260 for (com.liferay.portal.model.Group group : groups) {
2261 for (ModelListener<Permission> listener : listeners) {
2262 listener.onBeforeRemoveAssociation(permissionId,
2263 com.liferay.portal.model.Group.class.getName(),
2264 group.getPrimaryKey());
2265 }
2266
2267 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
2268 listener.onBeforeRemoveAssociation(group.getPrimaryKey(),
2269 Permission.class.getName(), permissionId);
2270 }
2271 }
2272 }
2273
2274 _sqlUpdate.update(new Object[] { new Long(permissionId) });
2275
2276 if ((listeners.length > 0) || (groupListeners.length > 0)) {
2277 for (com.liferay.portal.model.Group group : groups) {
2278 for (ModelListener<Permission> listener : listeners) {
2279 listener.onAfterRemoveAssociation(permissionId,
2280 com.liferay.portal.model.Group.class.getName(),
2281 group.getPrimaryKey());
2282 }
2283
2284 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
2285 listener.onAfterRemoveAssociation(group.getPrimaryKey(),
2286 Permission.class.getName(), permissionId);
2287 }
2288 }
2289 }
2290 }
2291
2292 private SqlUpdate _sqlUpdate;
2293 }
2294
2295 protected class RemoveGroup {
2296 protected RemoveGroup(PermissionPersistenceImpl persistenceImpl) {
2297 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2298 "DELETE FROM Groups_Permissions WHERE permissionId = ? AND groupId = ?",
2299 new int[] { Types.BIGINT, Types.BIGINT });
2300 _persistenceImpl = persistenceImpl;
2301 }
2302
2303 protected void remove(long permissionId, long groupId)
2304 throws SystemException {
2305 if (_persistenceImpl.containsGroup.contains(permissionId, groupId)) {
2306 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
2307
2308 for (ModelListener<Permission> listener : listeners) {
2309 listener.onBeforeRemoveAssociation(permissionId,
2310 com.liferay.portal.model.Group.class.getName(), groupId);
2311 }
2312
2313 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
2314 listener.onBeforeRemoveAssociation(groupId,
2315 Permission.class.getName(), permissionId);
2316 }
2317
2318 _sqlUpdate.update(new Object[] {
2319 new Long(permissionId), new Long(groupId)
2320 });
2321
2322 for (ModelListener<Permission> listener : listeners) {
2323 listener.onAfterRemoveAssociation(permissionId,
2324 com.liferay.portal.model.Group.class.getName(), groupId);
2325 }
2326
2327 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
2328 listener.onAfterRemoveAssociation(groupId,
2329 Permission.class.getName(), permissionId);
2330 }
2331 }
2332 }
2333
2334 private SqlUpdate _sqlUpdate;
2335 private PermissionPersistenceImpl _persistenceImpl;
2336 }
2337
2338 protected class ContainsRole {
2339 protected ContainsRole(PermissionPersistenceImpl persistenceImpl) {
2340 super();
2341
2342 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2343 _SQL_CONTAINSROLE,
2344 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
2345 }
2346
2347 protected boolean contains(long permissionId, long roleId) {
2348 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2349 new Long(permissionId), new Long(roleId)
2350 });
2351
2352 if (results.size() > 0) {
2353 Integer count = results.get(0);
2354
2355 if (count.intValue() > 0) {
2356 return true;
2357 }
2358 }
2359
2360 return false;
2361 }
2362
2363 private MappingSqlQuery<Integer> _mappingSqlQuery;
2364 }
2365
2366 protected class AddRole {
2367 protected AddRole(PermissionPersistenceImpl persistenceImpl) {
2368 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2369 "INSERT INTO Roles_Permissions (permissionId, roleId) VALUES (?, ?)",
2370 new int[] { Types.BIGINT, Types.BIGINT });
2371 _persistenceImpl = persistenceImpl;
2372 }
2373
2374 protected void add(long permissionId, long roleId)
2375 throws SystemException {
2376 if (!_persistenceImpl.containsRole.contains(permissionId, roleId)) {
2377 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
2378
2379 for (ModelListener<Permission> listener : listeners) {
2380 listener.onBeforeAddAssociation(permissionId,
2381 com.liferay.portal.model.Role.class.getName(), roleId);
2382 }
2383
2384 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
2385 listener.onBeforeAddAssociation(roleId,
2386 Permission.class.getName(), permissionId);
2387 }
2388
2389 _sqlUpdate.update(new Object[] {
2390 new Long(permissionId), new Long(roleId)
2391 });
2392
2393 for (ModelListener<Permission> listener : listeners) {
2394 listener.onAfterAddAssociation(permissionId,
2395 com.liferay.portal.model.Role.class.getName(), roleId);
2396 }
2397
2398 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
2399 listener.onAfterAddAssociation(roleId,
2400 Permission.class.getName(), permissionId);
2401 }
2402 }
2403 }
2404
2405 private SqlUpdate _sqlUpdate;
2406 private PermissionPersistenceImpl _persistenceImpl;
2407 }
2408
2409 protected class ClearRoles {
2410 protected ClearRoles(PermissionPersistenceImpl persistenceImpl) {
2411 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2412 "DELETE FROM Roles_Permissions WHERE permissionId = ?",
2413 new int[] { Types.BIGINT });
2414 }
2415
2416 protected void clear(long permissionId) throws SystemException {
2417 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
2418
2419 List<com.liferay.portal.model.Role> roles = null;
2420
2421 if ((listeners.length > 0) || (roleListeners.length > 0)) {
2422 roles = getRoles(permissionId);
2423
2424 for (com.liferay.portal.model.Role role : roles) {
2425 for (ModelListener<Permission> listener : listeners) {
2426 listener.onBeforeRemoveAssociation(permissionId,
2427 com.liferay.portal.model.Role.class.getName(),
2428 role.getPrimaryKey());
2429 }
2430
2431 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
2432 listener.onBeforeRemoveAssociation(role.getPrimaryKey(),
2433 Permission.class.getName(), permissionId);
2434 }
2435 }
2436 }
2437
2438 _sqlUpdate.update(new Object[] { new Long(permissionId) });
2439
2440 if ((listeners.length > 0) || (roleListeners.length > 0)) {
2441 for (com.liferay.portal.model.Role role : roles) {
2442 for (ModelListener<Permission> listener : listeners) {
2443 listener.onAfterRemoveAssociation(permissionId,
2444 com.liferay.portal.model.Role.class.getName(),
2445 role.getPrimaryKey());
2446 }
2447
2448 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
2449 listener.onAfterRemoveAssociation(role.getPrimaryKey(),
2450 Permission.class.getName(), permissionId);
2451 }
2452 }
2453 }
2454 }
2455
2456 private SqlUpdate _sqlUpdate;
2457 }
2458
2459 protected class RemoveRole {
2460 protected RemoveRole(PermissionPersistenceImpl persistenceImpl) {
2461 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2462 "DELETE FROM Roles_Permissions WHERE permissionId = ? AND roleId = ?",
2463 new int[] { Types.BIGINT, Types.BIGINT });
2464 _persistenceImpl = persistenceImpl;
2465 }
2466
2467 protected void remove(long permissionId, long roleId)
2468 throws SystemException {
2469 if (_persistenceImpl.containsRole.contains(permissionId, roleId)) {
2470 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
2471
2472 for (ModelListener<Permission> listener : listeners) {
2473 listener.onBeforeRemoveAssociation(permissionId,
2474 com.liferay.portal.model.Role.class.getName(), roleId);
2475 }
2476
2477 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
2478 listener.onBeforeRemoveAssociation(roleId,
2479 Permission.class.getName(), permissionId);
2480 }
2481
2482 _sqlUpdate.update(new Object[] {
2483 new Long(permissionId), new Long(roleId)
2484 });
2485
2486 for (ModelListener<Permission> listener : listeners) {
2487 listener.onAfterRemoveAssociation(permissionId,
2488 com.liferay.portal.model.Role.class.getName(), roleId);
2489 }
2490
2491 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
2492 listener.onAfterRemoveAssociation(roleId,
2493 Permission.class.getName(), permissionId);
2494 }
2495 }
2496 }
2497
2498 private SqlUpdate _sqlUpdate;
2499 private PermissionPersistenceImpl _persistenceImpl;
2500 }
2501
2502 protected class ContainsUser {
2503 protected ContainsUser(PermissionPersistenceImpl persistenceImpl) {
2504 super();
2505
2506 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2507 _SQL_CONTAINSUSER,
2508 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
2509 }
2510
2511 protected boolean contains(long permissionId, long userId) {
2512 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2513 new Long(permissionId), new Long(userId)
2514 });
2515
2516 if (results.size() > 0) {
2517 Integer count = results.get(0);
2518
2519 if (count.intValue() > 0) {
2520 return true;
2521 }
2522 }
2523
2524 return false;
2525 }
2526
2527 private MappingSqlQuery<Integer> _mappingSqlQuery;
2528 }
2529
2530 protected class AddUser {
2531 protected AddUser(PermissionPersistenceImpl persistenceImpl) {
2532 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2533 "INSERT INTO Users_Permissions (permissionId, userId) VALUES (?, ?)",
2534 new int[] { Types.BIGINT, Types.BIGINT });
2535 _persistenceImpl = persistenceImpl;
2536 }
2537
2538 protected void add(long permissionId, long userId)
2539 throws SystemException {
2540 if (!_persistenceImpl.containsUser.contains(permissionId, userId)) {
2541 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
2542
2543 for (ModelListener<Permission> listener : listeners) {
2544 listener.onBeforeAddAssociation(permissionId,
2545 com.liferay.portal.model.User.class.getName(), userId);
2546 }
2547
2548 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2549 listener.onBeforeAddAssociation(userId,
2550 Permission.class.getName(), permissionId);
2551 }
2552
2553 _sqlUpdate.update(new Object[] {
2554 new Long(permissionId), new Long(userId)
2555 });
2556
2557 for (ModelListener<Permission> listener : listeners) {
2558 listener.onAfterAddAssociation(permissionId,
2559 com.liferay.portal.model.User.class.getName(), userId);
2560 }
2561
2562 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2563 listener.onAfterAddAssociation(userId,
2564 Permission.class.getName(), permissionId);
2565 }
2566 }
2567 }
2568
2569 private SqlUpdate _sqlUpdate;
2570 private PermissionPersistenceImpl _persistenceImpl;
2571 }
2572
2573 protected class ClearUsers {
2574 protected ClearUsers(PermissionPersistenceImpl persistenceImpl) {
2575 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2576 "DELETE FROM Users_Permissions WHERE permissionId = ?",
2577 new int[] { Types.BIGINT });
2578 }
2579
2580 protected void clear(long permissionId) throws SystemException {
2581 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
2582
2583 List<com.liferay.portal.model.User> users = null;
2584
2585 if ((listeners.length > 0) || (userListeners.length > 0)) {
2586 users = getUsers(permissionId);
2587
2588 for (com.liferay.portal.model.User user : users) {
2589 for (ModelListener<Permission> listener : listeners) {
2590 listener.onBeforeRemoveAssociation(permissionId,
2591 com.liferay.portal.model.User.class.getName(),
2592 user.getPrimaryKey());
2593 }
2594
2595 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2596 listener.onBeforeRemoveAssociation(user.getPrimaryKey(),
2597 Permission.class.getName(), permissionId);
2598 }
2599 }
2600 }
2601
2602 _sqlUpdate.update(new Object[] { new Long(permissionId) });
2603
2604 if ((listeners.length > 0) || (userListeners.length > 0)) {
2605 for (com.liferay.portal.model.User user : users) {
2606 for (ModelListener<Permission> listener : listeners) {
2607 listener.onAfterRemoveAssociation(permissionId,
2608 com.liferay.portal.model.User.class.getName(),
2609 user.getPrimaryKey());
2610 }
2611
2612 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2613 listener.onAfterRemoveAssociation(user.getPrimaryKey(),
2614 Permission.class.getName(), permissionId);
2615 }
2616 }
2617 }
2618 }
2619
2620 private SqlUpdate _sqlUpdate;
2621 }
2622
2623 protected class RemoveUser {
2624 protected RemoveUser(PermissionPersistenceImpl persistenceImpl) {
2625 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2626 "DELETE FROM Users_Permissions WHERE permissionId = ? AND userId = ?",
2627 new int[] { Types.BIGINT, Types.BIGINT });
2628 _persistenceImpl = persistenceImpl;
2629 }
2630
2631 protected void remove(long permissionId, long userId)
2632 throws SystemException {
2633 if (_persistenceImpl.containsUser.contains(permissionId, userId)) {
2634 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
2635
2636 for (ModelListener<Permission> listener : listeners) {
2637 listener.onBeforeRemoveAssociation(permissionId,
2638 com.liferay.portal.model.User.class.getName(), userId);
2639 }
2640
2641 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2642 listener.onBeforeRemoveAssociation(userId,
2643 Permission.class.getName(), permissionId);
2644 }
2645
2646 _sqlUpdate.update(new Object[] {
2647 new Long(permissionId), new Long(userId)
2648 });
2649
2650 for (ModelListener<Permission> listener : listeners) {
2651 listener.onAfterRemoveAssociation(permissionId,
2652 com.liferay.portal.model.User.class.getName(), userId);
2653 }
2654
2655 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2656 listener.onAfterRemoveAssociation(userId,
2657 Permission.class.getName(), permissionId);
2658 }
2659 }
2660 }
2661
2662 private SqlUpdate _sqlUpdate;
2663 private PermissionPersistenceImpl _persistenceImpl;
2664 }
2665
2666 private static final String _SQL_SELECT_PERMISSION = "SELECT permission FROM Permission permission";
2667 private static final String _SQL_SELECT_PERMISSION_WHERE = "SELECT permission FROM Permission permission WHERE ";
2668 private static final String _SQL_COUNT_PERMISSION = "SELECT COUNT(permission) FROM Permission permission";
2669 private static final String _SQL_COUNT_PERMISSION_WHERE = "SELECT COUNT(permission) FROM Permission permission WHERE ";
2670 private static final String _SQL_GETGROUPS = "SELECT {Group_.*} FROM Group_ INNER JOIN Groups_Permissions ON (Groups_Permissions.groupId = Group_.groupId) WHERE (Groups_Permissions.permissionId = ?)";
2671 private static final String _SQL_GETGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Permissions WHERE permissionId = ?";
2672 private static final String _SQL_CONTAINSGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Permissions WHERE permissionId = ? AND groupId = ?";
2673 private static final String _SQL_GETROLES = "SELECT {Role_.*} FROM Role_ INNER JOIN Roles_Permissions ON (Roles_Permissions.roleId = Role_.roleId) WHERE (Roles_Permissions.permissionId = ?)";
2674 private static final String _SQL_GETROLESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Roles_Permissions WHERE permissionId = ?";
2675 private static final String _SQL_CONTAINSROLE = "SELECT COUNT(*) AS COUNT_VALUE FROM Roles_Permissions WHERE permissionId = ? AND roleId = ?";
2676 private static final String _SQL_GETUSERS = "SELECT {User_.*} FROM User_ INNER JOIN Users_Permissions ON (Users_Permissions.userId = User_.userId) WHERE (Users_Permissions.permissionId = ?)";
2677 private static final String _SQL_GETUSERSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Permissions WHERE permissionId = ?";
2678 private static final String _SQL_CONTAINSUSER = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Permissions WHERE permissionId = ? AND userId = ?";
2679 private static final String _FINDER_COLUMN_RESOURCEID_RESOURCEID_2 = "permission.resourceId = ?";
2680 private static final String _FINDER_COLUMN_A_R_ACTIONID_1 = "permission.actionId IS NULL AND ";
2681 private static final String _FINDER_COLUMN_A_R_ACTIONID_2 = "permission.actionId = ? AND ";
2682 private static final String _FINDER_COLUMN_A_R_ACTIONID_3 = "(permission.actionId IS NULL OR permission.actionId = ?) AND ";
2683 private static final String _FINDER_COLUMN_A_R_RESOURCEID_2 = "permission.resourceId = ?";
2684 private static final String _ORDER_BY_ENTITY_ALIAS = "permission.";
2685 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Permission exists with the primary key ";
2686 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Permission exists with the key {";
2687 private static Log _log = LogFactoryUtil.getLog(PermissionPersistenceImpl.class);
2688}