001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.ReferenceRegistry;
019    
020    /**
021     * @author Brian Wing Shun Chan
022     */
023    public class PermissionFinderUtil {
024            public static boolean containsPermissions_2(
025                    java.util.List<com.liferay.portal.model.Permission> permissions,
026                    long userId, java.util.List<com.liferay.portal.model.Group> groups,
027                    long groupId)
028                    throws com.liferay.portal.kernel.exception.SystemException {
029                    return getFinder()
030                                       .containsPermissions_2(permissions, userId, groups, groupId);
031            }
032    
033            public static boolean containsPermissions_4(
034                    java.util.List<com.liferay.portal.model.Permission> permissions,
035                    long userId, java.util.List<com.liferay.portal.model.Group> groups,
036                    java.util.List<com.liferay.portal.model.Role> roles)
037                    throws com.liferay.portal.kernel.exception.SystemException {
038                    return getFinder()
039                                       .containsPermissions_4(permissions, userId, groups, roles);
040            }
041    
042            public static int countByGroupsPermissions(
043                    java.util.List<com.liferay.portal.model.Permission> permissions,
044                    java.util.List<com.liferay.portal.model.Group> groups)
045                    throws com.liferay.portal.kernel.exception.SystemException {
046                    return getFinder().countByGroupsPermissions(permissions, groups);
047            }
048    
049            public static int countByGroupsRoles(
050                    java.util.List<com.liferay.portal.model.Permission> permissions,
051                    java.util.List<com.liferay.portal.model.Group> groups)
052                    throws com.liferay.portal.kernel.exception.SystemException {
053                    return getFinder().countByGroupsRoles(permissions, groups);
054            }
055    
056            public static int countByRolesPermissions(
057                    java.util.List<com.liferay.portal.model.Permission> permissions,
058                    java.util.List<com.liferay.portal.model.Role> roles)
059                    throws com.liferay.portal.kernel.exception.SystemException {
060                    return getFinder().countByRolesPermissions(permissions, roles);
061            }
062    
063            public static int countByUserGroupRole(
064                    java.util.List<com.liferay.portal.model.Permission> permissions,
065                    long userId, long groupId)
066                    throws com.liferay.portal.kernel.exception.SystemException {
067                    return getFinder().countByUserGroupRole(permissions, userId, groupId);
068            }
069    
070            public static int countByUsersPermissions(
071                    java.util.List<com.liferay.portal.model.Permission> permissions,
072                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
073                    return getFinder().countByUsersPermissions(permissions, userId);
074            }
075    
076            public static int countByUsersRoles(
077                    java.util.List<com.liferay.portal.model.Permission> permissions,
078                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
079                    return getFinder().countByUsersRoles(permissions, userId);
080            }
081    
082            public static int countByR_A_C(long roleId, java.lang.String actionId,
083                    long codeId) throws com.liferay.portal.kernel.exception.SystemException {
084                    return getFinder().countByR_A_C(roleId, actionId, codeId);
085            }
086    
087            public static java.util.List<com.liferay.portal.model.Permission> findByA_C(
088                    java.lang.String actionId, long codeId)
089                    throws com.liferay.portal.kernel.exception.SystemException {
090                    return getFinder().findByA_C(actionId, codeId);
091            }
092    
093            public static java.util.List<com.liferay.portal.model.Permission> findByA_R(
094                    java.lang.String actionId, long[] resourceIds)
095                    throws com.liferay.portal.kernel.exception.SystemException {
096                    return getFinder().findByA_R(actionId, resourceIds);
097            }
098    
099            public static java.util.List<com.liferay.portal.model.Permission> findByG_R(
100                    long groupId, long resourceId)
101                    throws com.liferay.portal.kernel.exception.SystemException {
102                    return getFinder().findByG_R(groupId, resourceId);
103            }
104    
105            public static java.util.List<com.liferay.portal.model.Permission> findByR_R(
106                    long roleId, long resourceId)
107                    throws com.liferay.portal.kernel.exception.SystemException {
108                    return getFinder().findByR_R(roleId, resourceId);
109            }
110    
111            public static java.util.List<com.liferay.portal.model.Permission> findByR_S(
112                    long roleId, int[] scopes)
113                    throws com.liferay.portal.kernel.exception.SystemException {
114                    return getFinder().findByR_S(roleId, scopes);
115            }
116    
117            public static java.util.List<com.liferay.portal.model.Permission> findByU_R(
118                    long userId, long resourceId)
119                    throws com.liferay.portal.kernel.exception.SystemException {
120                    return getFinder().findByU_R(userId, resourceId);
121            }
122    
123            public static java.util.List<com.liferay.portal.model.Permission> findByO_G_R(
124                    long organizationId, long groupId, long resourceId)
125                    throws com.liferay.portal.kernel.exception.SystemException {
126                    return getFinder().findByO_G_R(organizationId, groupId, resourceId);
127            }
128    
129            public static java.util.List<com.liferay.portal.model.Permission> findByU_A_R(
130                    long userId, java.lang.String[] actionIds, long resourceId)
131                    throws com.liferay.portal.kernel.exception.SystemException {
132                    return getFinder().findByU_A_R(userId, actionIds, resourceId);
133            }
134    
135            public static java.util.List<com.liferay.portal.model.Permission> findByG_C_N_S_P(
136                    long groupId, long companyId, java.lang.String name, int scope,
137                    java.lang.String primKey)
138                    throws com.liferay.portal.kernel.exception.SystemException {
139                    return getFinder()
140                                       .findByG_C_N_S_P(groupId, companyId, name, scope, primKey);
141            }
142    
143            public static java.util.List<com.liferay.portal.model.Permission> findByU_C_N_S_P(
144                    long userId, long companyId, java.lang.String name, int scope,
145                    java.lang.String primKey)
146                    throws com.liferay.portal.kernel.exception.SystemException {
147                    return getFinder()
148                                       .findByU_C_N_S_P(userId, companyId, name, scope, primKey);
149            }
150    
151            public static PermissionFinder getFinder() {
152                    if (_finder == null) {
153                            _finder = (PermissionFinder)PortalBeanLocatorUtil.locate(PermissionFinder.class.getName());
154    
155                            ReferenceRegistry.registerReference(PermissionFinderUtil.class,
156                                    "_finder");
157                    }
158    
159                    return _finder;
160            }
161    
162            public void setFinder(PermissionFinder finder) {
163                    _finder = finder;
164    
165                    ReferenceRegistry.registerReference(PermissionFinderUtil.class,
166                            "_finder");
167            }
168    
169            private static PermissionFinder _finder;
170    }