001    /**
002     * Copyright (c) 2000-2012 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.kernel.facebook;
016    
017    import com.liferay.portal.kernel.exception.SystemException;
018    import com.liferay.portal.kernel.json.JSONObject;
019    
020    import javax.portlet.PortletRequest;
021    
022    /**
023     * @author Wilson Man
024     * @author Brian Wing Shun Chan
025     * @author Mika Koivisto
026     */
027    public class FacebookConnectUtil {
028    
029            public static String getAccessToken(
030                            long companyId, String redirect, String code)
031                    throws SystemException {
032    
033                    return getFacebookConnect().getAccessToken(companyId, redirect, code);
034            }
035    
036            public static String getAccessTokenURL(long companyId)
037                    throws SystemException {
038    
039                    return getFacebookConnect().getAccessTokenURL(companyId);
040            }
041    
042            public static String getAppId(long companyId) throws SystemException {
043                    return getFacebookConnect().getAppId(companyId);
044            }
045    
046            public static String getAppSecret(long companyId) throws SystemException {
047                    return getFacebookConnect().getAppSecret(companyId);
048            }
049    
050            public static String getAuthURL(long companyId) throws SystemException {
051                    return getFacebookConnect().getAuthURL(companyId);
052            }
053    
054            public static FacebookConnect getFacebookConnect() {
055                    return _facebookConnect;
056            }
057    
058            public static JSONObject getGraphResources(
059                    long companyId, String path, String accessToken, String fields) {
060    
061                    return getFacebookConnect().getGraphResources(
062                            companyId, path, accessToken, fields);
063            }
064    
065            public static String getGraphURL(long companyId) throws SystemException {
066                    return getFacebookConnect().getGraphURL(companyId);
067            }
068    
069            public static String getProfileImageURL(PortletRequest portletRequest) {
070                    return getFacebookConnect().getProfileImageURL(portletRequest);
071            }
072    
073            public static String getRedirectURL(long companyId) throws SystemException {
074                    return getFacebookConnect().getRedirectURL(companyId);
075            }
076    
077            public static boolean isEnabled(long companyId) throws SystemException {
078                    return getFacebookConnect().isEnabled(companyId);
079            }
080    
081            public static boolean isVerifiedAccountRequired(long companyId)
082                    throws SystemException {
083    
084                    return getFacebookConnect().isVerifiedAccountRequired(companyId);
085            }
086    
087            public void setFacebookConnect(FacebookConnect facebookConnect) {
088                    _facebookConnect = facebookConnect;
089            }
090    
091            private static FacebookConnect _facebookConnect;
092    
093    }