1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
26  
27  /**
28   * <a href="PermissionFinderUtil.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   */
32  public class PermissionFinderUtil {
33      public static boolean containsPermissions_2(
34          java.util.List<com.liferay.portal.model.Permission> permissions,
35          long userId, java.util.List<com.liferay.portal.model.Group> groups,
36          long groupId) throws com.liferay.portal.SystemException {
37          return getFinder()
38                     .containsPermissions_2(permissions, userId, groups, groupId);
39      }
40  
41      public static boolean containsPermissions_4(
42          java.util.List<com.liferay.portal.model.Permission> permissions,
43          long userId, java.util.List<com.liferay.portal.model.Group> groups,
44          java.util.List<com.liferay.portal.model.Role> roles)
45          throws com.liferay.portal.SystemException {
46          return getFinder()
47                     .containsPermissions_4(permissions, userId, groups, roles);
48      }
49  
50      public static int countByGroupsPermissions(
51          java.util.List<com.liferay.portal.model.Permission> permissions,
52          java.util.List<com.liferay.portal.model.Group> groups)
53          throws com.liferay.portal.SystemException {
54          return getFinder().countByGroupsPermissions(permissions, groups);
55      }
56  
57      public static int countByGroupsRoles(
58          java.util.List<com.liferay.portal.model.Permission> permissions,
59          java.util.List<com.liferay.portal.model.Group> groups)
60          throws com.liferay.portal.SystemException {
61          return getFinder().countByGroupsRoles(permissions, groups);
62      }
63  
64      public static int countByRolesPermissions(
65          java.util.List<com.liferay.portal.model.Permission> permissions,
66          java.util.List<com.liferay.portal.model.Role> roles)
67          throws com.liferay.portal.SystemException {
68          return getFinder().countByRolesPermissions(permissions, roles);
69      }
70  
71      public static int countByUserGroupRole(
72          java.util.List<com.liferay.portal.model.Permission> permissions,
73          long userId, long groupId) throws com.liferay.portal.SystemException {
74          return getFinder().countByUserGroupRole(permissions, userId, groupId);
75      }
76  
77      public static int countByUsersPermissions(
78          java.util.List<com.liferay.portal.model.Permission> permissions,
79          long userId) throws com.liferay.portal.SystemException {
80          return getFinder().countByUsersPermissions(permissions, userId);
81      }
82  
83      public static int countByUsersRoles(
84          java.util.List<com.liferay.portal.model.Permission> permissions,
85          long userId) throws com.liferay.portal.SystemException {
86          return getFinder().countByUsersRoles(permissions, userId);
87      }
88  
89      public static java.util.List<com.liferay.portal.model.Permission> findByA_R(
90          java.lang.String actionId, long[] resourceIds)
91          throws com.liferay.portal.SystemException {
92          return getFinder().findByA_R(actionId, resourceIds);
93      }
94  
95      public static java.util.List<com.liferay.portal.model.Permission> findByG_R(
96          long groupId, long resourceId)
97          throws com.liferay.portal.SystemException {
98          return getFinder().findByG_R(groupId, resourceId);
99      }
100 
101     public static java.util.List<com.liferay.portal.model.Permission> findByR_R(
102         long roleId, long resourceId) throws com.liferay.portal.SystemException {
103         return getFinder().findByR_R(roleId, resourceId);
104     }
105 
106     public static java.util.List<com.liferay.portal.model.Permission> findByU_R(
107         long userId, long resourceId) throws com.liferay.portal.SystemException {
108         return getFinder().findByU_R(userId, resourceId);
109     }
110 
111     public static java.util.List<com.liferay.portal.model.Permission> findByO_G_R(
112         long organizationId, long groupId, long resourceId)
113         throws com.liferay.portal.SystemException {
114         return getFinder().findByO_G_R(organizationId, groupId, resourceId);
115     }
116 
117     public static java.util.List<com.liferay.portal.model.Permission> findByU_A_R(
118         long userId, java.lang.String[] actionIds, long resourceId)
119         throws com.liferay.portal.SystemException {
120         return getFinder().findByU_A_R(userId, actionIds, resourceId);
121     }
122 
123     public static java.util.List<com.liferay.portal.model.Permission> findByG_C_N_S_P(
124         long groupId, long companyId, java.lang.String name, int scope,
125         java.lang.String primKey) throws com.liferay.portal.SystemException {
126         return getFinder()
127                    .findByG_C_N_S_P(groupId, companyId, name, scope, primKey);
128     }
129 
130     public static java.util.List<com.liferay.portal.model.Permission> findByU_C_N_S_P(
131         long userId, long companyId, java.lang.String name, int scope,
132         java.lang.String primKey) throws com.liferay.portal.SystemException {
133         return getFinder()
134                    .findByU_C_N_S_P(userId, companyId, name, scope, primKey);
135     }
136 
137     public static PermissionFinder getFinder() {
138         if (_finder == null) {
139             _finder = (PermissionFinder)PortalBeanLocatorUtil.locate(PermissionFinder.class.getName());
140         }
141 
142         return _finder;
143     }
144 
145     public void setFinder(PermissionFinder finder) {
146         _finder = finder;
147     }
148 
149     private static PermissionFinder _finder;
150 }