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> 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 java.util.List<java.lang.String> findByC_N_S(long companyId,
057                    java.lang.String name, int scope)
058                    throws com.liferay.portal.kernel.exception.SystemException {
059                    return getFinder().findByC_N_S(companyId, name, scope);
060            }
061    
062            public static ResourcePermissionFinder getFinder() {
063                    if (_finder == null) {
064                            _finder = (ResourcePermissionFinder)PortalBeanLocatorUtil.locate(ResourcePermissionFinder.class.getName());
065    
066                            ReferenceRegistry.registerReference(ResourcePermissionFinderUtil.class,
067                                    "_finder");
068                    }
069    
070                    return _finder;
071            }
072    
073            public void setFinder(ResourcePermissionFinder finder) {
074                    _finder = finder;
075    
076                    ReferenceRegistry.registerReference(ResourcePermissionFinderUtil.class,
077                            "_finder");
078            }
079    
080            private static ResourcePermissionFinder _finder;
081    }