Package org.encuestame.social.api

Examples of org.encuestame.social.api.FacebookAPITemplate


     */
    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


        super(accessToken, securityOperations);
    }

    @Override
    public SocialAPIOperations getAPISocialProvider() {
        return new FacebookAPITemplate(getAccessGrant().getAccessToken());
    }
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

    }


    public void testFacebook(){
        final String key = "102345790957|2.Zum2qrFYX25vEcK0VPCGXg__.3600.1303513200.1-100002344241319|-K3LZVuOz3trNGOExskllhzHDeo";
        FacebookAPITemplate fb = new FacebookAPITemplate(key);
        fb.updateStatus("@encuestame primer mensajeeeeeeeee");
    }
View Full Code Here

TOP

Related Classes of org.encuestame.social.api.FacebookAPITemplate

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.