001    /**
002     * Copyright (c) 2000-2012 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 ResourcePermissionFinderUtil {
024            public static int countByR_S(long roleId, int[] scopes)
025                    throws com.liferay.portal.kernel.exception.SystemException {
026                    return getFinder().countByR_S(roleId, scopes);
027            }
028    
029            public static int countByC_N_S_P_R_A(long companyId, java.lang.String name,
030                    int scope, java.lang.String primKey, long[] roleIds, long actionId)
031                    throws com.liferay.portal.kernel.exception.SystemException {
032                    return getFinder()
033                                       .countByC_N_S_P_R_A(companyId, name, scope, primKey,
034                            roleIds, actionId);
035            }
036    
037            public static java.util.List<com.liferay.portal.model.ResourcePermission> findByResource(
038                    long companyId, long groupId, java.lang.String name,
039                    java.lang.String primKey)
040                    throws com.liferay.portal.kernel.exception.SystemException {
041                    return getFinder().findByResource(companyId, groupId, name, primKey);
042            }
043    
044            public static java.util.List<com.liferay.portal.model.ResourcePermission> findByR_S(
045                    long roleId, int[] scopes, int start, int end)
046                    throws com.liferay.portal.kernel.exception.SystemException {
047                    return getFinder().findByR_S(roleId, scopes, start, end);
048            }
049    
050            public static ResourcePermissionFinder getFinder() {
051                    if (_finder == null) {
052                            _finder = (ResourcePermissionFinder)PortalBeanLocatorUtil.locate(ResourcePermissionFinder.class.getName());
053    
054                            ReferenceRegistry.registerReference(ResourcePermissionFinderUtil.class,
055                                    "_finder");
056                    }
057    
058                    return _finder;
059            }
060    
061            public void setFinder(ResourcePermissionFinder finder) {
062                    _finder = finder;
063    
064                    ReferenceRegistry.registerReference(ResourcePermissionFinderUtil.class,
065                            "_finder");
066            }
067    
068            private static ResourcePermissionFinder _finder;
069    }