Package org.encuestame.social.api.support

Examples of org.encuestame.social.api.support.FacebookAPIOperations


     */
    public String checkOAuth2SocialAccount(final SocialProvider socialProvider,
            final AccessGrant accessGrant) throws Exception {
        String actionToDo = "";
        if (socialProvider.equals(SocialProvider.FACEBOOK)) {
            final FacebookAPIOperations facebookAPIOperations = new FacebookAPITemplate(accessGrant.getAccessToken());
            final SocialAccount socialAccount = getSecurityService().getCurrentSocialAccount(socialProvider, facebookAPIOperations.getProfile().getId(), facebookAPIOperations.getProfile().getUsername());
            if (socialAccount == null) {
                  getSecurityService().addNewSocialAccount(
                          accessGrant.getAccessToken(), accessGrant.getRefreshToken(), accessGrant.getExpires(),
                          facebookAPIOperations.getProfile(),
                          socialProvider, getUserAccount());
            } else {
                log.warn("This account already exist");
                throw new EnMeExistPreviousConnectionException(getMessage("social.repeated.account"));
            }
View Full Code Here


                log.error(e);
                e.printStackTrace();
            }
        } else if (socialAccount.getAccounType().equals(SocialProvider.FACEBOOK)) {
            log.debug("Publish on FACEBOOK");
            FacebookAPIOperations facebookAPIOperations = new FacebookAPITemplate(socialAccount.getAccessToken());
            try {
                log.debug("Publish on FACEBOOK............>");
                published = facebookAPIOperations.updateStatus(tweetText);
                log.debug("Publish on FACEBOOK...... "+published);
                published.setDatePublished(Calendar.getInstance().getTime());
            } catch (HttpClientErrorException e) {
                log.error("-----------------------FACEBOOK EXPIRED TOKEN----------------------- 1");
                log.error(e.getStatusCode());
View Full Code Here

TOP

Related Classes of org.encuestame.social.api.support.FacebookAPIOperations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.