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.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[] groupIds) {
040                    return getInlineSQLHelper().isEnabled(groupIds);
041            }
042    
043            public static String replacePermissionCheck(
044                    String sql, String className, String classPKField) {
045    
046                    return getInlineSQLHelper().replacePermissionCheck(
047                            sql, className, classPKField);
048            }
049    
050            public static String replacePermissionCheck(
051                    String sql, String className, String classPKField, long groupId) {
052    
053                    return getInlineSQLHelper().replacePermissionCheck(
054                            sql, className, classPKField, groupId);
055            }
056    
057            public static String replacePermissionCheck(
058                    String sql, String className, String classPKField, long groupId,
059                    String bridgeJoin) {
060    
061                    return getInlineSQLHelper().replacePermissionCheck(
062                            sql, className, classPKField, groupId, bridgeJoin);
063            }
064    
065            public static String replacePermissionCheck(
066                    String sql, String className, String classPKField, long[] groupIds) {
067    
068                    return getInlineSQLHelper().replacePermissionCheck(
069                            sql, className, classPKField, groupIds);
070            }
071    
072            public static String replacePermissionCheck(
073                    String sql, String className, String classPKField, long[] groupIds,
074                    String bridgeJoin) {
075    
076                    return getInlineSQLHelper().replacePermissionCheck(
077                            sql, className, classPKField, groupIds, bridgeJoin);
078            }
079    
080            public static String replacePermissionCheck(
081                    String sql, String className, String classPKField, String userIdField) {
082    
083                    return getInlineSQLHelper().replacePermissionCheck(
084                            sql, className, classPKField, userIdField);
085            }
086    
087            public static String replacePermissionCheck(
088                    String sql, String className, String classPKField, String userIdField,
089                    long groupId) {
090    
091                    return getInlineSQLHelper().replacePermissionCheck(
092                            sql, className, classPKField, userIdField, groupId);
093            }
094    
095            public static String replacePermissionCheck(
096                    String sql, String className, String classPKField, String userIdField,
097                    long groupId, String bridgeJoin) {
098    
099                    return getInlineSQLHelper().replacePermissionCheck(
100                            sql, className, classPKField, userIdField, groupId, bridgeJoin);
101            }
102    
103            public static String replacePermissionCheck(
104                    String sql, String className, String classPKField, String userIdField,
105                    long[] groupIds) {
106    
107                    return getInlineSQLHelper().replacePermissionCheck(
108                            sql, className, classPKField, userIdField, groupIds);
109            }
110    
111            public static String replacePermissionCheck(
112                    String sql, String className, String classPKField, String userIdField,
113                    long[] groupIds, String bridgeJoin) {
114    
115                    return getInlineSQLHelper().replacePermissionCheck(
116                            sql, className, classPKField, userIdField, groupIds, bridgeJoin);
117            }
118    
119            public static String replacePermissionCheck(
120                    String sql, String className, String classPKField, String userIdField,
121                    String bridgeJoin) {
122    
123                    return getInlineSQLHelper().replacePermissionCheck(
124                            sql, className, classPKField, userIdField, bridgeJoin);
125            }
126    
127            public static String replacePermissionCheck(
128                    String sql, String className, String classPKField, String userIdField,
129                    String groupIdField, long[] groupIds, String bridgeJoin) {
130    
131                    return getInlineSQLHelper().replacePermissionCheck(
132                            sql, className, classPKField, userIdField, groupIdField, groupIds,
133                            bridgeJoin);
134            }
135    
136            public void setInlineSQLHelper(InlineSQLHelper inlineSQLPermission) {
137                    PortalRuntimePermission.checkSetBeanProperty(getClass());
138    
139                    _inlineSQLPermission = inlineSQLPermission;
140            }
141    
142            private static InlineSQLHelper _inlineSQLPermission;
143    
144    }