001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.spring.hibernate;
022:
023: import com.liferay.portal.kernel.util.OrderByComparator;
024:
025: import org.apache.commons.logging.Log;
026: import org.apache.commons.logging.LogFactory;
027:
028: /**
029: * <a href="CustomSQLUtil.java.html"><b><i>View Source</i></b></a>
030: *
031: * @author Brian Wing Shun Chan
032: * @author Bruno Farache
033: *
034: */
035: public class CustomSQLUtil {
036:
037: public static String get(String id) {
038: return _instance._portalCustomSQLUtil.get(id);
039: }
040:
041: public static boolean isVendorDB2() {
042: return _instance._portalCustomSQLUtil.isVendorDB2();
043: }
044:
045: public static boolean isVendorInformix() {
046: return _instance._portalCustomSQLUtil.isVendorInformix();
047: }
048:
049: public static boolean isVendorMySQL() {
050: return _instance._portalCustomSQLUtil.isVendorMySQL();
051: }
052:
053: public static boolean isVendorOracle() {
054: return _instance._portalCustomSQLUtil.isVendorOracle();
055: }
056:
057: public static boolean isVendorSybase() {
058: return _instance._portalCustomSQLUtil.isVendorSybase();
059: }
060:
061: public static String[] keywords(String keywords) {
062: return _instance._portalCustomSQLUtil.keywords(keywords);
063: }
064:
065: public static String[] keywords(String keywords, boolean lowerCase) {
066: return _instance._portalCustomSQLUtil.keywords(keywords,
067: lowerCase);
068: }
069:
070: public static String[] keywords(String[] keywordsArray) {
071: return _instance._portalCustomSQLUtil.keywords(keywordsArray);
072: }
073:
074: public static String[] keywords(String[] keywordsArray,
075: boolean lowerCase) {
076: return _instance._portalCustomSQLUtil.keywords(keywordsArray,
077: lowerCase);
078: }
079:
080: public static String replaceAndOperator(String sql,
081: boolean andOperator) {
082: return _instance._portalCustomSQLUtil.replaceAndOperator(sql,
083: andOperator);
084: }
085:
086: public static String replaceIsNull(String sql) {
087: return _instance._portalCustomSQLUtil.replaceIsNull(sql);
088: }
089:
090: public static String replaceKeywords(String sql, String field,
091: String operator, boolean last, String[] values) {
092:
093: return _instance._portalCustomSQLUtil.replaceKeywords(sql,
094: field, operator, last, values);
095: }
096:
097: public static String removeOrderBy(String sql) {
098: return _instance._portalCustomSQLUtil.removeOrderBy(sql);
099: }
100:
101: public static String replaceOrderBy(String sql,
102: OrderByComparator obc) {
103: return _instance._portalCustomSQLUtil.replaceOrderBy(sql, obc);
104: }
105:
106: private CustomSQLUtil() {
107: try {
108: _portalCustomSQLUtil = new PortalCustomSQLUtil();
109: } catch (Exception e) {
110: _log.error(e, e);
111: }
112: }
113:
114: private static Log _log = LogFactory.getLog(CustomSQLUtil.class);
115:
116: private static CustomSQLUtil _instance = new CustomSQLUtil();
117:
118: private PortalCustomSQLUtil _portalCustomSQLUtil;
119:
120: }
|