001    /**
002     * Copyright (c) 2000-2011 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    /**
018     * @author Raymond Augé
019     */
020    public class InlineSQLHelperUtil {
021    
022            public static InlineSQLHelper getInlineSQLHelper() {
023                    return _inlineSQLPermission;
024            }
025    
026            public static boolean isEnabled() {
027                    return getInlineSQLHelper().isEnabled();
028            }
029    
030            public static boolean isEnabled(long groupId) {
031                    return getInlineSQLHelper().isEnabled(groupId);
032            }
033    
034            public static boolean isEnabled(long[] groupIds) {
035                    return getInlineSQLHelper().isEnabled(groupIds);
036            }
037    
038            public static String replacePermissionCheck(
039                    String sql, String className, String classPKField, String userIdField) {
040    
041                    return getInlineSQLHelper().replacePermissionCheck(
042                            sql, className, classPKField, userIdField);
043            }
044    
045            public static String replacePermissionCheck(
046                    String sql, String className, String classPKField, String userIdField,
047                    long groupId) {
048    
049                    return getInlineSQLHelper().replacePermissionCheck(
050                            sql, className, classPKField, userIdField, groupId);
051            }
052    
053            public static String replacePermissionCheck(
054                    String sql, String className, String classPKField, String userIdField,
055                    long groupId, String bridgeJoin) {
056    
057                    return getInlineSQLHelper().replacePermissionCheck(
058                            sql, className, classPKField, userIdField, groupId, bridgeJoin);
059            }
060    
061            public static String replacePermissionCheck(
062                    String sql, String className, String classPKField, String userIdField,
063                    long[] groupIds) {
064    
065                    return getInlineSQLHelper().replacePermissionCheck(
066                            sql, className, classPKField, userIdField, groupIds);
067            }
068    
069            public static String replacePermissionCheck(
070                    String sql, String className, String classPKField, String userIdField,
071                    long[] groupIds, String bridgeJoin) {
072    
073                    return getInlineSQLHelper().replacePermissionCheck(
074                            sql, className, classPKField, userIdField, groupIds, bridgeJoin);
075            }
076    
077            public static String replacePermissionCheck(
078                    String sql, String className, String classPKField, String userIdField,
079                    String bridgeJoin) {
080    
081                    return getInlineSQLHelper().replacePermissionCheck(
082                            sql, className, classPKField, userIdField, bridgeJoin);
083            }
084    
085            public void setInlineSQLHelper(InlineSQLHelper inlineSQLPermission) {
086                    _inlineSQLPermission = inlineSQLPermission;
087            }
088    
089            private static InlineSQLHelper _inlineSQLPermission;
090    
091    }