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