001    /**
002     * Copyright (c) 2000-2010 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.portlet.expando.util;
016    
017    import com.liferay.portal.security.auth.CompanyThreadLocal;
018    import com.liferay.portlet.expando.model.ExpandoBridge;
019    
020    /**
021     * @author Brian Wing Shun Chan
022     */
023    public class ExpandoBridgeFactoryUtil {
024    
025            public static ExpandoBridge getExpandoBridge(
026                    long companyId, String className) {
027    
028                    return getExpandoBridgeFactory().getExpandoBridge(companyId, className);
029            }
030    
031            public static ExpandoBridge getExpandoBridge(
032                    long companyId, String className, long classPK) {
033    
034                    return getExpandoBridgeFactory().getExpandoBridge(
035                            companyId, className, classPK);
036            }
037    
038            /**
039             * @deprecated {@link #getExpandoBridge(long, String)}
040             */
041            public static ExpandoBridge getExpandoBridge(String className) {
042                    long companyId = CompanyThreadLocal.getCompanyId();
043    
044                    return getExpandoBridge(companyId, className);
045            }
046    
047            /**
048             * @deprecated {@link #getExpandoBridge(long, String, long)}
049             */
050            public static ExpandoBridge getExpandoBridge(
051                    String className, long classPK) {
052    
053                    long companyId = CompanyThreadLocal.getCompanyId();
054    
055                    return getExpandoBridge(companyId, className, classPK);
056            }
057    
058            public static ExpandoBridgeFactory getExpandoBridgeFactory() {
059                    return _expandoBridgeFactory;
060            }
061    
062            public void setExpandoBridgeFactory(
063                    ExpandoBridgeFactory expandoBridgeFactory) {
064    
065                    _expandoBridgeFactory = expandoBridgeFactory;
066            }
067    
068            private static ExpandoBridgeFactory _expandoBridgeFactory;
069    
070    }