Package org.encuestame.social.api.support

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


            // on 2013 identi.ca changed  name to pump.io
            if (socialProvider.equals(SocialProvider.IDENTICA) || socialProvider.equals(SocialProvider.PUMPIO)) {
                IdenticaAPIOperations apiOperations = new IdenticaAPITemplate(
                        apiKey, consumerSecret, accessToken.getValue(),
                        accessToken.getSecret());
                IdentiCaProfile profile = apiOperations.getUserProfile();
                log.debug("identica profile "+profile.toString());
                SocialUserProfile profileAPI = apiOperations.getProfile();
                final SocialAccount socialAccount = getSecurityService().getCurrentSocialAccount(socialProvider,
                        String.valueOf(profile.getId()));
                if (socialAccount == null) {
                    getSecurityService().addNewSocialAccount(
                            accessToken.getValue(), accessToken.getSecret(), null, profileAPI,
                            socialProvider, getUserAccount());
                } else {
                    log.warn("This account already exist");
                    throw new EnMeExistPreviousConnectionException(getMessage("social.repeated.account"));
                }
            } else if (socialProvider.equals(SocialProvider.LINKEDIN)) {
                LinkedInAPIOperations apiOperations = new LinkedInAPITemplate(
                        apiKey, consumerSecret, accessToken.getValue(),
                        accessToken.getSecret());
                LinkedInProfile profile = apiOperations.getUserProfile();
                SocialUserProfile profileAPI = apiOperations.getProfile();
                log.debug("linkedin profile "+profile.toString());
                final SocialAccount socialAccount = getSecurityService().getCurrentSocialAccount(socialProvider, profile.getId());
                if (socialAccount == null) {
                    getSecurityService().addNewSocialAccount(
                            accessToken.getValue(), accessToken.getSecret(), null, profileAPI,
                            socialProvider, getUserAccount());
                } else {
                    log.warn("This account already exist");
                    throw new EnMeExistPreviousConnectionException(getMessage("social.repeated.account"));
                }
            } else if (socialProvider.equals(SocialProvider.TWITTER)) {
                TwitterAPIOperations operations = new TwitterAPITemplate(consumerSecret, apiKey, accessToken.getValue(),
                        accessToken.getSecret());
                SocialUserProfile profile = operations.getProfile();
                log.debug("twitter profile "+profile.toString());
                final SocialAccount socialAccount = getSecurityService().getCurrentSocialAccount(socialProvider, profile.getId());
                if (socialAccount == null) {
                    getSecurityService().addNewSocialAccount(
                            accessToken.getValue(), accessToken.getSecret(), null, profile,
                            socialProvider, getUserAccount());
                } else {
                    log.warn("This account already exist");
                    throw new EnMeExistPreviousConnectionException(getMessage("social.repeated.account"));
                }
                //FUTURE - Issues with OAuth1 request.
            } else if (socialProvider.equals(SocialProvider.YAHOO)) {
                //FUTURE - Only valid on defined domain.
                log.debug("Yahoo provider is disabled");
               
            } else if (socialProvider.equals(SocialProvider.PLURK)) {
              PlurkAPIOperations  apiOperations = new PlurkAPITemplate(
                        apiKey, consumerSecret, accessToken.getValue(),
                        accessToken.getSecret());
                SocialUserProfile profile = apiOperations.getProfile();
                log.debug("plurk profile " + profile.toString());
                final SocialAccount socialAccount = getSecurityService().getCurrentSocialAccount(socialProvider, profile.getId());
                if (socialAccount == null) {
                    getSecurityService().addNewSocialAccount(
                            accessToken.getValue(), accessToken.getSecret(), null, profile,
                            socialProvider, getUserAccount());
                } else {
                    log.warn("This account already exist");
                    throw new EnMeExistPreviousConnectionException(getMessage("social.repeated.account"));
                }
            } else if (socialProvider.equals(SocialProvider.TUMBLR)) {
              TumblrAPIOperations apiOperations = new TumblrAPITemplate(
                        apiKey, consumerSecret, accessToken.getValue(),
                        accessToken.getSecret());
                SocialUserProfile profile = apiOperations.getProfile();
                log.debug("linkedin profile "+profile.toString());
                final SocialAccount socialAccount = getSecurityService().getCurrentSocialAccount(socialProvider, profile.getId());
                if (socialAccount == null) {
                    getSecurityService().addNewSocialAccount(
                            accessToken.getValue(), accessToken.getSecret(), null, profile,
                            socialProvider, getUserAccount());
                } else {
View Full Code Here


     *
     * @param response
     * @return
     */
    private IdentiCaProfile getProfileFromResponseMap(Map<?, ?> response) {
        IdentiCaProfile profile = new IdentiCaProfile();
        profile.setId(Long.valueOf(String.valueOf(response.get("id"))).longValue());
        profile.setScreenName(String.valueOf(response.get("screen_name")));
        profile.setName(String.valueOf(response.get("name")));
        profile.setDescription(String.valueOf(response.get("description")));
        profile.setLocation(String.valueOf(response.get("location")));
        profile.setUrl(String.valueOf(response.get("url")));
        profile.setProfileImageUrl(String.valueOf(response.get("profile_image_url")));
        profile.setCreatedDate(toDate(String.valueOf(response.get("created_at")), timelineDateFormat));
        return profile;
    }
View Full Code Here

     *
     * @return
     */
    @Override
    public SocialUserProfile getProfile() {
        IdentiCaProfile profile = this.getUserProfile();
        final SocialUserProfile socialUserProfile = new SocialUserProfile();
        socialUserProfile.setDescription(profile.getDescription());
        socialUserProfile.setCreatedAt(profile.getCreatedDate());
        socialUserProfile.setId(String.valueOf(profile.getId()));
        socialUserProfile.setLocation(profile.getLocation());
        socialUserProfile.setProfileImageUrl(profile.getProfileImageUrl());
        socialUserProfile.setProfileUrl(profile.getProfileUrl());
        socialUserProfile.setScreenName(profile.getScreenName());
        socialUserProfile.setUsername(profile.getScreenName());
        socialUserProfile.setUrl(profile.getUrl());
        return socialUserProfile;
    }
View Full Code Here

TOP

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

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.