Package com.music.model.persistent

Examples of com.music.model.persistent.SocialAuthentication


        if (existingAuths.isEmpty()) {
            User user = userDao.getById(User.class, userId);
            auth.setUser(user);
            userDao.persist(auth);
        } else {
            SocialAuthentication existingAuth = existingAuths.get(0);
            existingAuth.setExpirationTime(auth.getExpirationTime());
            existingAuth.setRefreshToken(auth.getRefreshToken());
            existingAuth.setImageUrl(auth.getImageUrl());
            userDao.persist(existingAuth);
        }
    }
View Full Code Here


        user.setLoginAutomatically(loginAutomatically);
        user.setRegistrationTime(new DateTime());
        user.setReceiveDailyDigest(receiveDailyDigest);
        user = userDao.persist(user);
        if (connection != null) {
            SocialAuthentication auth = JpaConnectionRepository.connectionToAuth(connection);
            auth.setUser(user);
            userDao.persist(auth);
        }
        return user;
    }
View Full Code Here

    @Transactional(readOnly=true)
    public SocialAuthentication getTwitterAuthentication(User user) {
        if (user == null) {
            return null;
        }
        SocialAuthentication auth = userDao.getTwitterAuthentication(user);
        return auth;
    }
View Full Code Here

    }

    @Override
    @Transactional
    public void addConnection(Connection<?> connection) {
        SocialAuthentication auth = connectionToAuth(connection);
        userService.connect(userId, auth);
    }
View Full Code Here

        userService.connect(userId, auth);
    }

    @Override
    public void updateConnection(Connection<?> connection) {
        SocialAuthentication auth = connectionToAuth(connection);
        userService.connect(userId, auth);
    }
View Full Code Here

        SocialAuthentication auth = connectionToAuth(connection);
        userService.connect(userId, auth);
    }

    public static SocialAuthentication connectionToAuth(Connection<?> connection) {
        SocialAuthentication auth = new SocialAuthentication();
        ConnectionData data = connection.createData();
        auth.setProviderId(data.getProviderId());
        auth.setToken(data.getAccessToken());
        auth.setRefreshToken(data.getRefreshToken());
        auth.setSecret(data.getSecret());
        auth.setProviderUserId(data.getProviderUserId());
        return auth;
    }
View Full Code Here

    public TimelineMusic storeUserTimelinePiece(User user) {
        if (user == null) {
            return null;
        }

        SocialAuthentication auth = userDao.getTwitterAuthentication(user);

        if (auth == null) {
            return null;
        }

        Twitter twitter = provider.getApi(auth.getToken(), auth.getSecret());
        List<Tweet> tweets = twitter.timelineOperations().getUserTimeline(200);

        TimelineMusic meta = getUserTimelinePiece(tweets);
        meta.setTwitterHandle(twitter.userOperations().getScreenName());
        meta.setUser(user);
View Full Code Here

TOP

Related Classes of com.music.model.persistent.SocialAuthentication

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.