Package org.encuestame.persistence.domain.security

Examples of org.encuestame.persistence.domain.security.SocialAccount


    /**
     * Test getSocialAccount.
     */
    //@Test
    public void testgetSocialAccount(){
        final SocialAccount ac = createSocialProviderAccount(this.userAccount, SocialProvider.GOOGLE_BUZZ);
        final SocialAccount ex = getAccountDao().getSocialAccount(ac.getId(), this.account);
        assertEquals("Should be equals", ac.getId(),ex.getId());
        final SocialAccount ex2 = getAccountDao().getSocialAccount(SocialProvider.GOOGLE_BUZZ, ex.getSocialProfileId());
        assertNotNull(ex2);
        assertEquals("Should be equals", ac.getId(), ex2.getId());
    }
View Full Code Here


     * @return
     * @throws EnMeExpcetion
     */
    public UserAccount findAccountByConnection(final SocialProvider provider, final String profileId)
           throws EnMeNoResultsFoundException {
        final SocialAccount ac = this.findAccountConnectionBySocialProfileId(provider, profileId);
        if (ac == null) {
            throw new EnMeNoResultsFoundException("connection not found");
        } else {
            return ac.getUserOwner();
        }
    }
View Full Code Here

            final String expiresToken,
            final String username,
            final SocialUserProfile socialUserProfile,
            final SocialProvider socialProvider,
            final UserAccount userAccount) {
         final SocialAccount socialAccount = new SocialAccount();
         socialAccount.setAccessToken(token);
         socialAccount.setSecretToken(tokenSecret);
         socialAccount.setAccount(userAccount.getAccount());
         socialAccount.setUserOwner(userAccount);
         socialAccount.setExpires(expiresToken);
         socialAccount.setAccounType(socialProvider);
         socialAccount.setAddedAccount(new Date());
         socialAccount.setVerfied(Boolean.TRUE);
         socialAccount.setSocialAccountName(socialUserProfile.getUsername());
         socialAccount.setType(SocialProvider.getTypeAuth(socialProvider));
         socialAccount.setUpgradedCredentials(new Date());
         socialAccount.setSocialProfileId(socialUserProfile.getId());
         socialAccount.setPublicProfileUrl(socialUserProfile.getProfileUrl());
         socialAccount.setPrictureUrl(socialUserProfile.getProfileImageUrl()); //TODO: repeated
         socialAccount.setProfilePictureUrl(socialUserProfile.getProfileImageUrl());
         socialAccount.setEmail(socialUserProfile.getEmail());
         socialAccount.setProfileThumbnailPictureUrl(socialUserProfile.getProfileImageUrl());
         socialAccount.setRealName(socialUserProfile.getRealName());
         this.saveOrUpdate(socialAccount);
        return socialAccount;
    }
View Full Code Here

     * @param provider
     * @return
     */
    public boolean isConnected(String accountId, SocialProvider provider) {
        boolean account = false;
        final SocialAccount connection =  this.getAccountConnection(accountId, provider);
        log.debug("Is connected "+account);
        if(connection != null){
            account = true;
        }
        return account;
View Full Code Here

     * @param accountId
     * @param provider
     * @throws EnMeNoResultsFoundException
     */
    public void disconnect(String accountId, SocialProvider provider) throws EnMeNoResultsFoundException {
        final SocialAccount ac = this.getAccountConnection(accountId, provider);
        if(ac == null){
            throw new EnMeNoResultsFoundException("connection not found");
        } else {
            getHibernateTemplate().delete(ac);
        }
View Full Code Here

     * @param provider
     * @return
     * @throws EnMeNoResultsFoundException
     */
    public OAuth1Token getAccessToken(String accountId, SocialProvider provider) throws EnMeNoResultsFoundException {
        final SocialAccount ac = this.getAccountConnection(accountId, provider);
        if (ac != null) {
            final OAuth1Token oAuthToken = new OAuth1Token(ac.getAccessToken(),
                    ac.getSecretToken());
            return oAuthToken;
        } else {
            throw new EnMeNoResultsFoundException("connection not found");
        }
    }
View Full Code Here

     * @param provider
     * @return
     * @throws EnMeNoResultsFoundException
     */
    public Long getProviderAccountId(String accountId, SocialProvider provider) throws EnMeNoResultsFoundException {
        final SocialAccount ac = this.getAccountConnection(accountId, provider);
        if (ac != null) {
            return ac.getId();
        } else {
            throw new EnMeNoResultsFoundException("connection not found");
        }
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.security.SocialAccount

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.