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