001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class PermissionFinderUtil {
023            public static boolean containsPermissions_2(
024                    java.util.List<com.liferay.portal.model.Permission> permissions,
025                    long userId, java.util.List<com.liferay.portal.model.Group> groups,
026                    long groupId)
027                    throws com.liferay.portal.kernel.exception.SystemException {
028                    return getFinder()
029                                       .containsPermissions_2(permissions, userId, groups, groupId);
030            }
031    
032            public static boolean containsPermissions_4(
033                    java.util.List<com.liferay.portal.model.Permission> permissions,
034                    long userId, java.util.List<com.liferay.portal.model.Group> groups,
035                    java.util.List<com.liferay.portal.model.Role> roles)
036                    throws com.liferay.portal.kernel.exception.SystemException {
037                    return getFinder()
038                                       .containsPermissions_4(permissions, userId, groups, roles);
039            }
040    
041            public static int countByGroupsPermissions(
042                    java.util.List<com.liferay.portal.model.Permission> permissions,
043                    java.util.List<com.liferay.portal.model.Group> groups)
044                    throws com.liferay.portal.kernel.exception.SystemException {
045                    return getFinder().countByGroupsPermissions(permissions, groups);
046            }
047    
048            public static int countByGroupsRoles(
049                    java.util.List<com.liferay.portal.model.Permission> permissions,
050                    java.util.List<com.liferay.portal.model.Group> groups)
051                    throws com.liferay.portal.kernel.exception.SystemException {
052                    return getFinder().countByGroupsRoles(permissions, groups);
053            }
054    
055            public static int countByRolesPermissions(
056                    java.util.List<com.liferay.portal.model.Permission> permissions,
057                    java.util.List<com.liferay.portal.model.Role> roles)
058                    throws com.liferay.portal.kernel.exception.SystemException {
059                    return getFinder().countByRolesPermissions(permissions, roles);
060            }
061    
062            public static int countByUserGroupRole(
063                    java.util.List<com.liferay.portal.model.Permission> permissions,
064                    long userId, long groupId)
065                    throws com.liferay.portal.kernel.exception.SystemException {
066                    return getFinder().countByUserGroupRole(permissions, userId, groupId);
067            }
068    
069            public static int countByUsersPermissions(
070                    java.util.List<com.liferay.portal.model.Permission> permissions,
071                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
072                    return getFinder().countByUsersPermissions(permissions, userId);
073            }
074    
075            public static int countByUsersRoles(
076                    java.util.List<com.liferay.portal.model.Permission> permissions,
077                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
078                    return getFinder().countByUsersRoles(permissions, userId);
079            }
080    
081            public static int countByR_A_C(long roleId, java.lang.String actionId,
082                    long codeId) throws com.liferay.portal.kernel.exception.SystemException {
083                    return getFinder().countByR_A_C(roleId, actionId, codeId);
084            }
085    
086            public static java.util.List<com.liferay.portal.model.Permission> findByA_C(
087                    java.lang.String actionId, long codeId)
088                    throws com.liferay.portal.kernel.exception.SystemException {
089                    return getFinder().findByA_C(actionId, codeId);
090            }
091    
092            public static java.util.List<com.liferay.portal.model.Permission> findByA_R(
093                    java.lang.String actionId, long[] resourceIds)
094                    throws com.liferay.portal.kernel.exception.SystemException {
095                    return getFinder().findByA_R(actionId, resourceIds);
096            }
097    
098            public static java.util.List<com.liferay.portal.model.Permission> findByG_R(
099                    long groupId, long resourceId)
100                    throws com.liferay.portal.kernel.exception.SystemException {
101                    return getFinder().findByG_R(groupId, resourceId);
102            }
103    
104            public static java.util.List<com.liferay.portal.model.Permission> findByR_R(
105                    long roleId, long resourceId)
106                    throws com.liferay.portal.kernel.exception.SystemException {
107                    return getFinder().findByR_R(roleId, resourceId);
108            }
109    
110            public static java.util.List<com.liferay.portal.model.Permission> findByU_R(
111                    long userId, long resourceId)
112                    throws com.liferay.portal.kernel.exception.SystemException {
113                    return getFinder().findByU_R(userId, resourceId);
114            }
115    
116            public static java.util.List<com.liferay.portal.model.Permission> findByO_G_R(
117                    long organizationId, long groupId, long resourceId)
118                    throws com.liferay.portal.kernel.exception.SystemException {
119                    return getFinder().findByO_G_R(organizationId, groupId, resourceId);
120            }
121    
122            public static java.util.List<com.liferay.portal.model.Permission> findByU_A_R(
123                    long userId, java.lang.String[] actionIds, long resourceId)
124                    throws com.liferay.portal.kernel.exception.SystemException {
125                    return getFinder().findByU_A_R(userId, actionIds, resourceId);
126            }
127    
128            public static java.util.List<com.liferay.portal.model.Permission> findByG_C_N_S_P(
129                    long groupId, long companyId, java.lang.String name, int scope,
130                    java.lang.String primKey)
131                    throws com.liferay.portal.kernel.exception.SystemException {
132                    return getFinder()
133                                       .findByG_C_N_S_P(groupId, companyId, name, scope, primKey);
134            }
135    
136            public static java.util.List<com.liferay.portal.model.Permission> findByU_C_N_S_P(
137                    long userId, long companyId, java.lang.String name, int scope,
138                    java.lang.String primKey)
139                    throws com.liferay.portal.kernel.exception.SystemException {
140                    return getFinder()
141                                       .findByU_C_N_S_P(userId, companyId, name, scope, primKey);
142            }
143    
144            public static PermissionFinder getFinder() {
145                    if (_finder == null) {
146                            _finder = (PermissionFinder)PortalBeanLocatorUtil.locate(PermissionFinder.class.getName());
147                    }
148    
149                    return _finder;
150            }
151    
152            public void setFinder(PermissionFinder finder) {
153                    _finder = finder;
154            }
155    
156            private static PermissionFinder _finder;
157    }