001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }