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