001    /**
002     * Copyright (c) 2000-present 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.kernel.security.permission;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    /**
020     * @author Raymond Aug??
021     * @see    InlineSQLHelper
022     */
023    public class InlineSQLHelperUtil {
024    
025            public static InlineSQLHelper getInlineSQLHelper() {
026                    PortalRuntimePermission.checkGetBeanProperty(InlineSQLHelperUtil.class);
027    
028                    return _inlineSQLPermission;
029            }
030    
031            public static boolean isEnabled() {
032                    return getInlineSQLHelper().isEnabled();
033            }
034    
035            public static boolean isEnabled(long groupId) {
036                    return getInlineSQLHelper().isEnabled(groupId);
037            }
038    
039            public static boolean isEnabled(long companyId, long groupId) {
040                    return getInlineSQLHelper().isEnabled(companyId, groupId);
041            }
042    
043            public static boolean isEnabled(long[] groupIds) {
044                    return getInlineSQLHelper().isEnabled(groupIds);
045            }
046    
047            public static String replacePermissionCheck(
048                    String sql, String className, String classPKField) {
049    
050                    return getInlineSQLHelper().replacePermissionCheck(
051                            sql, className, classPKField);
052            }
053    
054            public static String replacePermissionCheck(
055                    String sql, String className, String classPKField, long groupId) {
056    
057                    return getInlineSQLHelper().replacePermissionCheck(
058                            sql, className, classPKField, groupId);
059            }
060    
061            public static String replacePermissionCheck(
062                    String sql, String className, String classPKField, long groupId,
063                    String bridgeJoin) {
064    
065                    return getInlineSQLHelper().replacePermissionCheck(
066                            sql, className, classPKField, groupId, bridgeJoin);
067            }
068    
069            public static String replacePermissionCheck(
070                    String sql, String className, String classPKField, long[] groupIds) {
071    
072                    return getInlineSQLHelper().replacePermissionCheck(
073                            sql, className, classPKField, groupIds);
074            }
075    
076            public static String replacePermissionCheck(
077                    String sql, String className, String classPKField, long[] groupIds,
078                    String bridgeJoin) {
079    
080                    return getInlineSQLHelper().replacePermissionCheck(
081                            sql, className, classPKField, groupIds, bridgeJoin);
082            }
083    
084            public static String replacePermissionCheck(
085                    String sql, String className, String classPKField, String userIdField) {
086    
087                    return getInlineSQLHelper().replacePermissionCheck(
088                            sql, className, classPKField, userIdField);
089            }
090    
091            public static String replacePermissionCheck(
092                    String sql, String className, String classPKField, String userIdField,
093                    long groupId) {
094    
095                    return getInlineSQLHelper().replacePermissionCheck(
096                            sql, className, classPKField, userIdField, groupId);
097            }
098    
099            public static String replacePermissionCheck(
100                    String sql, String className, String classPKField, String userIdField,
101                    long groupId, String bridgeJoin) {
102    
103                    return getInlineSQLHelper().replacePermissionCheck(
104                            sql, className, classPKField, userIdField, groupId, bridgeJoin);
105            }
106    
107            public static String replacePermissionCheck(
108                    String sql, String className, String classPKField, String userIdField,
109                    long[] groupIds) {
110    
111                    return getInlineSQLHelper().replacePermissionCheck(
112                            sql, className, classPKField, userIdField, groupIds);
113            }
114    
115            public static String replacePermissionCheck(
116                    String sql, String className, String classPKField, String userIdField,
117                    long[] groupIds, String bridgeJoin) {
118    
119                    return getInlineSQLHelper().replacePermissionCheck(
120                            sql, className, classPKField, userIdField, groupIds, bridgeJoin);
121            }
122    
123            public static String replacePermissionCheck(
124                    String sql, String className, String classPKField, String userIdField,
125                    String bridgeJoin) {
126    
127                    return getInlineSQLHelper().replacePermissionCheck(
128                            sql, className, classPKField, userIdField, bridgeJoin);
129            }
130    
131            public static String replacePermissionCheck(
132                    String sql, String className, String classPKField, String userIdField,
133                    String groupIdField, long[] groupIds, String bridgeJoin) {
134    
135                    return getInlineSQLHelper().replacePermissionCheck(
136                            sql, className, classPKField, userIdField, groupIdField, groupIds,
137                            bridgeJoin);
138            }
139    
140            public void setInlineSQLHelper(InlineSQLHelper inlineSQLPermission) {
141                    PortalRuntimePermission.checkSetBeanProperty(getClass());
142    
143                    _inlineSQLPermission = inlineSQLPermission;
144            }
145    
146            private static InlineSQLHelper _inlineSQLPermission;
147    
148    }