001    /**
002     * Copyright (c) 2000-present 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.json.JSONObject;
018    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
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    
032                    return getFacebookConnect().getAccessToken(companyId, redirect, code);
033            }
034    
035            public static String getAccessTokenURL(long companyId) {
036                    return getFacebookConnect().getAccessTokenURL(companyId);
037            }
038    
039            public static String getAppId(long companyId) {
040                    return getFacebookConnect().getAppId(companyId);
041            }
042    
043            public static String getAppSecret(long companyId) {
044                    return getFacebookConnect().getAppSecret(companyId);
045            }
046    
047            public static String getAuthURL(long companyId) {
048                    return getFacebookConnect().getAuthURL(companyId);
049            }
050    
051            public static FacebookConnect getFacebookConnect() {
052                    PortalRuntimePermission.checkGetBeanProperty(FacebookConnectUtil.class);
053    
054                    return _facebookConnect;
055            }
056    
057            public static JSONObject getGraphResources(
058                    long companyId, String path, String accessToken, String fields) {
059    
060                    return getFacebookConnect().getGraphResources(
061                            companyId, path, accessToken, fields);
062            }
063    
064            public static String getGraphURL(long companyId) {
065                    return getFacebookConnect().getGraphURL(companyId);
066            }
067    
068            public static String getProfileImageURL(PortletRequest portletRequest) {
069                    return getFacebookConnect().getProfileImageURL(portletRequest);
070            }
071    
072            public static String getRedirectURL(long companyId) {
073                    return getFacebookConnect().getRedirectURL(companyId);
074            }
075    
076            public static boolean isEnabled(long companyId) {
077                    return getFacebookConnect().isEnabled(companyId);
078            }
079    
080            public static boolean isVerifiedAccountRequired(long companyId) {
081                    return getFacebookConnect().isVerifiedAccountRequired(companyId);
082            }
083    
084            public void setFacebookConnect(FacebookConnect facebookConnect) {
085                    PortalRuntimePermission.checkSetBeanProperty(getClass());
086    
087                    _facebookConnect = facebookConnect;
088            }
089    
090            private static FacebookConnect _facebookConnect;
091    
092    }