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 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> findByC_P(
045                    long companyId, java.lang.String primKey)
046                    throws com.liferay.portal.kernel.exception.SystemException {
047                    return getFinder().findByC_P(companyId, primKey);
048            }
049    
050            public static java.util.List<com.liferay.portal.model.ResourcePermission> findByR_S(
051                    long roleId, int[] scopes, int start, int end)
052                    throws com.liferay.portal.kernel.exception.SystemException {
053                    return getFinder().findByR_S(roleId, scopes, start, end);
054            }
055    
056            public static ResourcePermissionFinder getFinder() {
057                    if (_finder == null) {
058                            _finder = (ResourcePermissionFinder)PortalBeanLocatorUtil.locate(ResourcePermissionFinder.class.getName());
059    
060                            ReferenceRegistry.registerReference(ResourcePermissionFinderUtil.class,
061                                    "_finder");
062                    }
063    
064                    return _finder;
065            }
066    
067            public void setFinder(ResourcePermissionFinder finder) {
068                    _finder = finder;
069    
070                    ReferenceRegistry.registerReference(ResourcePermissionFinderUtil.class,
071                            "_finder");
072            }
073    
074            private static ResourcePermissionFinder _finder;
075    }